Page 1 of 1
Adding entries to Nagios Event Log
Posted: Tue Jul 05, 2016 6:56 pm
by Fred Kroeger
How do you add an entry to the Nagios Event Log?
I have an Event Handler script that creates tickets in Service Now and would like to record the details in the Event Log.
thanks.... Fred
Re: Adding entries to Nagios Event Log
Posted: Tue Jul 05, 2016 7:03 pm
by Box293
I think adding a service comment would be the easiest way.
http://sites.box293.com/nagios/guides/t ... e-and-cgis
Look at the "Adding Comments Locally From Nagios Host" examples.
Otherwise you could just
echo "xxxx" >> /usr/local/nagios/var/nagios.log but that doesn't feel nice.
Re: Adding entries to Nagios Event Log
Posted: Sun Jul 10, 2016 8:11 pm
by Fred Kroeger
Thanks Troy - I really wanted the message to appear in the Nagios Event Log as an "Information" entry. That way I can see the progress of a event from Soft to Hard, who was notified and when the event handler was triggered. This is the info needed for investigations/post-mortems.
Not sure where the details for the Event Log are stored - they look completely different to what is stored in /usr/local/nagios/var/nagios.log
Regards... Fred
Re: Adding entries to Nagios Event Log
Posted: Mon Jul 11, 2016 2:03 am
by Box293
As far as I understand, what appears in the Nagios XI Event Log is being pulled from a database.
When a command is submitted to the nagios command pipe it enters nagios and then the NDO2DB module stores it in the database (as well as being written to nagios.log). Hence simply echoing something into the nagios.log means it's not going to be detected by NDO2DB.
This page shows you all the external commands that can be submitted, hence I can't find a general "information" type of command.
I'll get the USA techs to follow up.
Re: Adding entries to Nagios Event Log
Posted: Mon Jul 11, 2016 12:58 pm
by tmcdonald
From one of our devs:
I would advise against editing the event log, since it's a copy of the nagios.log - plus there are set commands that add things to the log and it won't just show up properly elsewhere just by adding it into the DB... troy's suggestion for adding a comment is probably the best way to do it.
I tend to agree, adding a comment is the way to go. I can add in a feature request for the sort of functionality you are looking for, but I cannot guarantee it would make it in.
Re: Adding entries to Nagios Event Log
Posted: Tue Jul 12, 2016 1:13 am
by Fred Kroeger
Thanks All - Since Global Host/Service Event Handler entries are in the Event Log, I would have expected (hoped) that the normal Host/Service Event handlers would also appear in the Event Log or we would have some mechanism to add this info to the event log so that we can display it in a Nagios screen when they get triggered . Not really wanting to give people server logins so they can trawl through a log file.
Fred
Re: Adding entries to Nagios Event Log
Posted: Tue Jul 12, 2016 1:21 pm
by ssax
One thing to note is that you can set log_event_handlers=1 in your /usr/local/nagios/etc/nagios.cfg file if you just want to see if the event handler is being fired.
Re: Adding entries to Nagios Event Log
Posted: Fri Jul 15, 2016 5:39 am
by Fred Kroeger
Brilliant - this is good enough for what I need
Thanks.... Fred
Re: Adding entries to Nagios Event Log
Posted: Fri Jul 15, 2016 9:14 am
by ssax
Great, are we okay to mark this as resolved and lock the topic?
Re: Adding entries to Nagios Event Log
Posted: Thu Jul 28, 2016 11:34 pm
by Fred Kroeger
yes - please close