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

sample_load_balancing

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

Prerequiste

Install epel-release

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install Mod-Gearman

The rpm are availables on : http://mod-gearman.org/download/v1.4.6/rhel5/.

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 "http://labs.consol.de/repo/stable/rhel5/i386/labs-consol-stable-1.3-1.rhel5.noarch.rpm"
# 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 labs.consol.de 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

or

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

neb_config

  • 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 "http://labs.consol.de/repo/stable/rhel5/i386/labs-consol-stable-1.3-1.rhel5.noarch.rpm"
# 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

server=fan-standalone:4730
max-worker=200
max-jobs=1000

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

Benchmarck

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)

latency

 

More benchmarks : http://labs.consol.de/blog/nagios/monitoring-core-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.
hostgroups=name2,name3

# sets a list of servicegroups which this worker will work on.
servicegroups=name1,name2,name3
No comments yet.


two − 2 =

 
No trackbacks yet.