mod_gearman help please

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
delboy1966
Posts: 96
Joined: Thu Oct 22, 2015 5:26 am

mod_gearman help please

Post 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
mleo40
Posts: 37
Joined: Tue Jan 27, 2015 10:21 pm

Re: mod_gearman help please

Post by mleo40 »

On the worker node, say "no" to hosts= and services=

Those are defaults and you don't want your node working those.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: mod_gearman help please

Post by hsmith »

@delboy1966, let us know if @mleo40's suggestion worked for you. Thanks!
Former Nagios Employee.
me.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: mod_gearman help please

Post 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
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
delboy1966
Posts: 96
Joined: Thu Oct 22, 2015 5:26 am

Re: mod_gearman help please

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: mod_gearman help please

Post by Box293 »

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.
delboy1966
Posts: 96
Joined: Thu Oct 22, 2015 5:26 am

Re: mod_gearman help please

Post by delboy1966 »

Yes please do.

Tony
bwallace
Posts: 1146
Joined: Tue Nov 17, 2015 1:57 pm

Re: mod_gearman help please

Post 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.
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked