Page 2 of 2

Re: Event Handlers Do Not Execute

Posted: Tue Oct 18, 2016 2:38 am
by dave@vooservers
tgriep wrote:Try increasing max_check_attempts for those services to 3 and see if that works for you.
Hi :)

Code: Select all

[root@status ~]# tail -f /usr/local/nagios/var/nagios.log | grep Dave-Test
[1476776011] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;Dave-Test-Server;AH-HTTPD-SERVICE;1476775946
[1476776017] SERVICE ALERT: Dave-Test-Server;AH-HTTPD-SERVICE;CRITICAL;SOFT;1;httpd is stopped
[1476776023] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;Dave-Test-Server;AH-HTTPD-SERVICE;1476775959
[1476776047] SERVICE ALERT: Dave-Test-Server;AH-HTTPD-SERVICE;CRITICAL;SOFT;2;httpd is stopped
[1476776053] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;Dave-Test-Server;AH-HTTPD-SERVICE;1476775989
[1476776077] SERVICE ALERT: Dave-Test-Server;AH-HTTPD-SERVICE;CRITICAL;HARD;3;httpd is stopped
[1476776077] SERVICE NOTIFICATION: ServerLogs;Dave-Test-Server;AH-HTTPD-SERVICE;CRITICAL;notify-service-by-email;httpd is stopped
No dice I'm afraid..

One thing I did notice, even though in every config file, event handlers are enabled, det to 1, true, whatever you want to term it. They are ON. But in the Nagios Core GUI, it states Event Handlers Enabled? No. (see attached screen cap). This is the first time I've noticed it say that. I'm going to assume this is related. Is there a reason why its not adopting the...

Code: Select all

# EVENT HANDLER USE OPTION
# This determines whether or not Nagios will run any host or
# service event handlers when it is initially (re)started.  Unless
# you're implementing redundant hosts, leave this option enabled.
# Values: 1 = enable event handlers, 0 = disable event handlers

enable_event_handlers=1
... from within nagios.cfg?

Re: Event Handlers Do Not Execute

Posted: Tue Oct 18, 2016 11:50 am
by rkennedy
It looks like they are enabled in the nagios.cfg, however I'm interested to see what you are referring to with this -
They are ON. But in the Nagios Core GUI, it states Event Handlers Enabled? No. (see attached screen cap).
Could you post the screenshot for us to look at?

Re: Event Handlers Do Not Execute

Posted: Tue Oct 18, 2016 12:22 pm
by tgriep
The Event Handler showing off in the GUI could be the issue.
Can you login to the GUI and enable the Event Handlers and see if that makes them start to work?

When you configure settings in the GUI, they get stored in a file called retention.dat file.
When the Nagios daemon is restarted, it reads that file and overrides the settings in the nagios.cfg file.
Here is a link with more details in the retention.dat file.
https://support.nagios.com/kb/article.php?id=522

So if you enable it in the GUI, that should fix it for you.

Re: Event Handlers Do Not Execute

Posted: Mon Nov 14, 2016 10:06 am
by dave@vooservers
tgriep wrote:The Event Handler showing off in the GUI could be the issue.
Can you login to the GUI and enable the Event Handlers and see if that makes them start to work?

When you configure settings in the GUI, they get stored in a file called retention.dat file.
When the Nagios daemon is restarted, it reads that file and overrides the settings in the nagios.cfg file.
Here is a link with more details in the retention.dat file.
https://support.nagios.com/kb/article.php?id=522

So if you enable it in the GUI, that should fix it for you.
Hi tgriep,

Aaah that makes a lot of sense... I cant believe I didnt try turning them on in the GUI before now (to be honest I thought they were on because ti said so in the config files.. lol)

[root@status ~]# grep event_handlers /usr/local/nagios/var/retention.dat
enable_event_handlers=0

<turned on event handlers in GUI>

[root@status ~]# service nagios restart
Running configuration check...done.
Stopping nagios: .done.
Starting nagios:/etc/init.d/nagios: line 132: /bin/su: Permission denied
Logging to '/usr/local/nagios/addons/merlin/logs/neb.log'
[1479135607] 6: Merlin Module Loaded
[1479135607] 6: Coredumps in /tmp
[1479135607] 6: Merlin module initialized successfully
[1479135607] 6: Handled 0 events from/to ipc in 0.027s. in: 0, out: 0
[1479135607] 6: Handled 0 bytes from/to ipc in 0.027s. in: 0 bytes, out: 0 bytes
[1479135607] 6: Creating binary backlog for ipc. On-disk location: /opt/monitor/op5/merlin/binlogs/module.ipc.binlog
done.
[root@status ~]# grep event_handlers /usr/local/nagios/var/retention.dat
enable_event_handlers=1

So it's now set to 1 in retention.dat instead of 0, and it survives a further service restart. I'm tied up with other projects right now, so I'm unable to test an actual event handler (so i've turned them off again just to avoid any issues for my service team). But I'll get round to this at some point this week and will confirm in here if its now working again.

Sorry for the delay in my reply to this thread, I've been away for a bit, and the event handler project as a whole was put to one side.

Thanks again for your consistent help on this. Appreciated.

Re: Event Handlers Do Not Execute

Posted: Mon Nov 14, 2016 11:29 am
by tgriep
Your welcome. If you have any questions, let us know.