Posts

How to Configure Munin Monitoring Server

Step 1: Prerequisites

Firstly install all the required libraries that are dependent on munin installation:

# yum install -y httpd php gcc glibc glibc-common libpcre rrdtool

Step 2: Install munin Package

In order to configure munin monitoring server firstly install munin & munin-node package from EPEL repository.

# yum --enablerepo=epel -y install munin munin-node

Step 3: Configure munin package

Edit the munin.conf file and add your hostname name

# vi /etc/munin/munin.conf
[beta.tecdistro.com]
    address 127.0.0.1
    use_node_name yes

Edit /etc/httpd/conf.d/munin.conf file and allow and deny the networks in order to access the munin monitoring service.

# vi /etc/httpd/conf.d/munin.conf
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 10.0.0.0/24

Step 4: Configure Apache Authentication

We need to setup apache authentication for user munin-admin. Do not change this username. else you would required more changes in configuration.

# cd /var/www/html/munin
#vi .htaccess
AuthUserFile /var/www/html/munin/.htpasswd
AuthGroupFile /www.null
AuthName "Authorization Required"
AuthType Basic
require user munin-admin
Save the file and exit.
Execute the htpasswd to set the password againts munin-admin user
# htpasswd -c /var/www/html/munin/.htpasswd munin-admin
# vi /etc/httpd/conf/httpd.conf
 <Directory "/var/www/html/munin">
 AllowOverride AuthConfig
</Directory>
# service httpd restart

Now restart Apache service.

# service httpd restart
OR
# /etc/rc.d/init.d/httpd restart
Stopping httpd:             [ OK ]
Starting httpd:             [ OK ]

Step 5: Start Service

Configure Munin node as a monitoring target.

# vi /etc/munin/munin-node.conf
host_name tecdistro
# /etc/rc.d/init.d/munin-node start
Starting Munin Node:      [ OK ]

Also configure munin service to start on system start.

# chkconfig --add munin
# chkconfig munin on
# chkconfig munin-node on

Step 6: Configure Notifications & Alerts

# vi /etc/munin/munin.conf
contact.email.command mail -s "Munin-notification for ${var:group}::${var:host}" your_email_address
contact.log.command tee -a /var/log/munin/alert.log

To verify the notifications are configured properly execute the below command:

#su - munin --shell=/bin/bash -c "/usr/share/munin/munin-limits --contact email --force"

Step 7: Set the Alerts

Set the threshold of alerts(warning & critical notifications) in munin.conf file for services like cpu_load, disk_utilization, memory etc. Here we add cpu_load, disk_utilization in configuration file.

# vi /etc/munin/munin.conf
[tecdistro.com]
    address 127.0.0.1
    use_node_name yes
#Set warning and critical threshold of CPU
    cpu.user.warning :80
    cpu.user.critical :90
#Set warning and critical threshold of root partition
    df._dev_mapper_VolGroup_lv_root.warning :80
    df._dev_mapper_VolGroup_lv_root.critical :90
#Set warning and critical threshold of home2 partition(if exists)
    df._dev_mapper_VolGroup-lv_home2.warning :80
    df._dev_mapper_VolGroup_lv_home2.critical :90

How to Add Host in Munin Monitoring Server

In order to add munin client on target host follow the steps:

Install munin Package

In order to configure munin monitoring server firstly install munin & munin-node package from EPEL repository.

# yum --enablerepo=epel -y install munin munin-node

Configure munin package

Edit the munin-node.conf file and add your hostname

# vi /etc/munin/munin-node.conf 
host_name backup.distro
allow ^10\.10\.10\.20$

Start Service

# /etc/rc.d/init.d/munin-node start
Starting Munin Node:         [ OK ]

Also configure munin service to start on system start.

# chkconfig munin-node on

Add target host in monitoring server

Edit the munin.conf file and add remote host.

# vi /etc/munin/munin.conf
[backup.tecdistro.com]
    address 10.10.10.20
    use_node_name yes