From YobiWiki
Revision as of 22:34, 24 November 2010 by PhilippeTeuwen (talk | contribs) (Reverted edits by Etegohy (Talk) to last revision by PhilippeTeuwen)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Munin is a nice Monitoring framework



On the collector

apt-get install munin libdate-manip-perl

Configure /etc/munin/munin.conf to add nodes to collect

On each node

apt-get install munin-node libnet-snmp-perl libio-socket-ssl-perl libcrypt-des-perl libdigest-hmac-perl libio-socket-inet6-perl libwww-perl libnet-irc-perl smartmontools ethtool

Maybe you will have to relax the firewall when installing munin otherwise install will stall during plugin detection if loopback connections to port 3128 are dropped.
Bind the monitor only to the wanted IP in /etc/munin/munin-node.conf and tell which server can get the info:

host <my_ip>
allow ^<regex IP of the collector>$ (see examples)

Select plugins from /usr/share/munin/plugins by adding a symlink in /etc/munin/plugins
To know if a plugin could work, try it with argument "autoconf", if it says yes then it is usable otherwise look inside the plugin code (perl) for hints.
Some plugins require some options to be configured, do that in /etc/munin/plugin-conf.d/munin-node

apache_* plugin

Activate apache2 extended status (cf
Install mod_info:

a2enmod info

Activate in /etc/apache2/apache2.conf the section:

<Location /server-status> etc 

and add just above this section the following line:

ExtendedStatus On
/etc/init.d/apache2 force-reload

Add to /etc/munin/plugin-conf.d/munin-node:

env.lrrd_url "http://<my_ip>:%d/server-status?auto"

ip_ plugin

Add to /etc/munin/plugin-conf.d/munin-node (normally it is already done in the last versions):

user root

Add iptables dummy rules to collect stats on a particular IP:

iptables -A INPUT -d <ip>;iptables -A OUTPUT -s <ip>

Install the plugin for this ip:

ln -s /usr/share/munin/plugins/ip_ /etc/munin/plugins/ip_<ip>

sensors_ plugin

Usually you create symlinks calles sensors_fan, sensors_volt and sensors_temp.

I had many troubles after a kernel upgrade:
Now the output of "sensors" features a "phantom" chip w83627hf-i2c-0-28 with no valid values, aside the 2 others, w83782d-i2c-0-29 and w83627hf-isa-0290.
One more or less correct way would be to e.g. add an entry at the end of /etc/sensors.conf with

chip "w83627hf-i2c-*"
   ignore in0

But sth is really wrong no way to get a section only considered by the -isa- and the other by -i2c-, whatever I tried both sections were submitted to the same filtering rules :-(

I could finally filter properly by specifying completely the chip:

chip "w83782d-i2c-1-29"
chip "w83627hf-isa-0290"
chip "w83627hf-i2c-0-28"
   ignore in0

But the entry order was not the same as before, the sections have to be inverted and some new values must be postponed to the end to keep the uniformity in the history values.
A big hack was to change the output of sensors when called by munin:
In /etc/munin/plugin-conf.d/munin-node it became:

env.sensors sensors|awk 'b==1{p=p"\n"$0};b==2&&/^in/{o=o"\n"$0;next};b==2;/^$/{b+=1};END{print p o}'

Finaly I dumped the rrd files to see what were the previous values and rename the rrd files to the corresponding proper voltN entry:

rrdtool dump /vs/public/var/lib/munin/ |grep "2008-02-1[12] 23:30"

Other plugins

More info on plugins incl. how to write yours: