where does event handler script echo log to

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
saiyen2002
Posts: 5
Joined: Thu May 19, 2016 3:49 am

where does event handler script echo log to

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: where does event handler script echo log to

Post 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?
Former Nagios Employee
saiyen2002
Posts: 5
Joined: Thu May 19, 2016 3:49 am

Re: where does event handler script echo log to

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: where does event handler script echo log to

Post by rkennedy »

Do you have the script assigned as an event handler? What are the permissions of the file? ls -l /tmp/eventhandler
Former Nagios Employee
saiyen2002
Posts: 5
Joined: Thu May 19, 2016 3:49 am

Re: where does event handler script echo log to

Post by saiyen2002 »

ok, so it was permission with the file.

Thanks for your help rkennedy.
ischwartz

Re: where does event handler script echo log to

Post by ischwartz »

I will close this topic now, thank you.
Locked