Derwynd's Weblog

Derwynd's Weblog

MRTG HowTo

$ yum install net-snmp-utils net-snmp net-snmp-libs

SNMP
======

$ vi /etc/snmp/snmpd.conf
———————————————————————–
com2sec local     localhost           public
com2sec mynetwork <ip>/class          public

group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

view all    included  .1                               80

access MyROGroup “”      any       noauth    exact  all    none   none
access MyRWGroup “”      any       noauth    exact  all    all    none

syslocation Linux (Hostname), hostname.
syscontact name <emailid>
———————————————————————–

$ service snmpd start
$ chkconfig –add snmpd

Test via
$ snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
———————————————————————–
IP-MIB::ipAdEntIfIndex.10.0.0.2 = INTEGER: 3
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.203.201.253.231 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.203.201.253.233 = INTEGER: 2
———————————————————————–

MRTG
======
$ yum install mrtg
$ mkdir -p /var/www/mrtg

create mrtg configuration file:
$ cfgmaker –global ‘WorkDir: /var/www/mrtg’ –output /etc/mrtg/mymrtg.cfg public@localhost

Create default index page for your MRTG configuration:
$ indexmaker –output=/var/www/mrtg/index.html /etc/mrtg/mymrtg.cfg

Run mrtg command from command line with your configuration file:
Run this 3 times ignoring errors

$ env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg

Add to crontab

*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg

HTTP
======

/etc/httpd/conf.d/mrtg.conf

Allow from 127.0.0.1 <your ip>

/etc/init.d/httpd restart

Advertisements

January 14, 2009 - Posted by | Uncategorized

Sorry, the comment form is closed at this time.

%d bloggers like this: