MRTG のインストールから設定まで

設定内容の変更はのちほど記載。

# yum -y install net-snmp.i386
# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
# chmod 0600 /etc/snmp/snmpd.conf
# /etc/rc.d/init.d/snmpd start
Starting snmpd:                                            [  OK  ]
# ps aux | grep snmp | grep -v grep
root      2455  1.0  0.1  25888  5064 ?        Sl   12:17   0:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a
# chkconfig --list snmpd
snmpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
# chkconfig snmpd on
# chkconfig --list snmpd
snmpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
# yum -y install mrtg.i386
# ls -l /etc/mrtg/mrtg.cfg
-rw-r--r-- 1 root root 820 Jan 10  2007 /etc/mrtg/mrtg.cfg
# cp /etc/mrtg/mrtg.cfg /etc/mrtg/mrtg.cfg.orig
# /usr/bin/cfgmaker --ifref=descr --ifdesc=descr public@192.168.0.31 > /etc/mrtg/mrtg.cfg
# vi /etc/mrtg/mrtg.cfg
# mkdir ~/mrtg
# vi ~/mrtg/mrtg.sh
# cat ~/mrtg/mrtg.sh

#!/bin/bash

LOCK=/var/lock/mrtg/mrtg_l
CONFCACHE=/var/lib/mrtg/mrtg.ok

export LANG=ja_JP.eucJP
mrtg /etc/mrtg/mrtg.cfg --lock-file $LOCK --confcache-file $CONFCACHE

# chmod u+x ~/mrtg/mrtg.sh
# cd ~/mrtg/
# ./mrtg.sh
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup could not read the primary log file for cpu
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup The backup log file for cpu was invalid as well
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup Can't remove cpu.old updating log file
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup Can't rename cpu.log to cpu.old updating log file
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup could not read the primary log file for mem
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup The backup log file for mem was invalid as well
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup Can't remove mem.old updating log file
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup Can't rename mem.log to mem.old updating log file
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup could not read the primary log file for disk
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup The backup log file for disk was invalid as well
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup Can't remove disk.old updating log file
30-04-2008 13:12:38, Rateup WARNING: /usr/bin/rateup Can't rename disk.log to disk.old updating log file
30-04-2008 13:12:39, Rateup WARNING: /usr/bin/rateup Can't remove eth0.old updating log file
# ./mrtg.sh
30-04-2008 13:14:27, Rateup WARNING: /usr/bin/rateup Can't remove cpu.old updating log file
30-04-2008 13:14:27, Rateup WARNING: /usr/bin/rateup Can't remove mem.old updating log file
30-04-2008 13:14:27, Rateup WARNING: /usr/bin/rateup Can't remove disk.old updating log file
# ./mrtg.sh
# vi /etc/httpd/conf.d/mrtg.conf
# cat /etc/httpd/conf.d/mrtg.conf
#
# This configuration file maps the mrtg output (generated daily)
# into the URL space.  By default these results are only accessible
# from the local host.
#
Alias /mrtg /home/www/littlebuddha/public_html/mrtg

<Location /mrtg>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    Allow from 192.168.0.
    #Allow from ::1
    # Allow from .example.com
</Location>

# /etc/rc.d/init.d/httpd reload
Reloading httpd:                                           [  OK  ]
# /usr/bin/indexmaker --columns=1 \
# --addhead="<meta http-equiv=\"Content-Type\" Content=\"text/html; charset=euc-jp\">" \
# /etc/mrtg/mrtg.cfg > /home/www/littlebuddha/public_html/mrtg/index.html