Page 2 of 2

Re: Test check works in CCM, but fails once applied

Posted: Wed Dec 16, 2015 6:21 pm
by TJ.AHC
At this point, the command is stopping before it leaves nagios. the log on the desktop is empty (after deleted old data). no new logs with the current command config is being created.

Re: Test check works in CCM, but fails once applied

Posted: Wed Dec 16, 2015 6:36 pm
by Box293
OK so this will work:

Command:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c Check_Files -a path="$ARG1$" "ok=count>= 1" "warn=written< -$ARG2$" "crit=written< -$ARG3$ or count= 0" 'perf-syntax=%{file} Last Written: %(written_l)'
Service:

Code: Select all

$ARG1$ = C:\\temp\\test.txt
$ARG2$ = 1h
$ARG3$ = 1d
Make note that I put the full file location in $ARG1$ and removed the filter.

Because you are only targeting a specific file, it is better to do it this way. It has to do with how the client parses all files in this directory multiple times. The more files in the directory the longer it takes to run.

Otherwise you would do something like:

Command:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c Check_Files -a path="$ARG1$" file="$ARG2$" "ok=count>= 1" "warn=written< -$ARG2$" "crit=written< -$ARG3$ or count= 0" 'perf-syntax=%{file} Last Written: %(written_l)'
Service:

Code: Select all

$ARG1$ = C:\\temp\\
$ARG2$ = test.txt
$ARG3$ = 1h
$ARG4$ = 1d
Also take note of the syntax I changed:

'perf-syntax=%{file} Last Written: %(written_l)'

Bash tries to do something different when it sees ${ so this is why the developer also allows %{

Let us know how this goes.

Re: Test check works in CCM, but fails once applied

Posted: Thu Dec 17, 2015 10:01 am
by TJ.AHC
Thank you very much for helping me! that did resolve the issue. the only question now is when the files doesn't exist, i want it to report a critical. right now it reports unknown. any help on that would be great :)

Re: Test check works in CCM, but fails once applied

Posted: Thu Dec 17, 2015 2:41 pm
by hsmith
You can have check_files exit with a code of 2 instead of however it is exiting now. Does that make sense?

Re: Test check works in CCM, but fails once applied

Posted: Mon Dec 21, 2015 11:55 am
by Box293
TJ.AHC wrote:Thank you very much for helping me! that did resolve the issue. the only question now is when the files doesn't exist, i want it to report a critical. right now it reports unknown. any help on that would be great :)
I think all you need to do is define the "empy-state", add this to the check command:

Code: Select all

'empty-state=critical'