MRTG Installation and Configuration steps on Centos / Redhat

MRTG: Mutli Router Traffic Grapher, It is nothing but the network traffic Monitoring over snmp protocol. Written in Perl works on  Windows &  Linux platforms. MRTG is a free software package under the GNU GPL. MRTG helps us to monitor snmp enabled devices like (router, Switches or any snmp enabled).

MRTG installation and configuration guide have prepared for following platform.

Windows Client IP      :

OS                      : Centos 6.5

SNMP community       : solutions@ (Read only)

Dependency packages : snmp,mrtg & httpd

MRTG Installation and Configuration steps on Centos / Redhat

Step 1:  Download, install snmp RPM packages

Step 2:  Configure SNMP

Step 3:  Configure MRTG

Let us see the Steps in Details:

Step 1:  Download and install snmp RPM packages

1.1  Install MRTG packages and dependencies from the repository

The command to install packages using yum repository

[root@experts ~] # yum install net-snmp net-snmp-utils mrtg httpd

Step 2:  Configure SNMP

2.1 In our case we are using localhost to monitor and merge tool deployment.

Edit snmpd. conf file to add a community string in order to allow localhost. Go to the last line of the config file and add below lines.

[root@experts ~]# vi /etc/snmp/snmpd.conf

com2sec local     localhost           solutions@

group MyRWGroup v1         local

group MyRWGroup v2c        local

group MyRWGroup usm        local

view all    included  .1                               80

access MyRWGroup “”      any       noauth    exact  all  all    none

pass . /usr/bin/ucd5820stat

Save & Exit(:wq!)

2.2 Restart the snmp service using below command and set the service on boot level

[root@experts ~]# chkconfig snmpd on

[root@experts ~]# service snmpd restart

2.3 Verify SNMP configuration and connection.

[root@experts ~]#  snmpwalk -v 1 -c solutions@ localhost IP-MIB::ipAdEntIfIndex


IP-MIB::ipAdEntIfIndex. = INTEGER: 1

IP-MIB::ipAdEntIfIndex. = INTEGER: 2

[root@experts ~]# snmpwalk -v 1 -c solutions@ IP-MIB::ipAdEntIfIndex

IP-MIB::ipAdEntIfIndex. = INTEGER: 1

IP-MIB::ipAdEntIfIndex. = INTEGER: 2

Step 3:  Configure MRTG

3.1 Create a configuration file for localhost

[root@experts ~]# cfgmaker --global 'WorkDir: /var/www/mrtg' --output /etc/mrtg/mrtg.cfg solutions@@localhost

Note: Go on for each client with above step

3.2  Next, create index make to add new client html web page, the default location for web pages “/var/www/mrtg”.

[root@experts ~]#indexmaker  –output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

3.3  Modify /etc/httpd/conf.d/mrtg to allow from any of the client machines in your network.

[root@experts ~]# vi /etc/httpd/conf.d/mrtg.conf

Alias /mrtg /var/www/mrtg

<Location /mrtg>

Order deny,allow

Deny from all

Allow from

Allow from all

# Allow from


Save & Exit(:wq!)

[root@experts ~]# service httpd restart

3.4  Apply cron job schedule, keep the frequency 1 min as indicated below.

[root@experts ~]#crontab -e

*/1 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

3.5  Restart crond service and invoke mrtg URL

[root@experts ~]# service crond restart

[root@experts ~]# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

From the browser invoke following URL :



For more detail you can watch Video :

Leave a Reply

Your email address will not be published. Required fields are marked *

− 1 = 1