Thursday, September 2, 2004

Munin server stat graphing tool

My friend Todd (blog) pointed me to a cool piece of software. Munin is a piece of software that wll show information about a computer in a graphical format. One of the interesting things that I like about this is that the software is broken into two pieces. A node that gathers information on a machine, and a server that connects to different nodes, and graphs this information. So I have one machine running the server, while it is gathering this statistical information from all of my servers.




Here are the steps that I used to install munin:

  1. Create user and group 'munin'
  2. run 'make install-main'
  3. create a cron entry for user munin that runs '/opt/munin/bin/munin-cron' every 5 minutes
  4. run 'make install-doc install-man'
  5. run 'make install-node install-node-plugins'
  6. run 'munin-node-configure --shell | sh'
  7. create the following init script
    • !/bin/sh
      #
      # munin This shell script takes care of starting and stopping
      # munin.
      #
      # chkconfig: - 96 29
      # description: munin is a script that keeps track of process on different servers
      # processname: munin-node
      # config: /root/.fetchmailrc

      # Source function library.
      . /etc/init.d/functions

      # Source networking configuration.
      . /etc/sysconfig/network


      munin=/opt/munin/sbin/munin-node

      function start() {
      # Start daemons.
      echo -n "munin:"
      /opt/munin/sbin/munin-node
      RETVAL=$?
      }

      function stop() {
      # Stop daemons.
      echo -n "Shutting down munin: "
      killall munin-node
      RETVAL=$?

      return $RETVAL
      }

      # See how we were called.
      case "$1" in
      start)
      start
      ;;
      stop)
      stop
      ;;
      restart)
      stop
      start
      ;;
      *)
      ;;
      *)
      echo "Usage: $0 start|stop|restart}"
      RETVAL=1
      esac

      exit $RETVAL

  8. copy the plugin.conf to /etc/opt/munin/plugin-conf.d/
  9. Modify /opt/munin/lib/plugins/postfix_mailstats /opt/munin/lib/plugins/postfix_mailvolume so LOGFILE is "maillog"
  10. Create a sym link for postfix_mailstats and postfix_mailvolume into /etc/opt/munin/plugins
  11. run /etc/init.d/munin start