Page 1 of 1

check_nrpe & NSClient++ - Alert threshold help

Posted: Tue Jun 21, 2016 3:51 am
by TheTomCAT
Hi all,

First of all here are the details of the Nagios servers and the host that I am trying to monitor;

CentOS 7 Minimal running NagiosĀ® Core - Version 4.0.8
Host - Windows Server 2012 R2 Standard running NSClient++ 0.4.4.19

I recently inherited this system and have been monitoring the disk usage on this host using the following command with the default warning and critical threshold values "$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_drivesize -a drive=d"

I want to adjust the thresholds for warning and critical as the client is aware that the disk is full and is happy for it to be at 94%. They want alerting when it reaches 98% but I don't seem to be able to achieve this with the command arguments. I have followed the NRPE Syntax guide and it doesn't seem to work, I have also used the help info within the command with no success. Here are some examples of what I have tried;

$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_drivesize -a drive=d "warning=used > 80%" "critical=used > 90%"
$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_drivesize -a drive=d crit=used > 90%
$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_drivesize -a drive=d "warning=used > 80%" "critical=used > 90%" "empty-state=unknown"

I have tried all the combinations that I can think of based on the syntax guides and --help output from the command. Even trying them on a word for word basis from the examples given and non of them seem to work.

Hopefully this is something simple and I am missing something really obvious but either way it is currently driving me insane.

Any help would be much appreciated.

Re: check_nrpe & NSClient++ - Alert threshold help

Posted: Tue Jun 21, 2016 9:52 am
by rkennedy
I believe you just need single quotes, take a look at this as an example (the echo $? tells us what exit code the plugin reported, where 0=ok, 1=warning, 2=critical) -

Code: Select all

[nagios@localhost libexec]$ ./check_nrpe -H 192.168.5.47 -c check_drivesize -a drive=x crit='used > 90%'
OK All 1 drive(s) are ok|'x used'=217.35405GB;360.89218;406.0037;0;451.11523 'x used %'=48%;79;89;0;100
[nagios@localhost libexec]$ echo $?
0

[nagios@localhost libexec]$ ./check_nrpe -H 192.168.5.47 -c check_drivesize -a drive=x crit='used > 40%'
CRITICAL x: 217.354GB/451.115GB used|'x used'=217.35405GB;360.89218;180.44609;0;451.11523 'x used %'=48%;79;39;0;100
[nagios@localhost libexec]$ echo $?
2

Re: check_nrpe & NSClient++ - Alert threshold help

Posted: Tue Jun 21, 2016 10:02 am
by TheTomCAT
That is what I initially though but when I run that I get the below:

[Using default values]
[root@qsnag01 libexec]# ./check_nrpe -H 10.10.1.29 -c check_drivesize -a drive=d
CRITICAL d: 4.764TB/5TB used|'d used'=4.76412TB;3.9999;4.49988;0;4.99987 'd used %'=95%;79;89;0;100

[root@qsnag01 libexec]# ./check_nrpe -H 10.10.1.29 -c check_drivesize -a drive=d show-default
"warning=used > 80%" "critical=used > 90%" "empty-state=unknown" "top-syntax=${status} ${problem_list}" "ok-syntax=%(status) All %(count) drive(s) are ok" "empty-syntax=%(status): No drives found" "detail-syntax=${drive_or_name}: ${used}/${size} used" "perf-syntax=${drive_or_id}"


[Then with the critical argument added]

[root@qsnag01 libexec]# ./check_nrpe -H 10.10.1.29 -c check_drivesize -a drive=d crit='used > 90%'
Exception processing request: Request command contained illegal metachars!

Re: check_nrpe & NSClient++ - Alert threshold help

Posted: Tue Jun 21, 2016 11:24 am
by rkennedy
In your NSClient++ configuration, you'll need to add / modify the following part (make sure it's under [/settings/NRPE/server], if you do not have that section, then add it) -

Code: Select all

[/settings/NRPE/server]
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = 1
After doing so, it should begin to work once again.

Re: check_nrpe & NSClient++ - Alert threshold help

Posted: Wed Jun 22, 2016 2:50 am
by TheTomCAT
That's sorted it! I knew it would be something simple that I was missing. Many thanks for the help.
rkennedy wrote:In your NSClient++ configuration, you'll need to add / modify the following part (make sure it's under [/settings/NRPE/server], if you do not have that section, then add it) -

Code: Select all

[/settings/NRPE/server]
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = 1
After doing so, it should begin to work once again.

Re: check_nrpe & NSClient++ - Alert threshold help

Posted: Wed Jun 22, 2016 9:52 am
by rkennedy
No problem! Glad to see it working.

Locking this one up, but feel free to make a new thread if you have any questions in the future.