Re: Event Handler Script not working.
Posted: Wed Feb 06, 2019 9:12 am
Even with the file in a different directory I'm getting the same error.
So I've tried not using a script and instead putting the cmd into the Command.cfg as below. If I enter the command_line directly into the console it works fine.
However defining it to trigger as the event handler results in the below error.
Any Idea how to get this to work? Or if theres a better way to automatically acknowledge non critical hosts.
So I've tried not using a script and instead putting the cmd into the Command.cfg as below. If I enter the command_line directly into the console it works fine.
Code: Select all
define command{
command_name auto_acknowledge
command_line /bin/printf "[%lu] ACKNOWLEDGE_HOST_PROBLEM;TEST_PRINTER;2;1;1;Autobot;Non-critical host, outage acknowledged\n" > /usr/local/nagios/var/rw/nagios.cmd
}Code: Select all
[1549460469] Warning: Check of host 'TEST_PRINTER' timed out after 30.01 seconds
[1549460469] HOST EVENT HANDLER: TEST_PRINTER;DOWN;SOFT;2;auto_acknowledge
[1549460469] wproc: HOST EVENTHANDLER job 1986 from worker Core Worker 15484 is a non-check helper but exited with return code 1
[1549460469] wproc: early_timeout=0; exited_ok=1; wait_status=256; error_code=0;
[1549460469] wproc: stderr line 01: /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
[1549460469] wproc: stderr line 02: /bin/sh: -c: line 1: syntax error: unexpected end of file