This is a disclaimer:
Using the notes below is dangerous for both your sanity and peace of mind.
If you still want to read them beware of the fact that they may be "not even wrong".

Everything I write in there is just a mnemonic device to give me a chance to
fix things I badly broke because I'm bloody stupid and think I can tinker with stuff
that is way above my head and go away with it. It reminds me of Gandalf's warning:
"Perilous to all of us are the devices of an art deeper than we ourselves possess."

Moreover, a lot of it I blatantly stole on the net from other obviously cleverer
persons than me -- not very hard. Forgive me. My bad.

Please consider it and go away. You have been warned!

(:toc:)

Munin server

The munin server (version 1.4.5) is running on a Xen virtual machine named matsya. It’s config file is located in /etc/munin/munin.conf and uses all the default values from the packaged distro (Debian/Squeeze) except for the following values (default is 6) which I lowered since at times the load average on the Xen guest was too high and there was a lot of cpu I/O wait.

(:source:)

  1. munin-cgi-graph is invoked by the web server up to very many times at the
  2. same time. This is not optimal since it results in high CPU and memory
  3. consumption to the degree that the system can thrash. Again the default is
  4. 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
  5. max_graph_jobs.

munin_cgi_graph_jobs 3

  1. munin-graph runs in parallel, the number of concurrent processes is
  2. 6. If you want munin-graph to not be parallel set to 0. If set too
  3. high it will slow down munin-graph. Some experiments are needed to
  4. determine how many are optimal on your system. On a multi-core
  5. system with good SCSI disks the number can probably be quite high.

max_graph_jobs 3 (:sourceend:)

The BIC specific stuff (client nodes) is defined in /etc/munin/munin-conf.d/bic-munin-nodes.conf. Add an entry for each host you want to monitor with munin.

(:source:) [cassio.bic.mni.mcgill.ca]

   address 132.206.178.141
   use_node_name yes

[curtis.bic.mni.mcgill.ca]

   address 132.206.178.142
   use_node_name yes

[edgar.bic.mni.mcgill.ca]

   address 132.206.178.150
   use_node_name yes

(:sourceend:)

Web server

Munin generates and updates its Round Robin Databases (rrdb) files using a cron job every 5mins and they can be plotted using the provided cgi scripts. All is required is to configure a web server to access them. The following piece of apache config will do the trick. Note that the apache server is running on a secure connection (https) but no authentication is done/forced. I will add the SSL authentication bits later as I have done for Nagios. Right now the server only accept requests from insde the BIC and my IP from home. The URL to use is https://matsya.bic.mni.mcgill.ca/munin.

(:source:)
  1. Munin
   Alias /munin /var/cache/munin/www

   <Directory “/var/cache/munin/www/”>

       AllowOverride None
       Order Deny,Allow
       Deny from all
       Allow from 132.206.178.
       Allow from 184.144.171.254
       Options None

       # This file can be used as a .htaccess file, or a part of your apache
       # config file.
       #
       # For the .htaccess file option to work the munin www directory
       # (/var/cache/munin/www) must have “AllowOverride all” or something 
       # close to that set.
       #

       # AuthUserFile /etc/munin/munin-htpasswd
       # AuthName “Munin”
       # AuthType Basic
       # require valid-user

       # This next part requires mod_expires to be enabled.
       #

       # Set the default expiration time for files to 5 minutes 10 seconds from
       # their creation (modification) time.  There are probably new files by
       # that time. 
       #

       <IfModule mod_expires.c>
           ExpiresActive On
           ExpiresDefault M310
       </IfModule>

   </Directory> 

(:sourceend:)

Of course the mod_expires module must be enabled (it’s not by default). The directive ExpiresDefault M310 above says to expires all current copies of the document in all caches at the same time (that’s the M) every 5 minutes 10 seconds (310).

Client/Node setup

Client/node setup is easy: the plugins are enabled/diabled by simply creating or removing links from /etc/munin/plugins to /usr/share/munin/plugins. A few commands can be helpful and good to know:

  • munin-node-configure —shell to see what munin can suggest/detect as available plugins.
  • munin-run some_plugin to see the output of a plugin.

The node config is /etc/munin/munin-node.conf. The entry allow is a regex that must match the munin master IP address. The rest is standard default stuff.

(:source:)

  1. munin-node.conf

log_level 4 log_file /var/log/munin/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 setsid 1 user root group root allow ^132\.206\.178\.240$ host * port 4949 (:sourceend:)

Munin must be restarted whenever the config is changed or a plugin is enabled by /etc/init.d/munin-node restart.

You can modify a specific plugin default config values by changing the file /etc/munin/plugin-conf.d/munin-node. Typically used to pass or modify environment variables and modify the user/group of the running plugin.

Non-Standard Plugins

Digitemp

I have written a very simple munin plugin for temperature readings in the Bunker using Digitemp and 1-Wire DS9097U sensors.

  • Install digitemp from Debian repositary: apt-get install digitemp
  • Create a symlink with ln -s /usr/bin/digitemp_DS9097U usr/bin/digitemp
  • Initialize .digitemprc file, search the bus for all supported devices with digitemp -i
  • Copy .digitemprc to /etc/digitemp.conf

This is the plugin itself that I modified a little after some googling: (:source:)

  1. !/bin/sh
  2. Stuff this in /etc/munin/plugins/munin-digitemp

if [ “$1” = “config” ]; then echo ‘graph_title Digitemp Sensors’ echo ‘graph_args —base 1000 -l 0’ echo ‘graph_vlabel Celsius’ echo ‘graph_category Temperature’ echo ‘graph_info This Graph shows Digitemp Sensors.’ echo ‘sensor0.label Sensor 0’ echo ‘sensor0.info Sensor 0’ echo ‘sensor0.draw LINE2’ echo ‘sensor1.label Sensor 1’ echo ‘sensor1.info Sensor 1’ echo ‘sensor1.draw LINE2’ echo ‘sensor2.label Sensor 2’ echo ‘sensor2.info Sensor 2’ echo ‘sensor2.draw LINE2’ exit 0 fi

digitemp -t 0 -q -c /etc/digitemp.conf -o %.2C | awk ‘{print “sensor0.value “ $7}’ digitemp -t 1 -q -c /etc/digitemp.conf -o %.2C | awk ‘{print “sensor1.value “ $7}’ digitemp -t 2 -q -c /etc/digitemp.conf -o %.2C | awk ‘{print “sensor2.value “ $7}’ (:sourceend:)