Apr 102014
 

Now that i have a basic server running i wanna setup Munin so i can monitor the server. Munin is a networked resource monitoring tool that can help analyse resource trends and “what just happened to kill our performance?” problems. It is designed to be plug and play. A default installation provides a lot of graphs with almost no work.

Depending on what repositories you use (i mainly use remi and el6) you maybe able to use yum to install.

yum install munin-node munin

if not grab the source and follow the instructions here.

Once installed you need to change a few settings to your liking, the config files are found in “/etc/munin”. Munin has a master/node architecture in which the master connects to all the nodes at regular intervals and asks them for data this is very useful when you got more than server.

Ok basic settings need to setup the master, edit “/etc/munin/munin.conf”

# The next three variables specifies where the location of the RRD
# databases, the HTML output, and the logs, severally.  They all
# must be writable by the user running munin-cron.
dbdir  /var/lib/munin  #RRD databases
htmldir  /var/www/munin  #HTML output (change to whatever your website uses)
logdir  /var/log/munin  #log files
rundir  /var/run/munin

# Where to look for the HTML templates
tmpldir  /etc/munin/templates

# a simple host tree
[localhost]
    address 127.0.0.1
    use_node_name yes

now basic settings for the node, edit “/etc/munin/munin-node.conf”

log_level 4
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid
background 1
setseid 1

user root
group root
setsid yes

# Regexps for files to ignore
ignore_file ~$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.pod$

# A list of addresses that are allowed to connect.  This must be a
# regular expression, due to brain damage in Net::Server, which
# doesn't understand CIDR-style network notation.  You may repeat
# the allow line as many times as you'd like
allow ^127\.0\.0\.1$
allow ^192\.168\.0\.200$

# Which address to bind to;
host *
# And which port
port 4949

Now restart munin-node so it can use the changes you made
/etc/init.d/munin-node restart

Now wait 10 minutes so it can generate some data then visit the webpage to see the results, i store mine in a directory just outside the webserver directory and use “Document directory aliases” in apache so its only available on my domain and not anywhere else.
so visit “http://192.168.0.200/munin/” (change to your setting) and you should see something similar to this
munin
Now click on one of the names, I’ll pick “system”
You should see some graphs like this (obviously yours won’t be all the way across yet)
munin2
If you don’t see any graphs check the log files for any errors, there should be 5 different log files,
first check “/var/log/munin/munin-node.log” and fix any errors.
Once its all working you now have graphs monitoring your server, there is loads of extra plugins you can add to munin depending what you want to monitor.