Page 2 of 2

Re: Service OK whereas not OK

Posted: Wed Feb 14, 2018 3:08 am
by Frédéric GRANAT
Hi,

/usr/local/nagios/libexec/check_wmi_plus.pl -H xxxxxxxxx -u domcompta/xxxxxx -p dsisvc -m checkdrivesize -a 'C|D|E|Q|H|I|L|M|N' -w _FreeGB=20G -c _FreeGB=10G

means I want to have :
a warning when there is 20 Gb of free space left
a critical when there is 10 Gb of free space left

Re: Service OK whereas not OK

Posted: Wed Feb 14, 2018 9:44 am
by scottwilkerson
It is supposed to be without the G in the command.

From the help

Code: Select all

EXAMPLES WITH FIELDS
 for MODE=checkdrivesize:
 _UsedGB=10              Check if the _UsedGB field is < 0 or > 10, (outside the range of {0 .. 10})
like so

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H xxxxxxxxx -u domcompta/xxxxxx -p dsisvc -m checkdrivesize -a 'C|D|E|Q|H|I|L|M|N' -w _FreeGB=20 -c _FreeGB=10
HOWEVER, you have drives that are reporting negative space and utilization which is going to cause the plugin to not function as expected. If free + used doesn't equal total, there is going to be a problem. (drive D in this example)
Frédéric GRANAT wrote:

Code: Select all

[root@nagiosxi libexec]# ./check_wmi_plus.pl -H xxxxxxxxx -u xxxxxxxxxx -p xxxxxxxx -m checkdrivesize -a 'C|D|E|Q|H|I|L|M|N' -w _FreeGB=20 -c _FreeGB=10
CRITICAL - [Triggered by _FreeGB>10] - C: Total=59.66GB, Used=15.29GB (25.6%), Free=44.37GB (74.4%) CRITICAL - [Triggered by _FreeGB>10] - D: Total=70.00GB, Used=-32.11GB (-45.9%), Free=102.11GB (145.9%) CRITICAL - [Triggered by _FreeGB>10] - E: Total=520.00GB, Used=342.66GB (65.9%), Free=177.34GB (34.1%) CRITICAL - [Triggered by _FreeGB>10] - F: Total=25.00GB, Used=1.77GB (7.1%), Free=23.22GB (92.9%) |'C: Space'=15.29GB; 'C: Utilisation'=25.6%; 'D: Space'=-32.11GB; 'D: Utilisation'=-45.9%; 'E: Space'=342.66GB; 'E: Utilisation'=65.9%; 'F: Space'=1.77GB; 'F: Utilisation'=7.1%;

Re: Service OK whereas not OK

Posted: Thu Feb 15, 2018 11:17 am
by Frédéric GRANAT
Hi,

There's no lack of space on disks of that server (checked by log in on that server)

Without using "G"
1) Not all the drives report negative space
2) All the drives have sufficient space so all alerts are wrong.

With using "G" : no alert which is correct

Conclusion : using a check without "G" doesn't work

Re: Service OK whereas not OK

Posted: Thu Feb 15, 2018 3:34 pm
by kyang
means I want to have :
a warning when there is 20 Gb of free space left
a critical when there is 10 Gb of free space left
Based on this, you would want -w _FreeGB=20: -c _FreeGB=10: In this case, the : symbol means less than.
http://nagios-plugins.org/doc/guideline ... HOLDFORMAT

Going back to the help documentation examples.

Code: Select all

EXAMPLES WITH MULITPLE SPECIFICATIONS
for MODE=checkdrivesize:
-w _UsedGB=10 -w 15 -w _Free%=5: -c _UsedGB=20 -c _Used%=25 
This will generate a warning if
    - the Used GB on the drive is more than 10 or
    - the used % of the drive is more than 15% or
    - the free % of the drive is less than 5%
Here are my examples.

Code: Select all

[root@localhost libexec]# ./check_wmi_plus.pl -H xxx -u xxx/xxx -p xxxx -m checkdrivesize -a 'A|C' -w _FreeGB=250: -c _FreeGB=210:
OK - A: Total=465.75GB, Used=0.10GB (0.0%), Free=465.65GB (100.0%)     WARNING - [Triggered by _FreeGB<250] - C: Total=451.93GB, Used=227.31GB (50.3%), Free=224.62GB (49.7%)     |'A: Space'=0.10GB; 'A: Utilisation'=0.0%; 'C: Space'=227.31GB; 'C: Utilisation'=50.3%;
My A: drive is still at 465GB free, but my C: drive is at 224GB free. Therefore my warning threshold of less than 250GB is correct and valid. -w _FreeGB=250:

Therefore, -w _FreeGB=20: -c _FreeGB=10: is what you want. As these thresholds will be for 20/10GB of free space left.

Code: Select all

[root@localhost libexec]# ./check_wmi_plus.pl -H xxx -u xxx/xxx -p xxx -m checkdrivesize -a 'A|C' -w _FreeGB=20: -c _FreeGB=10:
OK - A: Total=465.75GB, Used=0.10GB (0.0%), Free=465.65GB (100.0%)     OK - C: Total=451.93GB, Used=227.44GB (50.3%), Free=224.49GB (49.7%)     |'A: Space'=0.10GB; 'A: Utilisation'=0.0%; 'C: Space'=227.44GB; 'C: Utilisation'=50.3%;
I hope this helps! Try it out and let us know.

Re: Service OK whereas not OK

Posted: Wed Feb 21, 2018 4:13 am
by Frédéric GRANAT
Hi,
Thanks, it works like that.
You can close the post.

Rgds,

Frederic

Re: Service OK whereas not OK

Posted: Wed Feb 21, 2018 10:24 am
by kyang
Sounds great! I'll be closing this thread!

If you have any more questions, feel free to create another thread.

Thanks for using the Nagios Support Forum!