Argument for check_files
-
- Posts: 96
- Joined: Fri Apr 08, 2016 3:17 am
Argument for check_files
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,
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
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
Former Nagios employee
-
- Posts: 96
- Joined: Fri Apr 08, 2016 3:17 am
Re: Argument for check_files
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) ?
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
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
What version of NSClient++ are you running? It looks like this was a previous issue. https://github.com/mickem/nscp/issues/74
Former Nagios Employee
-
- Posts: 96
- Joined: Fri Apr 08, 2016 3:17 am
Re: Argument for check_files
I currently use 0.4.4 but I can test with 0.5.0 tomorrow if necessary.
Re: Argument for check_files
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) -
The version of NSClient++ -
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
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
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...
Former Nagios Employee
-
- Posts: 96
- Joined: Fri Apr 08, 2016 3:17 am
Re: Argument for check_files
My version of NSCLIENT :
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).
Code: Select all
I (0.4.4.19 2015-12-08) seem to be doing fine...
Code: Select all
OK : All X files are OK.
Code: Select all
0
When I delete all the files, the output is :
Code: Select all
No files found
Code: Select all
0
Re: Argument for check_files
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.
As it's working fine on my end, it seems to be an issue with certain NSClient++ versions that comes / goes as it pleases.
Former Nagios Employee
-
- Posts: 96
- Joined: Fri Apr 08, 2016 3:17 am
Re: Argument for check_files
I've tried this morning with NSCLIENT 0.5.0 and that's the same problem
Re: Argument for check_files
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.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) -The version of NSClient++ -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
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=UNKNOWNCode: 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...
Former Nagios Employee