Page 1 of 1

Autodetect Drives in Windows?

Posted: Thu Jun 13, 2019 5:08 pm
by emartine
We encountered an issue where a windows server had an extra drive added to it. Since it wasn't added to nagios... that drive went unnoticed until it filled up and folks started experiencing issues.

Are there any windows plugins that can automatically detect all disks on a windows system?

A collegue of mine worked on a plugin for unix to automatically detect partitions on Unix servers based on file systems specified and also allowed for exclusion of and allowed specifying specific thresholds for partitions.... so we have one for unix and are using nrpe. I was hoping there was one out there for windows servers.

*I know Nagios exchange has an snmp check but I am looking for one that can be executed with nrpe.

Re: Autodetect Drives in Windows?

Posted: Fri Jun 14, 2019 10:50 am
by lmiltchev
What kind of checks are you currently using the monitor Windows drives? If you are using check_nrpe with NSClient++, you could be checking all drives with "one go", using an asterisk.

For example:

Code: Select all

[root@main-nagios-xi tmp]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_drivesize "crit=free<10%" drive=*
OK All 3 drive(s) are ok|'D:\ used'=227.16797GB;745.20859;838.35966;0;931.51073 'D:\ used %'=24%;80;90;0;100 'C:\ used'=58.67955GB;85.97577;96.72275;0;107.46972 'C:\ used %'=55%;80;90;0;100 'E:\ used'=0B;0;0;0;0
https://docs.nsclient.org/reference/win ... _drivesize

Is this what you are looking for?

Re: Autodetect Drives in Windows?

Posted: Fri Jun 14, 2019 11:35 am
by emartine
Thank you for that. This is a step in the right direction.

Is it possible to exclude drives like A and other volumes?

OK All 4 drive(s) are ok|'A:\ used'=0B;0;0;0;0 'C:\ used'=53.98049GB;57.32499;64.49062;0;71.65624 'C:\ used %'=75%;80;90;0;100 'D:\ used'=0B;0;0;0;0 '\\?\Volume{43e040ff-fee4-16-80b4-80f6e6963}\ used'=262.05468MB;279.99687;314.99648;0;349.99609 '\\?\Volume{43e04f-fee4-11e6-80b4-806f6e6963}\ used %'=74%;79;89;0;100

Re: Autodetect Drives in Windows?

Posted: Fri Jun 14, 2019 12:19 pm
by lmiltchev
Ops, I forgot to include the "-a" flag for passing arguments with check_nrpe... Sorry about that. So, the command should be:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_drivesize -a "crit=free<10%" drive=*
I am not sure about if this plugin is capable of showing A and other volumes. NSClient++ is not written or maintained by us (Nagios). You could try the following command (from the NSClient++ documentation):

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_drivesize -a "crit=free<10%" drive=all-volumes
Hope this helps.

Re: Autodetect Drives in Windows?

Posted: Tue Jun 18, 2019 12:02 pm
by emartine
Thanks. This seems to work for what I need.

/usr/local/nagios/libexec/check_nrpe -H <server> -c check_drivesize -a "crit=free<10%" "warn=free<15%" drive=* exclude=A:\\ exclude=E:\\



https://docs.nsclient.org/0.5.0/referen ... ze.exclude

Re: Autodetect Drives in Windows?

Posted: Tue Jun 18, 2019 1:39 pm
by lmiltchev
Great! I am glad your issue has been resolved! I will be closing this topic now. If you have any further questions/issues, please start a new thread.