Page 1 of 2
Argument for check_files
Posted: Wed Apr 13, 2016 4:17 am
by cocoyanouck
Sorry to open a new topic, but i've any questions about this topic :
https://support.nagios.com/forum/viewto ... 2&start=10
I've this command which is now OK :
define service{
use generic-service
host_name NAME OF MY SERVER
notification_interval 20
service_description Number of files on Request
check_command check_nrpe!check_files!path='c:\\GESTION\\REQUEST' pattern=*.* 'warning=count>5' 'critical=count>10' top-syntax='${status}: ${problem_count}/${count} files' 'empty-state=ok'
}
But when I've no files in this directory, I've a notification "no files found" state : unknown.
I think i may write an argument, but don't find it.
Thanks,
Re: Argument for check_files
Posted: Wed Apr 13, 2016 11:18 am
by tmcdonald
What are you looking to accomplish? That appears to be the correct output. The
empty-state parameter says "Return status to use when nothing matched filter." according to the documentation:
http://docs.nsclient.org/reference/wind ... mpty-state
Re: Argument for check_files
Posted: Wed Apr 13, 2016 11:41 am
by cocoyanouck
Hum, when I have one, two, three or four files in this directory, I've no notification (it's correct), and the status on the web interface (or in the output of the nagios-debian) "all 1/2/3/4 files are OK".
When I have more than 4 files, I've a warning or critical notifications => it's also true.
But when I've no files in this directory, i don't what to receive a notification. And actually, I've the status UNKNOWN (that's not good) and the output"no files found (that's correct).
So I wonder if my command is correct, or if an argument is missing or another is incorrect (i.e empty-state) ?
Re: Argument for check_files
Posted: Wed Apr 13, 2016 11:55 am
by rkennedy
I believe your syntax looks good.
What version of NSClient++ are you running? It looks like this was a previous issue.
https://github.com/mickem/nscp/issues/74
Re: Argument for check_files
Posted: Wed Apr 13, 2016 3:36 pm
by cocoyanouck
I currently use 0.4.4 but I can test with 0.5.0 tomorrow if necessary.
Re: Argument for check_files
Posted: Wed Apr 13, 2016 4:33 pm
by rkennedy
Can you expand on what version of 0.4.4 you're running? It seems to be exiting properly over here. (in my example, C:\blah2\fds is completely non-existent) -
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c check_files -a "path=C:\blah2\fds" "empty-state=CRITICAL"
No files found
[root@localhost libexec]# echo $?
2
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c check_files -a "path=C:\blah2\fds" "empty-state=WARNING"
No files found
[root@localhost libexec]# echo $?
1
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c check_files -a "path=C:\blah2\fds" "empty-state=OK"
No files found
[root@localhost libexec]# echo $?
0
The version of NSClient++ -
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47
I (0.4.4.15 2015-11-25) seem to be doing fine...
Could you attempt something similar over the command line?
echo $? will just show the code that the plugin exited with, so this will help debug. For reference - 0=OK,1=WARNING,2=CRITICAL,3=UNKNOWN
Re: Argument for check_files
Posted: Thu Apr 14, 2016 2:51 am
by cocoyanouck
My version of NSCLIENT :
Code: Select all
I (0.4.4.19 2015-12-08) seem to be doing fine...
When I test with somes files in the directory, the output is (whatever the value of "empty-sate") :
And echo$? :
When I delete all the files, the output is :
And echo$? :
I understand that the output is correct (no files found), and the echo too (status OK). But the status on the web interface is different (unknown, in orange/yellow color).
Re: Argument for check_files
Posted: Thu Apr 14, 2016 9:54 am
by rkennedy
I understand that, the reason it's displaying as UNKNOWN is because it's exiting with a 3. I'd advise trying to either upgrade NSClient++, or downgrade to the version I'm using.
As it's working fine on my end, it seems to be an issue with certain NSClient++ versions that comes / goes as it pleases.
Re: Argument for check_files
Posted: Thu Apr 14, 2016 1:20 pm
by cocoyanouck
I've tried this morning with NSCLIENT 0.5.0 and that's the same problem

Re: Argument for check_files
Posted: Thu Apr 14, 2016 1:55 pm
by rkennedy
rkennedy wrote:Can you expand on what version of 0.4.4 you're running? It seems to be exiting properly over here. (in my example, C:\blah2\fds is completely non-existent) -
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c check_files -a "path=C:\blah2\fds" "empty-state=CRITICAL"
No files found
[root@localhost libexec]# echo $?
2
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c check_files -a "path=C:\blah2\fds" "empty-state=WARNING"
No files found
[root@localhost libexec]# echo $?
1
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47 -c check_files -a "path=C:\blah2\fds" "empty-state=OK"
No files found
[root@localhost libexec]# echo $?
0
The version of NSClient++ -
Code: Select all
[root@localhost libexec]# ./check_nrpe -H 192.168.5.47
I (0.4.4.15 2015-11-25) seem to be doing fine...
Could you attempt something similar over the command line?
echo $? will just show the code that the plugin exited with, so this will help debug. For reference - 0=OK,1=WARNING,2=CRITICAL,3=UNKNOWN
Can you please do something similar to this testing, and post the full result for us to look at? It could be s small formatting issue, the single quotes vs the double quotes.