From: John Cameron Date: Thu, 1 Dec 2011 11:12:00 +0200 Subject: MRTG init script RHEL/CENTOS/FEDORA # MRTG Config on RHEL/CENTOS/FEDORA # Install SNMP & Config for Localhost yum install net-snmp mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak echo "com2sec local1 localhost/32 local1_community group MyROGroup1 v1 local1 view all included .1 80 access MyROGroup1 \"\" v1 noauth exact all none none" >> /etc/snmp/snmpd.conf chkconfig snmpd on service snmpd restart # Install Default MRTG package and remove Cron based graphing yum install mrtg rm -f /etc/cron.d/mrtg rm -f /var/www/mrtg/* mkdir -p /var/log/mrtg # Install Supplied SysV Init Script for Deamon based graphing mv mrtg /etc/init.d/mrtg chmod 755 /etc/init.d/mrtg chkconfig --add mrtg # For Less than 5 minutes interval logs use RRD yum install rrdtool rrdtool-perl perl-CGI mkdir -p /var/www/cgi-bin/mrtg wget ftp://ftp.linux.cz/pub/linux/people/jan_kasprzak/mrtg-rrd/mrtg-rrd-0.7.tar.gz tar -zxvf mrtg-rrd-0.7.tar.gz mv mrtg-rrd.cgi /var/www/cgi-bin/mrtg/mrtg-rrd.cgi chmod 755 /var/www/cgi-bin/mrtg/mrtg-rrd.cgi chown apache.apache /var/www/mrtg echo "" > /var/www/mrtg/index.php # Add Basic MRTG Config echo "RunAsDaemon: Yes LogFormat: rrdtool Interval: 1 HtmlDir: /var/www/mrtg ImageDir: /var/www/mrtg LogDir: /var/log/mrtg ThreshDir: /var/log/mrtg Options[_]: bits,growright,nolegend,nobanner" > /etc/mrtg/mrtg.cfg # Add Lan Interface echo "Target[localhost_eth0]: \\eth0:local1_community@localhost: SetEnv[localhost_eth0]: MRTG_INT_IP=\"192.168.2.1\" MRTG_INT_DESCR=\"eth0\" MaxBytes[localhost_eth0]: 15200000 Title[localhost_eth0]: Traffic Analysis for $INTERFACE -- PageTop[localhost_eth0]: