Munin-Network Monitoring

Centos 7

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

# systemctl enable munin-node # systemctl start munin-node

# vi /etc/munin/munin.conf

Add/Edit as shown below.

#Uncomment the following lines dbdir   /var/lib/munin htmldir /var/www/html/munin logdir /var/log/munin rundir  /var/run/munin  [...]  # a simple host tree. Set your system name [munin.worldcm.net] address 127.0.0.1 use_node_name yes

# vim /etc/httpd/conf.d/munin.conf

Alias /munin /var/www/html/munin <Directory /var/www/html/munin>     Options FollowSymLinks     AllowOverride None     Order allow,deny     Allow from all </Directory> ####---------- Password------------####

<Directory /var/www/html/munin/>       AuthUserFile /etc/munin/munin-htpasswd       AuthName "Munin"       AuthType Basic       require valid-user  Order Deny,Allow Deny from all Allow from all </Directory>

Create munin htpasswd file using following command

htpasswd -cm /etc/munin/munin-htpasswd muninadmin  New password: Re-type new password:

WEB:  http://192.168.1.100/munin

Installing Munin Network Monitoring in CentOS RHEL and Fedora

Munin is a networked resource monitoring tool that can help analyze resource trends. Muninthe 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.

Step 1: Set Up EPEL Repository

First we need to add epel repository in our system. Use one of following command to install as per system architecture.

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

Step 2: Install Munin Packages

Use following command to install Munin and required packages

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

Step 3: Configure Apache

By default Munin creates Apache configuration file /etc/httpd/conf.d/munin.conf. Edit Munin Apache configuration file and add following content.

# vim /etc/httpd/conf.d/munin.conf

Alias /munin /var/www/html/munin <Directory /var/www/html/munin>     Options FollowSymLinks     AllowOverride None     Order allow,deny     Allow from all </Directory>  <directory /var/www/html/munin> AuthUserFile /etc/munin/munin-htpasswd AuthName "Munin" AuthType Basic require valid-user  ExpiresActive On ExpiresDefault M310 </directory> ScriptAlias /munin-cgi/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph

Create munin htpasswd file using following command

# htpasswd -cm /etc/munin/munin-htpasswd muninadmin New password: Re-type new password:

Above created login details will required to access Munin web interface.

Step 4: Restart Services

First start Munin node service and configure to auto start on system boot.

# /etc/init.d/munin-node start # chkconfig munin-node on

Restart Apache service

# service httpd restart

Step 5: Access Munin Web Interface

Open following url in browser to access Munin web interface. Change ip/domain as per your setup.

http://192.168.1.100/munin or http://svr2.tecadmin.net/munin

Wait approx one hour to view Munin graphs in web interface.

For more details and configuration of munin refer following links

http://munin.readthedocs.org/en/latest/

http://munin.readthedocs.org/en/latest/installation/configuration.html

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# chown munin:munin /var/www/html/munin

# htpasswd /etc/munin/munin-htpasswd Munin

CENTOS 5,6 AND FEDORA

# service munin-node start

# chkconfig --level 35 munin-node on

CENTOS 7

# systemctl enable munin-node.service

# systemctl start munin-node.service

 REMOVE MUNIN AND MUNIN NODE

# yum remove munin-node

###################################################

Install Munin to monitor system status.                                                         

Install Munin server.                                                                    http://www.server-world.info/en/note?os=CentOS_6&p=munin&f=1

Also Install Munin agent to monitor Munin server itself.

# install from EPEL

[root@dlp ~]# yum --enablerepo=epel -y install munin munin-node

[3]

Configure Munin.

[root@dlp ~]# vi /etc/munin/munin.conf

# line 98: change to your own hostname

[dlp.server.world]

    address 127.0.0.1

    use_node_name yes

[root@dlp ~]# vi /etc/httpd/conf.d/munin.conf

# near line 17: add access permission

Order Deny,Allow

Deny from all

Allow from 127.0.0.1 10.0.0.0/24

[root@dlp ~]# /etc/rc.d/init.d/httpd restart 

Stopping httpd:[ OK ]

Starting httpd:[ OK ]

# add a user ( create a new file with "-c" ⇒ only add "-c" at the first time. )

[root@dlp ~]# htpasswd -c /etc/munin/munin-htpasswd cent 

New password: # set password

Re-type new password: 

Adding password for user cent

[4]

Configure Munin node as a monitoring target.

[root@dlp ~]# vi /etc/munin/munin-node.conf

# line 37: change to your own hostname

host_name dlp.server.world

[root@dlp ~]# /etc/rc.d/init.d/munin-node start 

