How-to – Install Munin on RHEL/CentOS

0
1731

Munin is a networked resource monitoring tool that can help analyze resource trends.
Munin the monitoring tool surveys all your computers and remembers what it saw. It presents all the information in graphs through a web interface.

This article will help you to install Munin on your system.

  • Add the efollowing repository to your rhel/centos environment:
CentOS/RHEL 6, 32 Bit (i386): 
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 

CentOS/RHEL 6, 64 Bit x86_64): 
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 

CentOS/RHEL 5, 32 Bit (i386): 
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 

CentOS/RHEL 5, 64 Bit (x86_64): 
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
  • Update yum repositories and install munin
# yum update
# yum install munin-node munin rdtools
  • To install only the node do the following command after the update command
# yum install munin-node

Configuration

Munin Server

  • Open the /etc/munin/munin.conf file and add the remote node:

Example:

[LOCALHOST]
 address 127.0.0.1
 use_node_name yes

[SERVER1]
 address 192.168.1.1
 use_node_name yes
  • If you want to divide the nodes with groups, do the following change:
[GROUP1;SERVER1]
 address 192.168.1.1
 use_node_name yes
  • Create to the dir /etc/httpd/conf.d the following file: munin.conf
# Enable this for template generation
Alias /munin /var/www/html/munin

# Enable this for cgi-based templates

<Directory /var/www/html/munin>
 Order Allow,Deny
 Allow from all
 Options None

 # This file can be used as a .htaccess file, or a part of your apache
 # config file.
 #
 # For the .htaccess file option to work the munin www directory
 # (/var/cache/munin/www) must have "AllowOverride all" or something
 # close to that set.
 #

 AuthUserFile /etc/munin/munin-htpasswd
 AuthName "Munin"
 AuthType Basic
 require valid-user

 # This next part requires mod_expires to be enabled.
 #
 # Set the default expiration time for files to 5 minutes 10 seconds from
 # their creation (modification) time. There are probably new files by
 # that time.
 #
 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault M310
 </IfModule>
 
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph

<Location /munin-cgi/munin-cgi-graph>
 Order allow,deny
 Allow from all

 AuthUserFile /etc/munin/munin-htpasswd
 AuthName "Munin"
 AuthType Basic
 require valid-user

 #<IfModule mod_fastcgi.c>
 # SetHandler fastcgi-script
 #</IfModule>

 <IfModule mod_fcgid.c>
 SetHandler fcgid-script
 </IfModule>
 <IfModule !mod_fcgid.c>
 SetHandler cgi-script
 </IfModule>
</Location>
  • Create the password file (munin-htpasswd) with the following command:
# htpasswd -cm /etc/munin/munin-htpasswd muninadmin
  • Restart the service Munin and Apache and configure the autostart for Munin service
# service munin restart
# chkconfig munin on
# service httpd restart
  • Access to the url
http://192.168.1.5/munin

Munin Node

  • On the remote node, go to the file /etc/munin/munin-node.conf and add the IP of Munin server to the allow directive:
allow ^127\.0\.0\.1$
allow ^::1$
allow ^192\.168\.1\.5$
  • Go to the dir /etc/munin/plugins and verify if you have all the plugins that you need. If no, go to the dir /usr/share/munin/plugins and check if they are. To enable them, create a symlink into the dir /etc/munin/plugins
ln -s /usr/share/munin/plugins/netstat /etc/munin/plugins/netstat
  • Restart the munin-node service and configure the autostart
# service munin-node restart
# chkconfig munin-node on

Be careful that every plugins should be configured before so first of all edit the plugin and check if all variables have the correct settings.