nagios conference 2011 - mike weber - training: reducing nagios server load with mod-gearman

24
Mod-Gearman Mike Weber [email protected]

Upload: nagios

Post on 15-Jan-2015

2.173 views

Category:

Technology


1 download

DESCRIPTION

Mike Weber's training class on using mod-german to reduce the load on a Nagios monitoring server. The training session was held during the Nagios World Conference North America held Sept 27-29th, 2011 in Saint Paul, MN. For more information on the conference (including photos and videos), visit: http://go.nagios.com/nwcna

TRANSCRIPT

Page 1: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

Mod-Gearman

Mike Weber

[email protected]

Page 2: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 2

Mod-Gearman

Basic FunctionalityWhat does Mod-Gearman do?How does it work?

Self-Load BalancingUsing Mod-Gearman to reduce load on XI.

Load BalancingUse workers to reduce load on Nagios.

Distributed MonitoringSpecify load on numerous networks and workers.

Passive MonitoringReceiving passive checks.

Page 3: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 3

Mod-Gearman: Basic Functionality

Distributes tasks to multiple workersMutiple ServersMultiple Workers

Supports Multiple Programming Languages: C Java Perl PHP Python Shell

Page 4: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 4

Mod-Gearman

Page 5: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 5

NEB: Nagios Event Broker

Page 6: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 6

Mod-Gearman Advantages

Reduce Overall Load on Nagios

Move Problem Processes Off NagiosEventhandler waiting/hungPlugin Delay – some plugins capture resources for up to 10 seconds

Reduce Overhead when Forking Nagios CoreWhen Nagios has to fork a new process and the core is large, the system can take a major hit.

Page 7: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 7

Mod-Gearman Queues

Page 8: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 8

Mod-Gearman Worker Configuration

Worker IdentifierUnique identifier for worker, hostname

min-workerMinimum number of total workers

max-workerMaximum number of total workers

idle-timeoutTime in seconds before idle worker exits

max-jobsMaximum number of jobs before worker exits

Page 9: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 9

Install Process

Install Nagios Event Brokerbroker_module=/usr/local/lib/mod_gearman/mod_gearman.o config=/usr/local/etc/mod_gearman.conf 

Install Server: gearmand/etc/init.d/gearmand start

Install Worker: mod_gearman_worker/etc/init.d/mod_gearman_worker start

Configuration File/usr/local/etc/mod_gearman.conf

Page 10: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

Self-Load BalancingSelf-Load Balancing

Page 11: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 11

Avoiding Falling Dominos

Mod-Gearman ServerMonitoring and Distributing the Load

Mod-Gearman WorkerUsing a Nagios Event Broker to Lighten the LoadUsing a Nagios Event Broker to Distribute the Load

Reduce LatencyLatency reduced by up to 37%

Extend Life in Crisis Events

Preparation for Load Balancing

Page 12: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 12

Self-Load Balancing: Before - After

Page 13: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 13

Mod-Gearman: Server and Worker

PID PPID CPU RAM13480 1 0.0 1328 03:14:05 /usr/local/bin/mod_gearman_worker -d –config=/usr/local/etc/mod_gearman.conf –pidfile=/usr/local/var/mod_gearman/mod_gearman_worker.pid

13481 13480 0.0 1328 03:14:05 /usr/local/bin/mod_gearman_worker -d --config=/usr/local/etc/mod_gearman.conf –pidfile=/usr/local/var/mod_gearman/mod_gearman_worker.pid

19734 1 0.0 114580 01:07:50 /usr/local/sbin/gearmand -p 4730 -P /usr/local/var/mod_gearman/gearmand.pid -d -j 0 -t 10 --log-file=/usr/local/var/mod_gearman/gearmand.log -v -v --l

As you can see the worker uses very little in the way of resources (1328 KB of Memory) compared to the server which uses over 111 MB of Memory. When you look at these figures, you can see adding a worker to help shift the load on the local Nagios server is not a far fetched as you might originally think.

Page 14: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

Load BalancingLoad Balancing

Page 15: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 15

Load Balancing

Page 16: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 16

Load Balancing: Server and Worker

Server Configuration: /usr/local/etc/mod_gearman.conf

server=localhost:4730eventhandler=yesservices=yeshosts=yesencryption=yeskey=linux23_Qg549K

Worker Configuration: /usr/local/etc/mod_gearman.conf

server=192.168.5.4:4730eventhandler=yesservices=yeshosts=yesencryption=yeskey=linux23_Qg549K

Page 17: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 17

Load Balancing: 2 Workers

Page 18: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

Distributed MonitoringDistributed Monitoring

Page 19: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 19

Distributed Monitoring

Page 20: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 20

Distributed Monitoring: Hostgroups

Server Configuration: /usr/local/etc/mod_gearman.conf

server=localhost:4730eventhandler=yesservices=yeshosts=yesencryption=yeskey=linux23_Qg549K

Worker Configuration: /usr/local/etc/mod_gearman.conf

server=192.168.5.4:4730eventhandler=yesservices=yeshosts=yesencryption=yeskey=linux23_Qg549K

hostgroups=debian­servers

Page 21: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

Passive MonitoringPassive Monitoring

Page 22: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 22

Passive Monitoring

Page 23: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 23

Passive Monitoring: send_gearman

#!/bin/bash# Mod­Gearman Passive User Checkusers=`/usr/local/nagios/libexec/check_users ­w 1 ­c 5`/usr/local/bin/send_gearman ­­server=192.168.5.4:4730 ­­encryption=yes ­­key=linux23_Qg549K ­­host=db ­­service=GearUsers ­­message="$users" ­­returncode=1

­­server=192.168.5.4:4730­­encryption=yes­­key=linux23_Qg549K­­host=db­­service=GearUsers­­message="$users"­­returncode=1

Page 24: Nagios Conference 2011 - Mike Weber - Training:  Reducing Nagios Server Load With Mod-Gearman

2011 24

Passive Monitoring: Service Check