Starting Munin Node:[ OK ]

[root@dlp ~]# chkconfig munin-node on

[5]

Access to the "http://(Munin server's hostname or IP address)/munin/" from a client which is in the network allowed in config. Then, authentication is required, input a username and password you set in [3] and proceed next.

[6]

After sucessing authentication, the index page is displayed. It's possible to see graphs to click a hostname.

______________XXXXXXXXXXXXXXXX_____________________XXXXXXXXXXXXXXXXXX__________________________XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Install Monitorix which is a light weight system monitoring tool.

# yum install rrdtool rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite perl-CGI perl-DBI perl-XML-Simple perl-Config-General perl-HTTP-Server-Simple perl-IO-Socket-SSL

---------------cccccccccccccccccccccc

Monitorix Installation (Centos 6.7)

1. Disable IPtables and SELinux or Allow rules and update policy if you are using

2. Enable EPEL Repo and Centos 6.7 local repository

3. Install required packages (These package will be installed automatically as dependency package for monitorix)

yum install rrdtool perl rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite perl-CGI perl-DBI perl-XML-Simple perl-Config-General  perl-HTTP-Server-Simple perl-IO-Socket-SSL

4. Download the latest monitorix version  from http://www.monitorix.org/downloads.html

wget http://www.monitorix.org/monitorix-3.8.1-1.noarch.rpm

5. Install monitorix RPM –>  yum install monitorix-3.8.1-1.noarch.rpm

6. cp /etc/monitorix/monitorix.conf /etc/monitorix/monitorix.conf.orig

7. vim /etc/monitorix/monitorix.conf

title = Linuxraja Montoring

hostname = mysqlm.linuxraja.com

….

….

<httpd_builtin>

enabled = y

host = mysqlm.linuxraja.com

port = 8080

user = nobody

group = nobody

log_file = /var/log/monitorix-httpd

hosts_deny =

hosts_allow =

<auth>

enabled = y

msg = Monitorix: Restricted access

htpasswd = /var/lib/monitorix/htpasswd

</auth>

</httpd_builtin>

# In the graph enable session enable the required services, now we just enable apache

<graph_enable>

system          = y

kern            = y

proc            = y

hptemp          = n

lmsens          = n

nvidia          = n

disk            = n

fs              = y

zfs             = n

du              = n

net             = y

netstat         = y

libvirt         = n

process         = n

serv            = y

mail            = y

port            = y

user            = y

ftp             = n

apache          = y

nginx           = n

lighttpd        = n

mysql           = n

varnish         = n

pagespeed       = n

squid           = n

nfss            = n

nfsc            = n

bind            = n

ntp             = n

fail2ban        = n

icecast         = n

raspberrypi     = n

phpapc          = n

memcached       = n

apcupsd         = n

nut             = n

wowza           = n

int             = y

verlihub        = n

</graph_enable>

8. /etc/init.d/monitorix start

9. Create http user and password (Note : htpasswd will not be available with monitorix package, So you need to install httpd-tools RPM to use that)

htpasswd -d /var/lib/monitorix/htpasswd admin

htpasswd -c /var/lib/monitorix/htpasswd admin

provide password

10. http://192.168.1.146:8080/monitorix   (provide user and password)

To Add other production servers to the main Monitorix server

1. Other Server : Repeat all the above steps except step 9 & 10

2. Monitorix Server (mysqlm.linuxraja.com)  – vim /etc/monitorix/monitorix.conf

# Enable multihost

# Multihost

# —————————————————————————–

<multihost>

enabled = y

footer_url = y

graphs_per_row = 2

remotehost_list = server 1, server 2, server 3

<remotehost_desc>

0 = http://192.168.1.147:8080,/,/

1 = http://192.168.1.148:8080,/,/

2 = http://192.168.1.149:8080,/,/

</remotehost_desc>

groups = n

remotegroup_list = My Group

<remotegroup_desc>

0 = server 2, server 3

</remotegroup_desc>

</multihost>

3. Restart monitorix service  /etc/init.d/monitorix start

4. Now go to http://192.168.1.146:8080/monitorix (Select the new added servers and monitor)

-------------------------------------------

Install Monitorix.

# install from EPEL

[root@dlp ~]# yum --enablerepo=epel -y install monitorix

[2]

Configure Monitorix.

[root@dlp ~]# vi /etc/monitorix/monitorix.conf

# line 6: change to any title you like

title = Monitorix

# line 7: change to your own hostname

hostname = dlp.server.world

# line 8: backgroud color of admin site

theme_color = white

# line 12: change network units to bps (default is Bytes per/sec)

