Page 1 of 4

Check drives size displays too much information

Posted: Tue May 07, 2019 10:59 am
by Frédéric GRANAT
Hi,

I run the following command :

Code: Select all

[[email protected] ~]# /usr/local/nagios/libexec/check_wmi_plus.pl -H xxxxxxx -u xxxxxxx -p xxxxxx -m checkdrivesize -a 'C:|D:|E:|F:|G:|Q:|H:|I:|L:|M:|N:|R:' -w _FreeGB=10: -c _FreeGB=5:
it returns :

Code: Select all

OK - C: Total=39.66GB, Used=17.61GB (44.4%), Free=22.05GB (55.6%)     OK - D: Total=1300.00GB, Used=1125.88GB (86.6%), Free=174.11GB (13.4%)     OK - E: Total=220.00GB, Used=160.84GB (73.1%), Free=59.16GB (26.9%)     OK - F: Total=2457.47GB, Used=2086.89GB (84.9%), Free=370.59GB (15.1%)     OK - G: Total=3071.87GB, Used=2326.75GB (75.7%), Free=745.12GB (24.3%)     OK - M: Total=300.00GB, Used=269.53GB (89.8%), Free=30.47GB (10.2%)     CRITICAL - [Triggered by _FreeGB<5] - N: Total=5.00GB, Used=0.54GB (10.8%), Free=4.46GB (89.2%)     |&apos;C: Space&apos;=17.61GB; &apos;C: Utilisation&apos;=44.4%; &apos;D: Space&apos;=1125.88GB; &apos;D: Utilisation&apos;=86.6%; &apos;E: Space&apos;=160.84GB; &apos;E: Utilisation&apos;=73.1%; &apos;F: Space&apos;=2086.89GB; &apos;F: Utilisation&apos;=84.9%; &apos;G: Space&apos;=2326.75GB; &apos;G: Utilisation&apos;=75.7%; &apos;M: Space&apos;=269.53GB; &apos;M: Utilisation&apos;=89.8%; &apos;N: Space&apos;=0.54GB; &apos;N: Utilisation&apos;=10.8%;
As you can see the disk in critical state is lost among disks in OK state.
How can I do to display only the disk in critical state ?

Rgds,

Frederic

Re: Check drives size displays too much information

Posted: Tue May 07, 2019 1:08 pm
by scottwilkerson
The only real way around this would be to break your disk checks into multiple checks

Re: Check drives size displays too much information

Posted: Tue May 07, 2019 1:35 pm
by lmiltchev
I found out that the new version of the plugin (1.64) displays non-OK stats first.
checkdrivesize
By default, drives in a non-OK state will be shown first.
Also see checkvolsize
ARG1 drive letter or volume name of the disk to check. If omitted a list of valid drives will be shown. If set to . all drives will be included.
To include multiple drives separate them with a |. This uses a regular expression so take care to
specify exactly what you want. eg "C" or "C:" or "C|E" or "." or "Data"
ARG2 Set this to 1 to use volumes names (if they are defined) in plugin output and performance data ie -o 1
ARG3 Set this to 1 to include information about the sum of all disk space on the entire system.
If you set this you can also check warn/crit against the overall disk space.
To show only the overall disk, set ARG3 to 1 and set ARG1 to 1 (actually to any non-existant disk)
Eg -o 1 -3 1
ARG4 This is a 2 character string which controls how the drive information is displayed.
https://github.com/speartail/checkwmipl ... README.txt

https://github.com/speartail/checkwmipl ... mi_plus.pl

This may help you find issues in the output faster.

Having said that, I would recommend that you try this plugin in a test environment first. The new plugin hasn't been tested by us. It may not work well with our WMI wizard. In addition to this, before you even start using it, you would need to modify it by changing some of the paths, e.g. the path to the nagios plugins, ini, and conf file, etc.

Hope this helps.

Re: Check drives size displays too much information

