Page 1 of 1

where does event handler script echo log to

Posted: Thu May 19, 2016 4:14 am
by saiyen2002
following the nagios documentation, i have setup my first event handler.
I used the script that is on the doc page here https://assets.nagios.com/downloads/nag ... dlers.html,
to help me write my own.

One thing that I am trying to do is to log to a file from the script.
When Nagios event handler executes this script, where does the echo output go to? to a log file somewhere?

i also have lines in the script like the below to to write to my own log file

Code: Select all

#!/bin/sh

date=`date`
echo "$date *** running script" >>  /tmp/eventhandlers
When executing the script manually, it all works fine, but from when nagios executes the script, I do not get any logs in the /tmp/evenhandlers file.

I am running Naigos Core 3.5.1, on Ubuntu 14.04.2 LTS. I am thinking could the shell that I am using have anything to do with it?

Thanks

Re: where does event handler script echo log to

Posted: Thu May 19, 2016 9:36 am
by rkennedy
The script doesn't log to anywhere, except internally to Nagios.

Your script, is going to log to /tmp/eventhandlers - what exactly are you looking to accomplish?

Re: where does event handler script echo log to

Posted: Fri May 20, 2016 9:01 am
by saiyen2002
If I manually execute the event handler script from the command line, it does log to /tmp/eventhandler
if Nagios runs the event handler, script gets executed, but nothing gets logged to /tmp/eventhandler.
I am trying to log to /tmp/eventhandlers.

Also, if by default the logging doesn't go anywhere, is there any point in all the echo commands in the scripts?

Thanks

Re: where does event handler script echo log to

Posted: Fri May 20, 2016 10:35 am
by rkennedy
Do you have the script assigned as an event handler? What are the permissions of the file? ls -l /tmp/eventhandler

Re: where does event handler script echo log to

Posted: Mon May 23, 2016 4:37 am
by saiyen2002
ok, so it was permission with the file.

Thanks for your help rkennedy.

Re: where does event handler script echo log to

Posted: Mon May 23, 2016 9:55 am
by ischwartz
I will close this topic now, thank you.