Page 1 of 1

mod_gearman help please

Posted: Wed Nov 25, 2015 4:35 am
by delboy1966
I now have mod_gearman working with 2 worker nodes in a distributed environment.
However I now need to restrict one of the worker nodes to only do checks for certain hosts, this is because the main Nagios server cannot see these hosts over the VLANs its connected to.
The worker node can see these hosts and also the main Nagios server.

From what I read regarding how to do this I did the following:

In the main Nagios servers mod_gearman_neb.conf file I put:

queue_custom_variable=WORKER

In the host definition in Nagios I put:

_WORKER hostgroup_test

And in the worker nodes mod_gearman_worker.conf file I put:

hostgroups=test

So that worker node should only be doing checks for the host that has the _WORKER variable against it.
I restarted the worker node process on the worker node and gearmand on the main Nagios server.
The worker node is doing checks for the specified host but is also doing host and service checks for other hosts that do not have that custom variable.
Am I missing something?

My config files are as follows:

My mod_gearman_neb.conf file on the main Nagios server:

debug=3
logfile=/var/log/mod_gearman/mod_gearman_neb.log
server=localhost:4730
eventhandler=yes
services=yes
hosts=yes
hostgroups=Non_Distributed
servicegroups=INTERFACE_CHECKS
do_hostchecks=yes
encryption=no
key=<secret>
use_uniq_jobs=on
localhostgroups=Non_Distributed
localservicegroups=INTERFACE_CHECKS,WEBSITE_CHECKS
queue_custom_variable=WORKER
result_workers=1
perfdata=yes
perfdata_mode=1
orphan_host_checks=yes
orphan_service_checks=yes
accept_clear_results=no



mod_gearman_worker.conf on the remote host:

debug=3
logfile=/var/log/mod_gearman/mod_gearman_worker.log
server=10.51.1.35:4730
eventhandler=yes
services=yes
hosts=yes
hostgroups=test
do_hostchecks=yes
encryption=no
key=<secret>
job_timeout=60
min-worker=5
max-worker=50
idle-timeout=30
max-jobs=1000
spawn-rate=1
fork_on_exec=no
show_error_output=yes
enable_embedded_perl=on
use_embedded_perl_implicitly=off
use_perl_cache=on
p1_file=/usr/share/mod_gearman/mod_gearman_p1.pl
workaround_rc_25=off

Re: mod_gearman help please

Posted: Wed Nov 25, 2015 12:34 pm
by mleo40
On the worker node, say "no" to hosts= and services=

Those are defaults and you don't want your node working those.

Re: mod_gearman help please

Posted: Wed Nov 25, 2015 2:22 pm
by hsmith
@delboy1966, let us know if @mleo40's suggestion worked for you. Thanks!

Re: mod_gearman help please

Posted: Wed Nov 25, 2015 2:33 pm
by jolson
I don't believe any of this is necessary:
queue_custom_variable=WORKER_
WORKER hostgroup_test
queue_custom_variable=WORKER


All that should be necessary:
Port 4730 tcp+udp open between Nagios and the worker
Server Config:

Code: Select all

server=localhost:4730
eventhandler=yes
services=yes
hosts=yes
encryption=yes
key=yourkey
In /etc/mod-gearman/worker.conf (on remote worker):

Code: Select all

server=nagios.box.ip.address:4730
hostgroups=SOME_HOSTGROUP
encryption=yes
key=yourkey

Re: mod_gearman help please

Posted: Thu Nov 26, 2015 1:58 am
by delboy1966
Thanks @mleo40 that was what the problem was.
After marking those 2 options to no and doing a reload on the process it only performed checks on the specified hostgroup and servicegroup.

Thanks again.
Tony

Re: mod_gearman help please

Posted: Thu Nov 26, 2015 7:58 pm
by Box293
Is it OK to lock this thread?

Re: mod_gearman help please

Posted: Wed Dec 02, 2015 9:24 am
by delboy1966
Yes please do.

Tony

Re: mod_gearman help please

Posted: Wed Dec 02, 2015 11:58 am
by bwallace
Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.