Page 1 of 1

Eventhandler in Distrubuted Nagios (Mod_Gearman)

Posted: Mon Mar 08, 2021 9:45 am
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

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Posted: Tue Mar 09, 2021 4:06 pm
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.

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Posted: Mon Mar 15, 2021 4:39 am
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.

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Posted: Mon Mar 15, 2021 4:39 pm
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.

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Posted: Mon Mar 15, 2021 8:03 pm
by huaming
Hi, Thanks very much, I've followed your proposal and got the successful result. Thanks Both again. These inputs are very helpful

Re: Eventhandler in Distrubuted Nagios (Mod_Gearman)

Posted: Tue Mar 16, 2021 4:14 pm
by vtrac
Great!! .... ticket locked!!