Blog

Configuring Munin on a Debian 7 system for monitoring of server.

Following this, we’ll install all we need to make munin service run and be optimized to what we need to monitor.

Lets install munin:

apt-get install munin munin-node munin-plugins-extra

Let’s enable some default plugins:

cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/mysql_ mysql_
ln -s /usr/share/munin/plugins/mysql_bytes mysql_bytes
ln -s /usr/share/munin/plugins/mysql_innodb mysql_innodb
ln -s /usr/share/munin/plugins/mysql_isam_space_ mysql_isam_space_
ln -s /usr/share/munin/plugins/mysql_queries mysql_queries
ln -s /usr/share/munin/plugins/mysql_slowqueries mysql_slowqueries
ln -s /usr/share/munin/plugins/mysql_threads mysql_threads

Now let’s start editing the server configuration:

vi /etc/munin/munin.conf

More or less you should see something like this.

# Example configuration file for Munin, generated by 'make build'
 
# The next three variables specifies where the location of the RRD
# databases, the HTML output, logs and the lock/pid files.  They all
# must be writable by the user running munin-cron.  They are all
# defaulted to the values you see here.
#
dbdir   /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir  /var/run/munin
 
# Where to look for the HTML templates
#
tmpldir /etc/munin/templates
 
# Where to look for the static www files
#
#staticdir /etc/munin/static
 
# temporary cgi files are here. note that it has to be writable by
# the cgi user (usually nobody or httpd).
#
# cgitmpdir /var/lib/munin/cgi-tmp
 
# (Exactly one) directory to include all files from.
includedir /etc/munin/munin-conf.d
[...]
# a simple host tree
[server1.example.com]
    address 127.0.0.1
    use_node_name yes
[...]

Now to finish the default’s lets restart munin and apache:

service apache2 restart
service munin-node restart

Some advanced stuff:

We need to check that we’re not missing any libraries for Munin to work correctly for this; let’s run:

munin-node-configure --suggest

Here a long list will appear saying what you’re missing, it’s common to see with MYSQL you’re missing cache pearl libs… so

apt-get install libcache-cache-perl

To work with plugins, you’ll be creating and removing system links, so…

cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/apache_accesses

That would be an example on how to work with plugins.

I NEED BIND9!

Okay, don’t get crazy, lets work with bind9 and munin.

In: /etc/bind/named.conf.options we need to enable stat’s file, add the following line.

statistics-file "/var/cache/bind/named.stats";
logging {
        channel b_query {
                file "/var/log/bind9/query.log" versions 2 size 1m;
                print-time yes;
                severity info;
        };
        category queries { b_query; };
};

/var/log/bind9 > add that path, and chown to bind, and allow it to write the log there.

Next, lets tell munin to process that:

vi /etc/munin/plugin-conf.d/munin-node

[bind9]
user root
env.logfile   /var/log/bind9/query.log
 
[bind9_rndc]
user root
env.querystats /var/cache/bind/named.stats

Once that is done, lets make the symlinks.

ln -s /usr/share/munin/plugins/bind9 /etc/munin/plugins/bind9
ln -s /usr/share/munin/plugins/bind9_rndc /etc/munin/plugins/bind9_rndc

As usual restart munin-node!

DONE!.

REMEMBER TO RM [SYMLINKS] to plugins you don’t need, or Munin can turn into a huge memory hog… in my experience bind9 plugin… take’s a long time to process, leading to a sluggish system.

ddemuro
administrator

Sr. Software Engineer with over 10 years of experience. Hobbist photographer and mechanic. Tinkering soul in an endeavor to better understand this world. Love traveling, drinking coffee, and investments.

You may also like

Leave a Reply

%d bloggers like this: