Eventhandler in Distrubuted Nagios (Mod_Gearman)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
huaming
Posts: 26
Joined: Thu Jan 16, 2020 3:49 am

Eventhandler in Distrubuted Nagios (Mod_Gearman)

Post by huaming »

Hi All,

I met a problem on distributed Nagios, deployed by mod_gearman (version:3). I built a eventhandler for a certain service (check windows service), if this windows service stopped, this eventhandler will start it. HOwever, this eventhandler only work at Nagios Master ( with Mod_gearman module installed), not work on those workers. I am wondering I can seek some support/suggestions.

THanks.

Below is my configuration on /etc/mod_gearman/module.cfg at Nagios Master

#Mod-Gearman NEB Module Config
eventhandler=no
notifications=no
services=yes
hosts=yes
hostgroups=XXX_Host_Group,YYY_Host_Group,ZZZ_Host_Group
servicegroups=XXX_Service_Group,YYY_Service_Group,ZZZ_Service_Group

do_hostchecks=yes
route_eventhandler_like_checks=yes
encryption=yes
mum length is 32 characters.
key=******
use_uniq_jobs=on

This is configuration on /etc/mod_gearman/worker.cfg at Nagios slave

#Mod-Gearman NEB Module Config
eventhandler=yes
notifications=no
services=no
hosts=no
hostgroups=XXX_Host_Group
servicegroups=XXX_Service_Group
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Post by cdienger »

Change this in the /etc/mod_gearman/module.cfg:

Code: Select all

eventhandler=no
to:

Code: Select all

eventhandler=yes
A copy of the handler should exist on the mod gearman workers - it usually needs to be under /usr/local/nagios/libexec or wherever the plugins are stored. Restart the modgearman service after making the change and verifying a copy of the event handler is on the gearman worker.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
huaming
Posts: 26
Joined: Thu Jan 16, 2020 3:49 am

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Post by huaming »

Hi, Thanks for your reply.

I've tried

1. change the eventhandler = yes at Nagios master, and stop nagios--> restart mod gearman --> start nagios. and perform the nagios and work.service restart at Nagios Slave
2. stop the test service at test PC, but no luck.

at Nagios Master, /usr/local/nagios/var/nagios.log. it shows SERVICE ALERT: XXXX;Check_Service;CRITICAL;HARD;3;CRITICAL: spooler=stopped (auto), delayed (). There is nothing shown at Nagios Slave. I checked, that script in the correct path at Nagios Slave. I ran this script manually, it can restart the target service. So would you please provide some inputs about this. THanks very much.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Post by ssax »

To get gearman to handle events you would also need to edit your /usr/local/nagios/etc/nagios.cfg and remove the eventhandler=no option from the mod_gearman broker line and restart the nagios service:

Code: Select all

broker_module=/usr/lib64/mod_gearman/mod_gearman_nagios4.o config=/etc/mod_gearman/module.conf eventhandler=no
If you do that you would need to make sure all the event handler plugins exist on the workers as well.

Make sure you do this on a test system first to make sure it doesn't impact your monitoring/notifications.
huaming
Posts: 26
Joined: Thu Jan 16, 2020 3:49 am

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Post by huaming »

Hi, Thanks very much, I've followed your proposal and got the successful result. Thanks Both again. These inputs are very helpful
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Post by vtrac »

Great!! .... ticket locked!!
Locked