MRTG installation on Centos 7 , RHEL 7 , Fedora and Linux

Install MRTG  on CentOs , RHEL , Fedora and Linux 

STEP 1 :  Click here to install EPEL Repository for CentOs 7 , RHEL 7 

STEP 2 :  Install Apache web server.

Here we are creating basis installation  of apache web server.

#yum -y install httpd

Start the apache web service.

#systemctl start httpd.service

Enable service on auto boot

#systemctl enable httpd.service

STEP 3 :  Install through YUM

Below command is for and snmp installation  utility and dependency .

# yum -y install net-snmp  net-snmp-utils

STEP 4 : Configure SNMP 

For monitor network interface and other resources like CPU , memory , we should configure snmpd “/etc/snmp/snmpd.conf” .

STEP 5 : Edit the configuration file.

# vim /etc/snmp/snmpd.conf

Now make change as i have describe below.

(a) comment the line with hash on line number 41 like below.

# com2sec notConfigUser default public

(b) uncomment  the line number 74,75  ,remove NETWORK/24 and replace with your network.

Before changes

#com2sec local localhost COMMUNITY
#com2sec mynetwork NETWORK/24 COMMUNITY
After Changes 
com2sec local localhost techtransit
com2sec mynetwork techtransit

(c) un comment  the line 78,79 . Replace techtransit from your any word.

group MyRWGroup v2c local
group MyROGroup v2c mynetwork

(d) uncomment the line 85 .

view all included  .1  80

(f) uncomment the line 93,94 . Replace techtransit from your name.

access MyROGroup "" v2c noauth 0 all none none
access MyRWGroup "" v2c noauth 0 all all all

STEP 6 : Start the snmpd service and enable from autoboot .

#systemctl start snmpd.service

#systemctl enable snmpd.service

STEP 7 :

# show status (replace the “techtransit” to your comunity name)


[[email protected] ~]# snmpwalk -v2c -c techtransit localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Sep 15 15:05:51 UTC 2015 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (8004) 0:01:20.04
SNMPv2-MIB::sysContact.0 = STRING: Root <[email protected]> (configure /etc/snmp/snmp.local.conf)
SNMPv2-MIB::sysName.0 = STRING:
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.9 = OID: SNMP-NOTIFICATION-MIB::snmpNotifyFullCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.9 = STRING: The MIB modules for managing SNMP Notification, plus filtering.
SNMPv2-MIB::sysORDescr.10 = STRING: The MIB module for logging SNMP Notifications.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (2) 0:00:00.02

Creating Configuration :

Now we will create a configuration file for data storage, run the command below and output will redirect in the mrtg configuration file.Replace your community name and ip of your server.You can also change WorkDir .

[[email protected] ~]#cfgmaker --snmp-options=:::::2 --ifref=descr --ifdesc=descr --global 'WorkDir: /var/www/html/mymrtg' [email protected] > /etc//mrtg.cfg

If you want the graph data in bits instead of bytes , uncomment the below lines from /etc//mrtg.cfg configuration file.

#vim /etc//mrtg.cfg

Options[_]: growright, bits

Uncomment the below line , which should on line 75  and save and exit from the configuraiton file.

Target[]: \eth0:[email protected]:::::2
noHC[]: yes
SetEnv[]: MRTG_INT_IP="" MRTG_INT_DESCR="eth0"
MaxBytes[]: 250000000
Title[]: eth0 --
PageTop[]: <h1>eth0 --</h1>


Create Index File on document root through below command.
indexmaker --columns=1 /etc//mrtg.cfg > /var/www/html/mymrtg/index.html

Now MRTG Configure on apache configuration file.

Edit the mrtg apache configuration file.

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

Edit the file like below , change the ip with your ip .

Alias /mrtg /var/www/html/mymrtg

<Location /var/www/html/mymrtg>
Require local
Require ip
# Require host

Start Apache :

#systemctl start httpd.service

Now  configuration of mrtg has been done and access URL for MRTG Graph will be like below.

http://server-hostname or IP Address/mymrtg

Thank you 🙂

About Sachin Gupta

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks!

Have any Question or Comment?

One comment on “MRTG installation on Centos 7 , RHEL 7 , Fedora and Linux


Excellent, thank you for the content. I was looking for such guide for a long time.


Leave a Reply

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.