Install MRTG pada Centos 6

Written by BiRU Wednesday, 15 April 2015 16:44

Print

MRTG : Multi Router Traffic Graph adalah suatu program yang digunakan untuk mengumpulkan informasi-informasi
SNMP dari beberapa router, diolah datanya menjadi log-log dan ditampilkan dalam bentuk grafik. Fungsinya untuk mengetahui utilitas dari interface yang anda gunakan pada server anda. Berdasarkan infonya :
Name       : mrtg
Summary    : Multi Router Traffic Grapher
URL        : http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/
Description: 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.

MIBs & OIDs : Dibutuhkan oleh MRTG untuk mengambil informasi dari interface yang akan anda monitor (misal ethernet car/NIC). Kita akan mengkonfigurasi MRTG secara otoma
Paket yang dibutuhkan MRTG : Webserver, SNMP agen. Web karena dia membutuhkan tempat untuk menampilkan, sedangkan agent, untuk menangkap paketnya. Konfigurasi Cara instalasinya :
1. Download paket :
# yum install net-snmp net-snmp-utils net-snmp-devel zlib libpng gd mrtg
Paket MRTG package akan create config file, crontab file, and Apache config di :
/etc/mrtg/mrtg.cfg
/etc/cron.d/mrtg
/etc/httpd/conf.d/mrtg.conf


2. Setting Konfigurasi snmpd di /etc/snmpd/snmpd.conf
# vi /etc/snmpd/snmpd.conf
Update Konfigurasi dengan :
com2sec local localhost public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
view all included .1 80
access MyRWGroup "" any noauth exact all all none
syslocation Jakarta Indonesia
syscontact Root

3. Save filenya, restart snmpd (untuk mengaktifkan agen):
# chkconfig snmpd on
# service snmpd restart


4. Chek interface/NIC anda di kenali oleh snmpd agen berdasarkan nama MIBs & OIDs nya.
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
biasanya outputnya akan seperti ini jika terdeteksi :
IP-MIB::ipAdEntIfIndex.123.xx.yy.zzz = INTEGER: 2
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1


5. Configure The MRTG
cfgmaker untuk membuat konfigurasi secara otomatis berdasarkan MIB yang telah dikenali, dan file yang di create berada pada  /etc/mrtg/mrtg.cfg
# cfgmaker --global 'WorkDir: /var/www/mrtg' --output /etc/mrtg/mrtg.cfg public@localhost
+global 'WorkDir: /var/www/mrtg' : add global config entries i.e. set workdir to store MRTG graphs.
+output /etc/mrtg/mrtg.cfg: configr output filename
public@localhost : public is the community name of the device you want to create a configuration for. If you are using the wrong community name you will get no response from the device. localhost is the DNS name or the IP number of an SNMP-managable device i.e. our local server
.


6. Kita jalankan indexmaker untuk membuat halaman web otomatis dari interface
# indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

7. Cek Cron Tab
/etc/cron.d/mrtg menjalankan command mrtg unttuk memonitor traffic load pada links:
# cat /etc/cron.d/mrtg
Sample Output:
*/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
Yakinkan jika crond sudah berjalan:
# chkconfig --list crond
Jika off pada run level # 3, jalankan crond service:
# chkconfig crond on
# service crond on


8./etc/httpd/conf.d/mrtg.conf - Apache Configuration
secara default MRTG hanya memperlihatkan alamat localhost. jika ingin melihat MRTG pada mesin lain ganti konfigurasi apachenya, edit konfigurasi pada /etc/httpd/conf.d/mrtg.conf

Alias /mrtg /var/www/mrtg
#
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# Allow from ::1
# # Allow from .example.com
#


Restart Apache
# service httpd restart

9. Bagaimana melihat MRTG
http://your-ip.add.ress/mrtg/

selamat anda sudah bisa mengkonfigure MRTG.