Guides‎ > ‎Mod Gearman‎ > ‎


Queues in Mod Gearman (MG) are how checks are handed out to the workers. In larger and more complicated environments, you may want specific workers to ONLY execute specific checks.

The following information should explain the different configuration options available in relation to queues and host/service groups.

With a basic config, when nagios starts it hands off the host and service checks to MG.

MG creates two queues called "host" and "service". You can think of these queues as the default "catch all" queues.

At this point, any worker that connects will execute checks from these queues.

How can you dedicate some checks to be run by specific workers?

In the mod_gearman_neb.conf you do this by specifying the hostgroups= and servicegroups= options. These options directly relate to hostgroups and servicegroups in Nagios.

For example, In Nagios I created a hostgroup called test_hostgroup1 and I put my "centos01" host in it.

NOTE: By using a hostgroup, MG will perform all SERVICE checks for any host in this hostgroup.

In mod_gearman_neb.conf specify hostgroups=test_hostgroup1.

With this updated config, when nagios starts, MG creates three queues called "host", "service" and "hostgroup_test_hostgroup1".

On the worker, in mod_gearman_worker.conf specify hostgroups=test_hostgroup1.

Now this worker will execute any checks in the hostgroup_test_hostgroup1 queue AND it also executes any checks in the "host" and "service" queues.

For any OTHER worker that does NOT have hostgroups=test_hostgroup1 defined in it's config, they will leave the queue hostgroup_test_hostgroup1 alone.

If you want your worker to ignore the default "catch all" queues "host" and "service" then there are additional configuration options to define. In mod_gearman_worker.conf specify hosts=no and services=no.

With this configuration, the worker will ONLY execute checks in the hostgroup_test_hostgroup1 queue.

If you don't want any checks ending up in the "catch all" "host" and "service" queues, you need to:
  • Create a different nagios group for each worker which contains ALL the hosts for which that worker needs to action
  • Define all the groups in mod_gearman_neb.conf using the hostgroups= and servicegroups= options
  • Define each specific worker's config to target the queues it needs to action
  • Following this procedure, nothing will ever end up in the "catch all" "host" and "service" queues and hence checks will be correctly executed on the correct workers.