The document discusses using Raspberry Pi boards as low-cost, distributed monitoring nodes managed by a central Nagios server using Mod-Gearman. Key points include:
- Raspberry Pi provides a low-cost ($75), low power solution for running monitoring plugins and reporting data to the Nagios server through Mod-Gearman.
- Mod-Gearman distributes monitoring checks across multiple Pi nodes, balancing the load more efficiently than a single server. It also supports monitoring hosts and services across different programming languages.
- The document outlines installing Raspbian on the Pi, configuring the wireless connection, installing Mod-Gearman worker to run monitoring plugins, and integrating with the Nag
2. 2013 2
The Problem: Remote Monitoring at Low Cost
Limited Service Checks
Limited Cost
Low Power Usage
Central Nagios Server
Low Tech Skills
3. 2013 3
Possible Solutions
Virtual Container
Requires VMWare etc.
Requires Expertise to Configure Nagios
Hardware
Cost
Resource Waste
Tech Skills Required (RAID, Nagios Config)
Passive Checks
Scripts on Hosts (more resources than compiled plugins)
Tech Skills
4. 2013 4
Possible Solutions: ITX
Mini-ITX ($400-600)
6.7 x 6.7 inch motherboard developed by VIA in 2001
Intel Atom 1.8 GHz Processor
2 GB of RAM
SSD
60 Watt Power Supply
Nano-ITX ($500-700)
4.7 x 4.7 inch motherboard developed by VIA in 2003
VIA 1.2 GHz Processor
1 GB of RAM
SSD
60 Watt Power Supply
Pico-ITX ($600-700)
3.9 x 2.8 inch motherboard developed by VIA in 2007
6. 2013 6
Raspberry Pi
Low Cost
$75.00 (board, case, power supply)
Low Power Usage
Power Usage of a Cell Phone
Low Tech Skills
Clone Disks
Distributed Model
Flexible
Low Cost on Nagios Server
8. 2013 8
Installation of wheezy-raspbian
Download the image file which is about 500 MB: http://www.raspberrypi.org/downloads
Verify the Image
sha1sum 20130209wheezyraspbian.zip
b4375dc9d140e6e48e0406f96dead3601fac6c81 20130209wheezyraspbian.zip
Unzip the Image
unzip 20130209wheezyraspbian.zip
Archive: 20130209wheezyraspbian.zip
inflating: 20130209wheezyraspbian.img
Username: pi
Password: raspberry
Verify Disk Location
su
fdisk l
Disk /dev/sdd: 4102 MB, 4102889984 bytes
255 heads, 63 sectors/track, 498 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x295b8178
Device Boot Start End Blocks Id System
/dev/sdd1 1 497 3992135+ b W95 FAT32
Create Disk
dd bs=4M if=~/20121028wheezyraspbian.img of=/dev/sdd
9. 2013 9
Network Configuration: Wireless
Edimax Wireless 802.11b/g/n (supports WPS,WPA2,802.1x)
* works out of the box
/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allowhotplug wlan0
iface wlan0 inet dhcp
wpassid pi
wpapsk Pi89YQbg56)
11. 2013 11
Why Mod-Gearman?
Distributes Tasks to Multiple Workers
Multiple Pi Workers
Supports Multiple Programming Languages
C, Java, Perl, PHP, Python, Shell
Provides a Distributed Model
Client Uses Very Small Resources
In Contrast to DNX Workers
12. 2013 12
Why Not DNX?
Not Currently Updated (2010-4-13)
Uses UDP (less dependable)
Client Uses More Resources
DNX Worker Mod-Gearman Worker
0
50
100
150
200
250
Memory in MB
15. 2013 15
Installation of Mod-Gearman on Pi
Install Prerequisites
sudo aptget update
sudo aptget install gearman modgearmanworker libgearman6 nagiosplugins
cd /etc/modgearman
Edit the worker.conf
sudo nano worker.conf
server=192.168.5.212:4730
key=Modlinux23
hosts=no
services=no
eventhandlers=no
minworker=6
maxworker=8
servicegroups=pi_srv
logfile=/var/log/mod_gearman/mod_gearman_worker.log
p1_file=/usr/share/modgearman/mod_gearman_p1.pl
Save your changes and then start the Mod-Gearman worker:
sudo /etc/init.d/modgearmanworker start
20. 2013 20
Mod-Gearman Worker Configuration
Worker Identifier
Unique identifier for worker, hostname
min-worker
Minimum number of total workers
max-worker
Maximum number of total workers
idle-timeout
Time in seconds before idle worker exits
max-jobs
Maximum number of jobs before worker exits
38. 2013 38
Monitor Pi: Workers and Jobs
Create a Script on Nagios to Monitor Workers and Jobs
#!/bin/bash
check_gearman -H 192.168.5.99 -q worker_raspberrypi -t 10 -s check
48. 2013 48
Troubleshooting: Return code 127
CRITICAL: Return code of 127 is out of bounds. Make sure the plugin you're trying to run actually
exists. (worker: raspberrypi)
Check the Path to the plugins directory.
sudo mkdir p /usr/local/nagios
sudo ln s /usr/lib/nagios/plugins /usr/local/nagios/libexec