netstats_in_bps = y

<httpd_builtin>

    enabled = y

    host =

    port = 8080

    user = nobody

    group = nobody

    log_file = /var/log/monitorix-httpd

    # set permittion for admin site

    hosts_deny = all

    hosts_allow = 10.0.0.0/24

# line 330: change  mta = sendmail   (postfix)

 mta = postfix

[root@dlp ~]# /etc/rc.d/init.d/monitorix start 

[ OK ] monitorix: [ OK ]

[root@dlp ~]# chkconfig monitorix on

[3]

Access to the "http://(Monitorix server's hostname or IP address):8080/monitorix/" from a client which is in the network allowed in config. Then, Monitorix admin site is displayed like follows. Click "OK" to see graphs.

[4]

Graphs are displayed.

http://www.monitorix.org/documentation.html#23

Step: 4. Install EPEL Repository :

# yum -y install epel-release

Step: 5. Install Apache Server :

# yum -y install httpd httpd-devel

Step: 6. Install  the Required Packages :

# yum -y install rrdtool perl rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite \

   perl-CGI perl-DBI  perl-XML-Simple perl-Config-General perl-HTTP-Server-Simple \

   perl-IO-Socket-SSL wget

Step: 7. Download & Install the Monitorix Package :

# cd /mnt

# wget http://www.monitorix.org/monitorix-3.8.1-1.noarch.rpm

# yum -y install monitorix-3.8.1-1.noarch.rpm

Step: 8. Start Apache & Monitorix Service :

# service httpd restart

# service monitorix start

# chkconfig httpd on

# chkconfig monitorix on

Step: 9. Edit the Monitorix Configure file :

# vi /etc/httpd/conf.d/monitorix.conf

Alias /monitorix /usr/share/monitorix

ScriptAlias /monitorix-cgi /usr/share/monitorix/cgi-bin

<Directory /usr/share/monitorix/cgi/>

DirectoryIndex monitorix.cgi

Options ExecCGI

order deny,allow

deny from all

allow from all       # Alllow connect from the outside

</Directory>

# Apache rules to restrict access to Monitorix:

# Don’t forget to add <username> in .htpasswd with the 'htpasswd' command.

# Uncomment these lines

<Directory "/usr/share/monitorix">

Options Indexes Includes FollowSymLinks

Order Deny,Allow

Deny from All

allow from all        # Alllow connect from the outside

AllowOverride None

AuthUserFile /etc/httpd/conf/.htpasswd

AuthGroupFile /dev/null

AuthName "Monitorix: Restricted Access..., sorry."

AuthType Basic

Require user <username>

Satisfy Any

</Directory>

-- Save & Quit (:wq)

Step: 10. Set Password For Monitorix Web Panel :

# htpasswd -cm /etc/httpd/conf/.htpasswd monitoradmin

Enter the Password: Password@123

Step: 11. Retart the Apache Service :

# service httpd restart

Step: 12. Connect Monitorix via Web Browser :

http://10.100.100.100/monitorix

User: monitoradmin

Pass: Password@123

-------

Enabling Basic Authentication

It is strongly recommended that you use basic authentication to secure Monitorix data from everyone. To use basic authentication find the following lines in the configuration file /etc/monitorix/monitorix.conf.

           enabled = y             host =             port = 8080             user = nobody             group = nobody             log_file = /var/log/monitorix-httpd             hosts_deny =             hosts_allow =enabled = n                     msg = Monitorix: Restricted access                     htpasswd = /var/lib/monitorix/htpasswd

Change enabled = n to enabled = y to enable basic authentication with password file. You can also remove the hosts_deny = and hosts_allow = with no values to allow access to the webpage to everyone. The page will still be protected with basic authentication. You can also modify the msg value to a more personalized text if you like. The message will be shown to the user in authentication dialog box.

Now you will need to initialize the password file. First of all you will need to install httpd-tools, which comes with a tool htpasswd which we will use to create an encrypted password file. Run the following command to install httpd-tools.

   yum -y install httpd-tools

Now use htpasswd tool to create a password file and add the user admin using the following command.

   htpasswd -d -c /var/lib/monitorix/htpasswd admin

The above command will create a new password file and will ask for the password twice and will add the user and the password into the file. You can use any username in place of admin.

   [root@ip-172-31-11-153 ~]# htpasswd -d -c /var/lib/monitorix/htpasswd admin     New password:     Re-type new password:     Adding password for user admin

Once done restart the Monitorix service using the following command.

   systemctl restart monitorix

Now when you will try to access the graphs page, you will be greeted with a dialog box to provide th

91