Wednesday, August 29, 2007

Munin - monitor linux hosts install howto

How to monitor server and client hosts using munin?
How to install munin as graph server and as client node host?
How to configure munin as a server and as a client?
How to graph data and statistics using munin in linux?
How to have MRTG-like monitoring graph in linux?

Munin is a highly flexible and powerful solution used to create graphs of virtually everything imaginable throughout your network, while still maintaining a rattling ease of installation and configuration.

This package contains data grapher that gathers data. You will only need one instance of it in your network. It will periodically poll all the nodes in your network it's aware of for data, which it in turn will use to create graphs and HTML pages, suitable for viewing with your graphical web browser of choice.

Munin can run in two monitoring modes, as a munin graph server watching current host from where it is currently installed, or a munin node being monitored by munin grap server.

Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent RRDtool. Munin generates apache graph using this RRDTool. Munin also supports API plugins feature which currently are still being enhanced.

This entry covers Munin installation and configuration guides for Fedora 7 to monitor a host. This steps should work fairly fine with later Fedora versions and CentOs 4.x versions.

By default munin installation, munin can monitor and graph the following:

a. Filesystem usage on daily and weekly graph
b. Inode usage on daily and weekly graph
c. IOStat usage on daily and weekly graph
d. MySQL throughput on daily and weekly graph
e. MySQL queries on daily and weekly graph
f. MySQL slow queries on daily and weekly graph
g. MySQL threads on daily and weekly graph
i. Network interfaces usage, traffic and error statistics on daily and weekly graph
j. Netstat usage on daily and weekly graph
k. NFS server usage on daily and weekly graph
l. Postfix mail queue on daily and weekly graph
m. Fork rate usage on daily and weekly graph
n. VMStat usage on daily and weekly graph
o. System process on daily and weekly graph
p. Sendmail mail queue, mail traffic, email volumes on daily and weekly graph
q. CPU usage, entropy, interrupts, context switches on daily and weekly graph
r. Load average, memory usage, file table usage on daily and weekly graph
s. Inode table, swap Ins/Outs usage on daily and weekly graph

and more plugins to come!

INSTALLATION STEPS
==================

MUNIN GRAPH (SERVER) INSTALLATION MODE
------------------------------------

If you wish to install munin as a stand-alone munin graphing server and gather data only from where it would be installed, simply do the below munin graph server installation like so

# yum -y install munin

MUNIN NODE (CLIENT) INSTALLATION MODE
------------------------------------

But if you wish that your other host or node be monitored by a munin graph server, you need to install munin-node on that client host like so

# yum -y install munin-node

Doing the below installation for the munin graph server like so

# yum -y install munin munin-mode

would be just fine.

MUNIN GRAPH SERVER CONFIGURATION
--------------------------

After successful yum munin server installation, take note that this munin package

a. creates /var/www/html/munin folder as default munin home page folder
b. creates /etc/munin/* folder and configuration files
c. creates munin user account with /sbin/nologin shell
d. create a cronjob in /etc/cron.d/munin
e. does not open port 4949 from current linux firewall

And it creates a default /etc/munin/munin.conf values like show below

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dbdir /var/lib/munin
htmldir /var/www/html/munin
logdir /var/log/munin
rundir /var/run/munin
tmpldir /etc/munin/templates
[localhost]
address 127.0.0.1
use_node_name yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using the above values is enough for munin to act as a graph server from where it was installed.

http://host-ip-address/munin/

Munin creates graph in per second values, if you wish to modify it and change it for per minute,you need to edit /etc/munin/munin.conf and uncomment this line

graph_period minute

You need to allow the IP address where the munin graph server is running and add it to /etc/munin-node.conf. This can be done by adding

allow ^123\.123\.123\.1233$

assuming your munin graph server has an IP address of 123.123.123.123 .

Editing /etc/munin/munin-node.conf and adding the IP address of munin graph server should be done from all host of munin node client installation.

It is assumed here that both your crontab utility and apache web server services are currently running without any problems.

Now, follow the next steps

# chown munin.munin /var/www/html/munin -R

Restart your apache and crontab utility from munin grap server like so

# service httpd restart ; service crond restart

and restart the munin from the node host like so

# service munin-node restart

Give it some time for like 5 minutes and fire up your fave browser and point it to http://host-ip-address/munin/.

The browser should be able to show you the recently generated graph.

ADD NEW MUNIN CLIENT
~~~~~~~~~~~~~~~~~~~~
If you wish to add more host nodes to be included with munin graph server, launch your fave editor and edit /etc/munin/munin.conf from the munin graph server. Add the new host node like so

[newnode.domain.com]
address 192.168.0.154
user_node_name yes

Make sure you have added the IP address of munin graph server from /etc/munin/munin-node.conf from all munin node client hosts.

If your munin client host has more than one IP address and you wish to bind munin-node in one interface only, you can edit the line

host *

from /etc/munin/munin-node.conf and put your selected ethernet IP address.

If you wish to change the port number where munin will fetch and listen for stats, this can also be done by editing

port 4949.

Make sure your that this TCP port is open from current firewall settings of all munin node client.

Restart munin-node service and firewall from munin node clients like so

# service munin-node restart
# service iptables restart

Make sure all munin node hosts are network reachable by the munin graph server.

And you're done.

See my sample screenshots:


0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy