MRTG : Install2015/01/25 |
Install MRTG (Multi Router Traffic Grapher) to see network traffic data on the web.
|
|
[1] | |
[2] | Install MRTG, SNMP. |
[root@dlp ~]# yum -y install net-snmp net-snmp-utils mrtg
|
[3] | Configure SNMP (Simple Network Management Protocol). |
[root@dlp ~]#
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 localhost Serverworld com2sec mynetwork 10.0.0.0/24 Serverworld # 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 # show status (replace the "Serverworld" to your comunity name) [root@dlp ~]# snmpwalk -v2c -c Serverworld localhost system SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.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 |
[4] | Configure MRTG. |
[root@dlp ~]# cfgmaker --ifref=descr --ifdesc=descr Serverworld@10.0.0.30 > /etc/mrtg/mrtg.cfg
[root@dlp ~]#
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 Target[10.0.0.30_eth0]: \eth0:Serverworld@10.0.0.30: 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.srv.world PageTop[10.0.0.30_eth0]: <h1>eth0 -- dlp.srv.world</h1> # execute mrtg 3 times (display warnings until 3 times) [root@dlp ~]# 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 [root@dlp ~]# indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
# updating is done automatically by cron [root@dlp ~]# 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 |
[5] | Configure httpd to access MRTG. |
[root@dlp ~]#
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
/etc/rc.d/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] |
[6] | Access to the "http://(MRTG hostname or IP address)/mrtg/" from a client with HTTP, then it's possible to see MRTG site. |
Sponsored Link |