Download - Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman
![Page 2: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/2.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/3.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/4.jpg)
2011 4
Mod-Gearman
![Page 5: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/5.jpg)
2011 5
NEB: Nagios Event Broker
![Page 6: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/6.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/7.jpg)
2011 7
Mod-Gearman Queues
![Page 8: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/8.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/9.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/10.jpg)
Self-Load BalancingSelf-Load Balancing
![Page 11: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/11.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/12.jpg)
2011 12
Self-Load Balancing: Before - After
![Page 13: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/13.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/14.jpg)
Load BalancingLoad Balancing
![Page 15: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/15.jpg)
2011 15
Load Balancing
![Page 16: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/16.jpg)
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](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/17.jpg)
2011 17
Load Balancing: 2 Workers
![Page 18: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/18.jpg)
Distributed MonitoringDistributed Monitoring
![Page 19: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/19.jpg)
2011 19
Distributed Monitoring
![Page 20: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/20.jpg)
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=debianservers
![Page 21: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/21.jpg)
Passive MonitoringPassive Monitoring
![Page 22: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/22.jpg)
2011 22
Passive Monitoring
![Page 23: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/23.jpg)
2011 23
Passive Monitoring: send_gearman
#!/bin/bash# ModGearman 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:4730encryption=yeskey=linux23_Qg549Khost=dbservice=GearUsersmessage="$users"returncode=1
![Page 24: Nagios Conference 2011 - Mike Weber - Training: Reducing Nagios Server Load With Mod-Gearman](https://reader033.vdocuments.mx/reader033/viewer/2022052618/54b76a484a795918158b457d/html5/thumbnails/24.jpg)
2011 24
Passive Monitoring: Service Check