Install MRTG (Multi Router Traffic Grapher) to see network traffic data on the web
Step 1:Install Apache HTTP Server
# yum -y install httpd httpd-develStep 2:Install MRTG, SNMP
# yum -y install net-snmp net-snmp-utils mrtgStep 3: Configure SNMP (Simple Network Management Protocol)
# vi /etc/snmp/snmpd.conf# line 41: comment out
#com2sec notConfigUser default public
# line 74,75: uncomment and change
# change to your local network for "mynetwork" section
# change comunity name except public or private
com2sec local localhostServerworld
com2sec mynetwork 10.0.0.0/24Serverworld
# line 78,79: uncomment
group MyRWGroup any local
group MyROGroup any mynetwork
# line 85: uncomment
view all included .1 80
# line 93,94: uncomment
access MyROGroup "" any noauth 0 all none none
access MyRWGroup "" any noauth 0 all all all
--- save and quit (:wq) ---
Then start the snmp service:
# service snmpd start# chkconfig snmpd on
## show status (replace the "Serverworld" to your comunity name)
# snmpwalk -v2c -c Serverworld localhost system
SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.server.world 2.6.32-504.3.3.el6.x86_64 #1 SMP
Wed Dec 17 01:55:02 UTC 2014 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (168142) 0:28:01.42
...
...
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (4) 0:00:00.04
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (4) 0:00:00.04
Step 4: Configure MRTG
# cfgmaker --ifref=descr --ifdesc=descr Serverworld@10.0.0.30 > /etc/mrtg/mrtg.cfg# vi /etc/mrtg/mrtg.cfg
# line 9: add
WorkDir: /var/www/mrtg
# line 16: uncomment
Options[_]: growright, bits
# near line 73: make sure lines like follows are uncommented (change ip as your and
'Serverworld' as your community name)
Target[10.0.0.30_eth0]: \eth0:Serverworld@192.168.100.156:
SetEnv[10.0.0.30_eth0]: MRTG_INT_IP="10.0.0.30" MRTG_INT_DESCR="eth0"
MaxBytes[10.0.0.30_eth0]: 125000000
Title[10.0.0.30_eth0]: eth0 -- dlp.server.world
PageTop[10.0.0.30_eth0]: <h1>eth0 -- dlp.server.world</h1>
## execute mrtg 3 times (display warnings until 3 times)
# for (( i=1 ; i <= 3 ; i++ )); do env LANG=C mrtg /etc/mrtg/mrtg.cfg; done
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup could not read the primary log file for
10.0.0.30_eth0
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup The backup log file for 10.0.0.30_eth0
was invalid as well
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup Can't remove 10.0.0.30_eth0.old updating
log file
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup Can't rename 10.0.0.30_eth0.log to
10.0.0.30_eth0.old updating log file
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup Can't remove 10.0.0.30_eth0.old updating
log file
## generate index file
# indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
# updating is done automatically by cron
# cat /etc/cron.d/mrtg
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file
/var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
Step 5: Configure httpd to access MRTG
# vi /etc/httpd/conf.d/mrtg.conf# line 11: add IP address you allow to access
Allow from 127.0.0.1 10.0.0.0/24
##restart httpd:
# /etc/rc.d/init.d/httpd restart
or
# service httpd restart
Step 6: Access to the MRTG Panel from a client with HTTP
http://(MRTG hostname or IP address)/mrtg/then it's possible to see MRTG site.
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.