How to use Mod Gearman with FAN

Mod-Gearman : making Nagios faster and scalable…

Mod-Gearman is a Nagios addon which extends Nagios to run scalable and distributed setups. Mod-Gearman can even help to reduce the load on a single Nagios host, because of its smaller and more efficient way of executing host- and servicechecks.

For example, we will install Mod_Gearman on :

  • 1 fan-standalone, we will install gearmand and nagios will use mod-gearman.o neb
  • 2 fan-poller, we will install gearman worker


Refer to this page to install fan-standalone or fan-poller.

Don’t use system-config-distributed-monitoring command.

I suppose you are configured the network on 3 servers : fan-standalone, fan-poller1, fan-poller2


Install epel-release

# rpm -Uvh

Install Mod-Gearman

The rpm are availables on :

I advise use Consol* Labs Repository

When I wrote this tutorial I used 1.46 version.

On fan-standalone

Install rpm : gearmand, gearmand-server, mod_gearman

# rpm -Uvh ""
# yum install gearmand gearmand-server mod_gearman

Add gearmand daemon to start at the boot :

# chkconfig --add gearmand
# chkconfig --level 345 gearmand on

Create the file /etc/sysconfig/gearmand (see page to optimize the daemon)

OPTIONS="--threads=10 --job-retries=0"

Start gearmand daemon :

# service gearmand start


Configure the neb in centreon

Go to http://fan-standalone/centreon, click on

  • Configuration > Monitoring Engines > main.cfg
  • Select “Nagios CFG 1″
  • Go to “Data” tab
  • Add “New broker module”
/usr/lib64/mod_gearman/mod_gearman.o config=/etc/mod_gearman/mod_gearman_neb.conf


/usr/lib/mod_gearman/mod_gearman.o config=/etc/mod_gearman/mod_gearman_neb.conf


  • click Save

Deploy Nagios files config and restart Nagios :

  • Go to Configuration > Monitoring Engines > Generate
  • Select “default” poller
  • check “Move Export Files”
  • check “Restart Monitoring Engine”


On fan-poller1 and fan-poller2

Disable nagios daemon, it’is not necessary with Mod Gearman :

# chkconfig nagios off

Install rpm gearmand and mod_gearman

# rpm -Uvh ""
# yum install gearmand mod_gearman

Add mod_gearman_worker daemon to start at the boot :

# chkconfig --add mod_gearman_worker

Modify file configuration /etc/mod_gearman/mod_gearman_worker.conf


Start mod_gearman_worker daemon

# service mod_gearman_worker start


Configure monitoring into Centreon

On fan-standalone, use Centreon to add host and services.

Attach hosts to default poller

Deploy nagios configuration files for default poller


Monitoring : 500 hosts and 5000 services, every minute !

First test I use :

  • fan-standalone : 2vcpu, 2Go RAM
  • Mod-Gearman disabled

Second test : I use :

  • fan-standalone : 2vcpu, 2Go RAM
  • 2 pollers : 2vcpu, 4Go RAM
  • Mod-Gearman enabled

This easiest variant is a simple load balancing. The single Nagios box just cannot handle the load, we just add 2 worker in the same network to reduce your load on the Nagios box.

At 12:00 I enable mod-gearman, the average latency is reduced by half (60s to 30s)



More benchmarks :

Distributed Monitoring

If your checks have to be run from different network segments, then you can use the hostgroups (or servicegroups) to define a hostgroup for specific worker. The general hosts and services queue is disabled for this worker and just the hosts and services from the given hostgroup will be processed.

Edit /etc/mod_gearman/mod_gearman_worker.conf file :

# sets a list of hostgroups which this worker will work on. Either specify a comma
# seperated list or use multiple lines.

# sets a list of servicegroups which this worker will work on.
No comments yet.

4 − four =

No trackbacks yet.