Munin

From Noah.org
Revision as of 13:13, 26 October 2012 by Root (Talk | contribs) (munin-node.conf)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Munin is simple and easy to use. It's easy to write plugin extensions for munin-node.

Munin-node is much easier to install using Apt or another package manager. It has many Perl dependencies :-(

apt-get install munin-node

Double-check that it included sym links to the plugins:

root@www.example.com: /etc/munin/plugins # ls -l
total 116
drwxr-xr-x  2 root root 4096 Aug 28 15:51 ./
drwxr-xr-x  4 root root 4096 Aug 28 15:51 ../
lrwxrwxrwx  1 root root   41 Aug 28 15:51 apache_processes -> /usr/share/munin/plugins/apache_processes*
lrwxrwxrwx  1 root root   28 Aug 28 15:51 cpu -> /usr/share/munin/plugins/cpu*
lrwxrwxrwx  1 root root   27 Aug 28 15:51 df -> /usr/share/munin/plugins/df*
lrwxrwxrwx  1 root root   30 Aug 28 15:51 forks -> /usr/share/munin/plugins/forks*
lrwxrwxrwx  1 root root   32 Aug 28 15:51 if_err_eth0 -> /usr/share/munin/plugins/if_err_*
lrwxrwxrwx  1 root root   28 Aug 28 15:51 if_eth0 -> /usr/share/munin/plugins/if_*
lrwxrwxrwx  1 root root   35 Aug 28 15:51 interrupts -> /usr/share/munin/plugins/interrupts*
lrwxrwxrwx  1 root root   31 Aug 28 15:51 iostat -> /usr/share/munin/plugins/iostat*
lrwxrwxrwx  1 root root   29 Aug 28 15:51 load -> /usr/share/munin/plugins/load*
lrwxrwxrwx  1 root root   31 Aug 28 15:51 memory -> /usr/share/munin/plugins/memory*
lrwxrwxrwx  1 root root   32 Aug 28 15:51 netstat -> /usr/share/munin/plugins/netstat*
lrwxrwxrwx  1 root root   34 Aug 28 15:51 processes -> /usr/share/munin/plugins/processes*
lrwxrwxrwx  1 root root   29 Aug 28 15:51 swap -> /usr/share/munin/plugins/swap*
lrwxrwxrwx  1 root root   31 Aug 28 15:51 vmstat -> /usr/share/munin/plugins/vmstat*

Use `update-rc.d` under Ubuntu/Debian or under RedHat use `chkconfig`:

# chkconfig --add munin-node
# chkconfig munin-node on
# chkconfig --list munin-node
munin-node      0:off   1:off   2:on    3:on    4:on    5:on    6:off

Start munin-node:

/etc/init.d/munin-node start

munin-node.conf

By default munin-node is configured to only allow connections from localhost (127.0.0.1). I usually modify it to allow connections from any machine on a localnet. Also, some systems have their /etc/hosts file setup to map their FQDN to 127.0.1.1 instead of 127.0.0.1, which is valid, so the default Munin-node config is too restrictive. In the following I remove this restriction.

# localhost
allow ^127\.\d+\.\d+\.\d+$
# localnets
# 192.168.0.0/16
allow ^192\.168\.\d+\.\d+$
# 172.16.0.0/12
allow ^172\.(1[6-9]|2[0-9]|3[01])\.\d+\.\d+$
# 10.0.0.0/8
allow ^10\.\d+\.\d+\.\d+$

Munin-node has a very short connection timeout. This is frequently a problem if you are processing data from a server that sends a large amount of data because the munin-cron may spend more than 5 seconds processing data between each fetch. To fix this add the following to /etc/munin/munin-node.conf.

timeout 60

testing

munin-node-configure --shell

munin server

apt-get install munin

Edit /etc/munin/munin.conf and set htmldir. Make sure to create the htmldir and set ownership to munin:munin.

Edit /etc/crontab and add this line:

*/5 * * * * munin /usr/bin/munin-cron

Add munin plugin

Add new plugin to /usr/share/munin/plugins/. Be sure to make it executable, chmod 755 /usr/share/munin/plugins/NEWPLUGIN.

Create symlink ln -s /usr/share/munin/plugins/NEWPLUGIN /etc/munin/plugins/NEWPLUGIN.

Edit /etc/munin/plugin-conf.d/munin-node and add a section for the new plugin. Often you want the plugin to run as root, so the following is the most common, minimal configuration section you need for a new plugin:

[NEWPLUGIN]
user root