Test check works in CCM, but fails once applied

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

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

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
TJ.AHC
Posts: 11
Joined: Mon Nov 30, 2015 2:16 pm

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

Post 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 :)
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post by hsmith »

You can have check_files exit with a code of 2 instead of however it is exiting now. Does that make sense?
Former Nagios Employee.
me.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked