Page 1 of 1

Formatting the results of a check

Posted: Tue Jan 11, 2022 5:23 pm
by dxb74
We have a check that looks at drive space on a server. The command we are currently using is: check_nrpe -H 127.0.0.1 -c check_drivesize "detail-syntax=%{drive_or_name}: ${used}/${size} used" exclude=S:\ exclude=A:\ "filter=type not in ('cdrom', 'removable') and mounted=1" "crit=free<100M" "warn=free<500M"

When running this command we get output like so: OK All 2 drive(s) are ok|'D:\ free'=197.2831GB;0.48827;0.09765;0;249.99804 'D:\ free %'=79%;0;0;0;100 'C:\ free'=13.87358GB;0.48827;0.09765;0;59.65527 'C:\ free
%'=23%;1;0;0;100


For this server, the D: drive has a size of 250 GB, 197 GB of which are free. So when the result shows 'D:\ free'=197.2831GB;0.48827;0.09765;0;249.99804' what do all of those numbers represent? Obviously, the first number is GB free and the last is GB Total size. What are the ones in between and how can I get rid of them? Ideally, we'd like the status to read something like: "197 GB free out of 250 GB Total", or something to that effect - simple and informative.

Re: Formatting the results of a check

Posted: Wed Jan 12, 2022 5:08 pm
by gsmith
Hi

I believe that can be done in the configuration of the nsclient++ agent.

nsclient++ is not provided by Nagios, so you can take a look at their
documentation here: https://docs.nsclient.org/

Particularly:
https://docs.nsclient.org/checks/#advanced-options

For example, I have:

Code: Select all

./check_nrpe -H 192.168.23.96 -2 -c check_drivesize
CRITICAL D:\: 5.029GB/5.029GB used|'C:\ used'=10.28593GB;47.72499;53.69062;0;59.65624 'C:\ used %'=17%;80;90;0;100 'D:\ used'=5.02924GB;4.02339;4.52632;0;5.02924 'D:\ used %'=100%;80;90;0;100
The C:\ used'=10.28593GB;47.72499;53.69062;0;59.65624 corresponds to the 'C:\ used %'=17%;80;90;0;100 '
in that 10.28593GB is 17%
47.72499 is 80%
53.69062 is 90%
0 is 0%
59.65624 is 100%

Thanks

Re: Formatting the results of a check

Posted: Wed Jan 12, 2022 5:19 pm
by dxb74
Thanks for the info, I'll check those links out.

I'm afraid I still don't understand what some of those numbers represent though.

In your example:

The C:\ used'=10.28593GB;47.72499;53.69062;0;59.65624 corresponds to the 'C:\ used %'=17%;80;90;0;100 '
in that 10.28593GB is 17%
47.72499 is 80%
53.69062 is 90%
0 is 0%
59.65624 is 100%

I get that the check is telling you that your drive is 59.65624 GB total and you are using 17% of it, which equates to 10.28593 GB. But what are the other values telling you? That IF you used 80% of your total that would be 47.72499 GB? IF you used 90% of your total that would be 53.69062 GB? IF you used 0 % of your total that would be 0 GB? Because like that seems extremely useless info to me.

Re: Formatting the results of a check

Posted: Wed Jan 12, 2022 5:49 pm
by gsmith
Hi

You said:
But what are the other values telling you? That IF you used 80% of your total that would be 47.72499 GB? IF you used 90% of your total that would be 53.69062 GB? IF you used 0 % of your total that would be 0 GB? Because like that seems extremely useless info to me.
From what I can see in their documentation they automatically create those "default" (and I think it mentions sometimes "implicit") values
in order to be presenting various data points, the idea being that they are "suggestions" for potential warning and critical values.

I believe the https://docs.nsclient.org/checks/#advanced-options describes how you can format/turn off the various data
and units returned.

Thanks