Wednesday, February 18, 2009

Making MTRG Agent on Fedora Linux System

MRTG is one of few tools to monitor your network traffic or your computer activities. MRTG is a X-Y graphic as function of time vs baud rate or speed in Byte per second. In this tutorial, suppose you had MRTG Server. I just want to set up MRTG Agent only on my computer based on distro Fedora 9.

Follow these steps :

1. Edit MRTG Agent configuration file and then restart the application.
# mcedit /etc/snmp/snmpd.conf
# /etc/rc.d/init.d/snmpd restart


2. Test your snmpd have run or not. These testing can be done from local (MRTG Agent) or remote machine (MRTG Server).
# snmpget -v 1 -c public 202.46.3.114 1.3.6.1.2.1.1.1.0
# snmpwalk -v 1 -c public 202.46.3.114 system
# snmpwalk -v 1 -c public 202.46.3.114 IP-MIB::ipAdEntIfIndex
Another testing :
# nmap 202.46.3.114
# iptables --list

3. Create configuration file on MRTG Server
# cfgmaker public@202.46.3.114 > psjumat2.cfg
or
# cfgmaker --global "workdir: /opt/lampp/htdocs/mrtg" -ifref=ip --output /etc/mrtg/psjumat2.cfg --global 'options[_]: growright,bits' public@202.46.3.114

4. Create HTML file.
# indexmaker --output=/opt/lampp/htdocs/mrtg/psjumat2.html /etc/mrtg/psjumat2.cfg
Actually, you can change psjumat2.html become index.html

5. Create mechanism to get data from MTRG Agent with automatically.
# mrtg -c /etc/mrtg/psjumat2.cfg
or
# env LANG=C /usr/bin/mrtg /etc/mrtg/psjumat2.cfg

6. To make your SNMPD automatically run every Start-up of your computer, please add a command line to /etc/rc.local :
# echo "/usr/sbin/snmpd -c /etc/snmp/snmpd.conf" >> /etc/rc.local

7. Create mechanism to get data from MRTG Agent periodically, such as every 5 minutes. To do this, you must add new line at the end of /etc/cron.d/mrtg file like this :
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/psjumat2.cfg

by.msmunir@batan.go.id

No comments:

Post a Comment