MRTG installation on Centos 7
MRTG
The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network links. MRTG generates HTML pages containing PNG images which provide a LIVE visual representation of this traffic. Let’s see how to configure in the Linux platform, you can use these steps in any Linux distributions.
Step1. Install the Apache.
yum -y install httpd
service httpd restart
Step2. Install MRTG through YUM
yum -y install net-snmp mrtg net-snmp-utils
Step3. Configure SNMP
vim /etc/snmp/snmpd.conf mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_original cd /etc/snmp/ vim snmpd.conf rocommunity public syslocation "location of your DC" syscontact your contact mail
Save the configuration
Step4.Restart the service
service snmpd start
Step5. Show status
snmpwalk -v2c -c public localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux server 2.6.32-573.7.1.el6.x86_64 #1 SMP Tue Sep 22 22:00:00 UTC 2015 x86_64 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (4635145) 12:52:31.45 SNMPv2-MIB::sysContact.0 = STRING: [email protected] SNMPv2-MIB::sysName.0 = STRING: server SNMPv2-MIB::sysLocation.0 = STRING: "Strad Datacenter" SNMPv2-MIB::sysORLastChange.0 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1 SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching. SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching. 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::sysORUpTime.1 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.2 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.3 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.4 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.5 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.6 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.7 = Timeticks: (4) 0:00:00.04 SNMPv2-MIB::sysORUpTime.8 = Timeticks: (4) 0:00:00.04
Once done then configure the MRTG configure
Step6. Include your server IP on cfgmaker
cfgmaker --snmp-options=:::::2 --ifref=descr --ifdesc=descr --global 'WorkDir: /var/www/html/mymrtg' [email protected] > /etc/mrtg/mrtg.cfg
Step7. Create the index file
cd /var/www/html/ mkdir mymrtg indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/html/mymrtg/index.html
Step8. Configure mrtg.conf
vim /etc/httpd/conf.d/mrtg.conf Just only add the Alias and remove the remaining entries. Alias /mrtg /var/www/html/mymrtg
Step9 . Restart the service
service httpd restart service snmpd restart That's all it done.
Check the MRTG via browser your serverIP/mymrtg
Step10. Protecting your MRTG page
Create a password htpasswd -c /var/www/html/.htpasswd user1. vim /etc/httpd/conf.d/mrtg.conf Add the allowoverride all <directory "/var/www/html/mymrtg"> allowoverride all </directory> Save the file. Create a .htaccess file vim /var/www/html/mymrtg/.htaccess AuthType Basic AuthUserFile /var/www/html/.htpasswd AuthName "user1" Require valid-user
Step11. Restart the services
service httpd restart service snmpd restart
Check now………..Thats all …………………!!!
Good, this is what I was looking for in yahoo