Page 1 of 2
mod_gearman integration
Posted: Wed Mar 14, 2018 4:46 pm
by bchabotdg
Hello,
I'm running Nagios XI on CentOS 7.
I have followed the instructions at
https://assets.nagios.com/downloads/nag ... ios_XI.pdf
I installed the server and a worker on the same system as the Nagios XI install. It seems to be working well so far.
I installed a remote worker and configured it to talk with the server. gearman_top2 shows the remote worker correctly.
I configured the remote worker to (I think) run the checks for a certain service group, viz:
servicegroups=my-service-group
Similarly with the hostgroups line.
I restart the workers and the server just to be safe. gearman_top2 shows all looks OK.
I then select certain services and hosts to be run by the remote worker and add them to the appropriate groups.
Apply changes in Nagios XI.
Tail log on remote worker and ............nothing. It isn't taking the services. The localhost worker is taking them on.
Did I miss something vital here? Is there something I can check to find out why these service groups aren't being handled by the remote worker?
(Spelling has been checked and is correct. I was goign to install ModGearman XI Manager but can't find a working module file to upload... not sure if that would even help...)
Thanks ahead for any info you might be able to provide.
Brian
Re: mod_gearman integration
Posted: Thu Mar 15, 2018 9:47 am
by scottwilkerson
did you add the config line to nagios.cfg and restart nagios?
Re: mod_gearman integration
Posted: Thu Mar 15, 2018 12:56 pm
by bchabotdg
Erm... What line? I'm not seeing any mention of that in the current install doc (linked above).
Re: mod_gearman integration
Posted: Thu Mar 15, 2018 3:59 pm
by scottwilkerson
bchabotdg wrote:Erm... What line? I'm not seeing any mention of that in the current install doc (linked above).
Sorry, I forgot the script if that doc does it for you.
So by adding this to the remote worker it would be able to only process items in
my-service-group
But depending on the configuration on the local machine and the workers, the local worker is it has the rights may be picling up the checks.
Here is a doc outlining group setups using mod_gearman
https://support.nagios.com/kb/article.php?id=484
Re: mod_gearman integration
Posted: Thu Mar 15, 2018 4:11 pm
by bchabotdg
So by adding this to the remote worker it would be able to only process items in my-service-group
Yes. That is what I want.
Machine 1 is Nagios XI, mod_gearman server, and a mod_gearman worker. This mod_gearman worker should handle all checks except my-service-group.
Machine 2 is the remote system running mod_gearman worker and should only handle service checks for my-service-group.
Machine 2 has the servicegroups=my-service-group line in the config file and the worker service has been restarted.
The remote worker on machine 2 shows correctly on gearman_top2
No service checks are being performed by machine 2 at all. It should be performing the ones in my-service-group
All service checks are being done by the gearman worker on machine 1.
Help?
Re: mod_gearman integration
Posted: Thu Mar 15, 2018 4:17 pm
by lmiltchev
What kind of checks are these? Do you have the plugin, used by these services installed on the machine 2?
Re: mod_gearman integration
Posted: Thu Mar 15, 2018 4:56 pm
by bchabotdg
They are a mix of standard and custom checks. I've copied the libexec directory over to the remote server and locally tested them. They should have no problem running. The mod_gearman server isn't even trying to send them out.
Re: mod_gearman integration
Posted: Fri Mar 16, 2018 11:14 am
by lmiltchev
Can you post the module.conf and worker.conf files from both machines (the server and the worker)? Please remove sensitive info, e.g. IPs, keys, etc.
Re: mod_gearman integration
Posted: Fri Mar 16, 2018 1:19 pm
by bchabotdg
Can you post the module.conf and worker.conf files from both machines (the server and the worker)? Please remove sensitive info, e.g. IPs, keys, etc.
Code: Select all
[bchabot@[REMOTE] ~]$ cat /etc/mod_gearman2/module.conf | grep -v "#"
debug=1
logfile=/var/log/mod_gearman2/mod_gearman_neb.log
server=10.[REDACTED]:4730
eventhandler=yes
services=yes
hosts=yes
hostgroups=[my-host-group]
servicegroups=[my-service-group]
do_hostchecks=yes
route_eventhandler_like_checks=no
encryption=yes
key=[REDACTED]
use_uniq_jobs=on
localhostgroups=
localservicegroups=
result_workers=1
perfdata=no
perfdata_mode=1
orphan_host_checks=yes
orphan_service_checks=yes
accept_clear_results=no
[bchabot[REMOTE] ~]$ cat /etc/mod_gearman2/worker.conf | grep -v "#"
debug=1
logfile=/var/log/mod_gearman2/mod_gearman_worker.log
server=10.[REDACTED]:4730
eventhandler=yes
services=yes
hosts=yes
hostgroups=[my-host-group]
servicegroups=[my-service-group]
encryption=yes
key=[REDACTED]
job_timeout=60
min-worker=5
max-worker=50
idle-timeout=30
max-jobs=1000
spawn-rate=1
fork_on_exec=no
load_limit1=0
load_limit5=0
load_limit15=0
show_error_output=yes
enable_embedded_perl=on
use_embedded_perl_implicitly=off
use_perl_cache=on
p1_file=/usr/share/mod_gearman2/mod_gearman_p1.pl
workaround_rc_25=off
[bchabot@[REMOTE] ~]$
Code: Select all
[bchabot@[SERVER] ~]$ cat /etc/mod_gearman2/module.conf | grep -v "#"
debug=1
logfile=/var/log/mod_gearman2/mod_gearman_neb.log
server=localhost:4730
eventhandler=yes
services=yes
hosts=yes
do_hostchecks=yes
route_eventhandler_like_checks=no
encryption=yes
key=[REDACTED]
use_uniq_jobs=on
localhostgroups=
localservicegroups=
result_workers=1
perfdata=no
perfdata_mode=1
orphan_host_checks=yes
orphan_service_checks=yes
accept_clear_results=no
[bchabot@[SERVER] ~]$ cat /etc/mod_gearman2/worker.conf | grep -v "#"
debug=1
logfile=/var/log/mod_gearman2/mod_gearman_worker.log
server=localhost:4730
eventhandler=yes
services=yes
hosts=yes
encryption=yes
key=[REDACTED]
job_timeout=60
min-worker=5
max-worker=50
idle-timeout=30
max-jobs=1000
spawn-rate=1
fork_on_exec=no
load_limit1=0
load_limit5=0
load_limit15=0
show_error_output=yes
enable_embedded_perl=on
use_embedded_perl_implicitly=off
use_perl_cache=on
p1_file=/usr/share/mod_gearman2/mod_gearman_p1.pl
workaround_rc_25=off
[bchabot@[SERVER] ~]$
Re: mod_gearman integration
Posted: Fri Mar 16, 2018 2:02 pm
by lmiltchev
When you have:
in the module.conf and worker.conf on the server, mod_gearman will run all host/service checks locally. You will need to change this to:
In the module.conf, you need to specify all of your hostgroups/servicegroups, for example:
Code: Select all
services=no
hosts=no
hostgroups=[my-host-group1],[my-host-group2]
servicegroups=[my-service-group1],[my-service-group2]
On the local worker, you could have:
Code: Select all
services=no
hosts=no
hostgroups=[my-host-group1]
servicegroups=[my-service-group1]
On the remote worker, you could have:
Code: Select all
services=no
hosts=no
hostgroups=[my-host-group2]
servicegroups=[my-service-group2]
Basically, you are saying: "Don't run all of the host/service checks locally. Run group 1 checks locally, but group 2 checks - remotely".
Don't forget to restart the serivces after making the changes.
Let us know if this helped.