sni / mod_gearman

Distribute Naemon Host/Service Checks & Eventhandler with Gearman Queues. Host/Servicegroups affinity included.
http://www.mod-gearman.org
GNU General Public License v3.0
122 stars 42 forks source link

New user trying to have a worker dedicated to LAN network. #152

Closed hallux4 closed 4 years ago

hallux4 commented 4 years ago

Hi,

This time, I don't have any problem except my lack of understanding.

I have an OMD setup with a public IP. And I would like to monitor some of our intranet (no port forwarding possible, and dynamic IP).

So I setup a mod-gearman worker on one of our LAN server.

On the job server I can see the worker. If I stop the worker on OMD. The jobs are just "Waiting".

If I set services and hosts = yes on the "LAN" worker. it will handle all the jobs, not just the one from hostgroups=my_intranet_hostgroup.

How to make the worker take only its hostgroups jobs ?

I saw this in the documentation, can it be a solution for my problem ?

I am sorry to bother you so often ^^

hallux4 commented 4 years ago

I tried like this but I don't think it's working ^^

On OMD server:

define host {
  host_name                      Intranet-Health
  alias                          Intranet Health
  address                        MY_IP
  use                            generic-host
  _WORKER                        hostgroup_test
}

On OMD server:

Queue Name                | Worker Available | Jobs Waiting | Jobs Running
----------------------------------------------------------------------------
 check_results             |               2  |           0  |           0
 eventhandler              |              11  |           0  |           0
 grafana_data              |               0  |          38  |           0
 host                      |               6  |           0  |           0
 hostgroup_hostgroup_test  |               6  |           0  |           0
 hostgroup_linux-servers   |               5  |           0  |           0
 hostgroup_test            |               0  |           2  |           0
 hostgroup_websites_health |               5  |           0  |           0
 notification              |               5  |           0  |           0
 perfdata                  |               1  |           0  |           0
 service                   |               6  |           0  |           0
 worker_node1              |               1  |           0  |           0
 worker_node2              |               1  |           0  |           0
 worker_node3              |               1  |           0  |           0
----------------------------------------------------------------------------

On LAN server (node3):

hostgroups=hostgroup_test
sni commented 4 years ago

it should work exactly how you did it. Both ways are possible. If you stop the LAN worker, you should see job pile up in that hostgroup queue. Using custom variables is possible to give you complete flexibility but its not required in your scenario.

The key options are described here: https://labs.consol.de/nagios/mod-gearman/sample_distributed.png

As mentioned in the "Distributed Monitoring" scenario on https://labs.consol.de/nagios/mod-gearman/index.html#_common_scenarios

hallux4 commented 4 years ago

Oh I did in fact missed a step from the picture. I forgot to define the hostgroups in etc/mod-gearman/server.cfg.

Thanks again. Have a great day !