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
mod_gearman help please
Re: mod_gearman help please
On the worker node, say "no" to hosts= and services=
Those are defaults and you don't want your node working those.
Those are defaults and you don't want your node working those.
Re: mod_gearman help please
@delboy1966, let us know if @mleo40's suggestion worked for you. Thanks!
Former Nagios Employee.
me.
me.
Re: mod_gearman help please
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:
In /etc/mod-gearman/worker.conf (on remote worker):
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
Code: Select all
server=nagios.box.ip.address:4730
hostgroups=SOME_HOSTGROUP
encryption=yes
key=yourkey
-
- Posts: 96
- Joined: Thu Oct 22, 2015 5:26 am
Re: mod_gearman help please
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
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
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: mod_gearman help please
Is it OK to lock this thread?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 96
- Joined: Thu Oct 22, 2015 5:26 am
Re: mod_gearman help please
Yes please do.
Tony
Tony
Re: mod_gearman help please
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.
Be sure to check out the Knowledgebase for helpful articles and solutions!