Page 1 of 2

Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 10:54 am
by BanditBBS
Ugh, I thought I was done messing with my gearman setup, but alas, I am not.

Current working setup:
NagiosXI server with gearmand and mod_gearman_worker running.
Secondary server with worker running.
Checks being distributed between the 2 workers and everything working fine....YAY!

Changes to setup:
Added a new worker that will be checking specific systems behind a firewall. All firewall changes are complete and verified working to allow the gearman server to communicate with the worker behind the firewall.
I added a test system into XI and made it a member of the specific host_group that the new worker is configured to check. With this setup, the checks sometimes worked, sometimes did not. I had to create a new service_group and add all the services on that server to that group. I then configured the new worker to process those checks. The checks all went to the proper gearman worker now.

My question(s):
Shouldn't all services for a host go to the worker the host is configured to go to? Otherwise, whats the purpose of only checking a host on a specific worker but not its services?
My issue with this is I was not going to need service_groups and now I am going to be forced to use them and it will be huge with the number of services that will be member of the new one.

Thanks for any insight!

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 11:24 am
by slansing
I'll just add some input here, you need to add the hostgroup to the neb.conf file on the Nagios system, and the same hostgroup definition to the worker config file on your remote machine. By defining the hostgroups and not service groups it should greatly cut down on the amount of configuration you need to do. Does that make sense? I see that you said the checks sometimes did not work. Could you go into a little bit more detail on this? What did you see that makes you say this.

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 11:34 am
by BanditBBS
slansing wrote:I'll just add some input here, you need to add the hostgroup to the neb.conf file on the Nagios system, and the same hostgroup definition to the worker config file on your remote machine. By defining the hostgroups and not service groups it should greatly cut down on the amount of configuration you need to do. Does that make sense? I see that you said the checks sometimes did not work. Could you go into a little bit more detail on this? What did you see that makes you say this.
Yea, I modified the neb configuration on the server and the worker config on the worker. When I did that, the services were bouncing between critical and ok. My assumption at that point was the service checks were not going to the worker that is configured for the host all the time and sometimes going to the other workers. That explain it better?

So if the host is configured for a specific worker, the services on that host should go to the same worker? That is how I thought it worked, but I just wasn't seeing that in action when I tried it.

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 12:47 pm
by slansing
That is strange, it should work fine. We just duplicated this on our end and they seemed to be functioning fine. I will set up another round of tests and let it run for a while to see what I come up with.

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 12:51 pm
by BanditBBS
Thanks, I'm going to continue testing as well, it is very possible I did something stupid.

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 2:38 pm
by scottwilkerson
something to consider, after changing the neb config you need to restart nagios for the changes to take affect.

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 2:46 pm
by BanditBBS
scottwilkerson wrote:something to consider, after changing the neb config you need to restart nagios for the changes to take affect.
Well now, that is interesting, thought I just needed to restart gearmand. I'll do that when I get back to testing, other stuff has my attention at the moment.

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 2:54 pm
by scottwilkerson
Ya, that is a common misconception. There are actually 3 pieces to the puzzle...

gearmand - just job server
mod_gearman_neb - loaded via nagios broker and uses /etc/mod_gearman/mod_gearman_neb.conf

mod_gearman_worker - started via service mod_gearman_worker and uses /etc/mod_gearman/mod_gearman_worker.conf

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 3:06 pm
by BanditBBS
To make sure I have it all setup properly before restarting Nagios, lets make sure I have the other stuff configured properly.

mod_gearman_neb on the XI server has this in the file:

Code: Select all

eventhandler=no
services=yes
hosts=yes
hostgroups=ae_direct_wrn
#servicegroups=
The worker node I want to handle the hosts belonging to ae_direct_wrn has this in the mod_gearman_worker:

Code: Select all

eventhandler=no
services=yes
hosts=yes
hostgroups=ae_direct_wrn
#servicegroups=name1,name2,name3
Is that the correct setup? That of course isn't all the config file contents, just the parts that pertain.
My last question is, in some other forum post a few months ago, I was told by someone(I think Mike, but not sure), that I should turn event_handler to no. Why is that? Can I not distribute the event handlers as well?

Re: Gearman hostgroup and servicegroups

Posted: Thu Dec 27, 2012 3:14 pm
by BanditBBS