Posted: Thu May 09, 2019 2:18 am
by Frédéric GRANAT
Hi,
Thanks
Could you please explain to me how to install it ? (I don't find the .pl file in the link you gave).
Could you please also explain to me where I will have to change the path (in Nagios or in the pluggin) ?

Rgds,

Frederic

Re: Check drives size displays too much information

Posted: Thu May 09, 2019 9:03 am
by lmiltchev
You can just copy/paste the code into a new file or try using this link instead:

http://edcint.co.nz/checkwmiplus/sites/ ... .64.tar.gz

Open the plugin in a text editor, and change these three lines:

Code: Select all

my $conf_file='/etc/check_wmi_plus/check_wmi_plus.conf';
use lib "/usr/lib/nagios/plugins";
use lib "/usr/lib64/nagios/plugins";
to these:

Code: Select all

my $conf_file='/usr/local/nagios/libexec/check_wmi_plus.conf';
use lib "/usr/local/nagios/libexec";
#use lib "/usr/lib64/nagios/plugins";
to start with.

Also, copy over the check_wmi_plus_help.pl file to /usr/local/nagios/libexec directory, so that you would have a "working" help/usage menu:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl --help
Let us know if this worked for you. Thank you!

Re: Check drives size displays too much information

Posted: Fri May 10, 2019 2:16 am
by Frédéric GRANAT
Hi,
It works for the server I was focused on but there's a side effect on another server :
After I changed the check_wmi_plus, che check on that server displays the following message :
(Return code of 255 is out of bounds)

When I run check command on the service template on that server I've got :

[[email protected] ~]# /usr/local/nagios/libexec/check_wmi_plus.pl -H xxxxxxx -u xxxxxx -p xxxxxxxx -m checkdrivesize -a 'C:|D:|E:|F:|G:|Q:|H:|I:|L:|M:|N:|R:' -w _FreeGB=10: -c _FreeGB=5:

Do you have any idea ?

Re: Check drives size displays too much information

Posted: Fri May 10, 2019 9:38 am
by lmiltchev
I am not sure why this would be happening on the other server. Let's try increasing the verbosity by adding --extrawmicarg "--debuglevel=4" to your command:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H xxxxxxx -u xxxxxx -p xxxxxxxx -m checkdrivesize -a 'C:|D:|E:|F:|G:|Q:|H:|I:|L:|M:|N:|R:' -w _FreeGB=10: -c _FreeGB=5: --extrawmicarg "--debuglevel=4"
Can you show the output of the command above?

Re: Check drives size displays too much information

Posted: Mon May 13, 2019 2:57 am
by Frédéric GRANAT
Hi,
Here it is :

Code: Select all

[root@nagiosxi ~]# /usr/local/nagios/libexec/check_wmi_plus.pl -H xxxxxxxxxxx -u xxxxxxxxxxx -p xxxxxxxxxxxxx -m checkdrivesize -a 'C:|D:|E:|F:|G:|Q:|H:|I:|L:|M:|N:|R:' -w _FreeGB=10: -c _FreeGB=5:  --extrawmicarg "--debuglevel=4"
Negative number not allowed in format_bytes at /usr/local/nagios/libexec/check_wmi_plus.pl line 1360

Re: Check drives size displays too much information

Posted: Mon May 13, 2019 9:45 am
by lmiltchev
I don't know why the plugin shows a negative number error... I am not able to recreate the issue in-house. It is possible that one or more of your drives wrongly report a negative number when checked via WMI. I would recommend that you run the check against each individual drive to see if one of them, some of them, or all of them are failing.

I know that SNMP has issues with very large drives, but I haven't heard of WMI having the same issues.

Re: Check drives size displays too much information

Posted: Mon May 13, 2019 10:49 am
by Frédéric GRANAT
Thanks,
I found that only drive D: causes the problem.
I'm going to investigate further on that point, if you have any idea...