Monitoring Multiple Host Using MRTG
[root@REMASTER63]# yum install mrtg net-snmp net-snmp-utils
[root@REMASTER63 mrtg]# vim /etc/snmp/snmpd.conf
rocommunity ipbx
syslocation intelix-cc
syscontact moses <mustafa@intelix.co.id>
## sec.name source community
## ======== ====== =========
com2sec local localhost ipbx
com2sec network_2 192.168.0.0/24 ipbx
## Access.group.name sec.model sec.name
## ================= ========= ========
group MyROGroup_1 v1 local
group MyROGroup_1 v1 network_1
group MyROGroup_2 v2c network_2
## MIB.view.name incl/excl MIB.subtree mask
## ============== ========= =========== ====
view all-mibs included .1 80
## MIB
## group.name context sec.model sec.level prefix read write notif
## ========== ======= ========= ========= ====== ==== ===== =====
access MyROGroup_1 “” v1 noauth exact all-mibs none none
access MyROGroup_2 “” v2c noauth exact all-mibs none none
[root@REMASTER63 mrtg]# /etc/init.d/snmpd restart
Stopping snmpd: [ OK ]
Starting snmpd: [ OK ]
[root@REMASTER63 etc]# vim /etc/mrtg/mrtg.cfg
HtmlDir: /var/www/html/mrtg
ImageDir: /var/www/html/mrtg
LogDir: /var/lib/mrtg
ThreshDir: /var/lib/mrtg
#Agar uptodate setiap 5 menit
Interval:5
#Agar auto resfresh pada browser
Refresh:300
[root@REMASTER63 mrtg]# snmpwalk -v 1 -c ipbx 192.168.0.121 IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.0.121 = INTEGER: 2
[root@REMASTER63]# mkdir -p /var/www/html/mrtg && chown -R apache.apache /var/www/html/mrtg
[root@REMASTER63]# cfgmaker –global ‘WorkDir: /var/www/html/mrtg’ –output /etc/mrtg/mrtg-192.168.0.121.cfg ipbx@192.168.0.121
[root@REMASTER63]# cfgmaker –global ‘WorkDir: /var/www/html/mrtg’ –output /etc/mrtg/mrtg-192.168.0.198.cfg ipbx@192.168.0.198
[root@REMASTER63]# cfgmaker –global ‘WorkDir: /var/www/html/mrtg’ –output /etc/mrtg/mrtg-192.168.0.240.cfg ipbx@192.168.0.240
[root@REMASTER63]# crontab -l
*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg-localhost.cfg
*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg-192.168.0.198.cfg
*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg-192.168.0.240.cfg
[root@REMASTER63 mrtg]# indexmaker –output=/var/www/html/mrtg/index.html \
/etc/mrtg/mrtg-192.168.0.198.cfg \
/etc/mrtg/mrtg.cfg \
/etc/mrtg/mrtg-localhost.cfg \
/etc/mrtg/mrtg-192.168.0.240.cfg