トラフィックがみたいなぁと思ってまたMRTGを入れときました。簡単。
# cd /usr/ports/net-mgmt/net-snmp
# make install
# cp /usr/local/share/snmp/snmpd.conf.example /usr/local/share/snmp/snmpd.conf
# vi /usr/local/share/snmp/snmpd.conf
com2sec local localhost PUBLIC
com2sec mynetwork 192.168.0.0/24 PUBLIC
#group MyRWGroup v1 local
#group MyRWGroup v2c local
#group MyRWGroup usm local
# ps ax | grep snmpd
# snmpwalk -v 1 -c PUBLIC 192.168.0.100
# echo 'snmpd_enable="YES"' >> /etc/rc.conf
# /usr/local/etc/rc.d/snmpd.sh start
# cd /usr/ports/net-mgmt/mrtg
# make install
# rehash
# cfgmaker PUBLIC@192.168.0.100 > /usr/local/etc/mrtg/mrtg.cfg
# vi /usr/local/etc/mrtg/mrtg.cfg
WorkDir: /usr/local/www/apache22/data/mrtg
Options[_]: growright, bits
CPUの温度監視にはmbmonを使います。
# cd /usr/ports/sysutils/mbmon # make WITHOUT_X11=yes # make install # vi /usr/local/etc/mrtg/mrtg.cfg Target[temperature]: `/usr/local/bin/mbmon -c 1 -T 4 -u -n | sed '/¥.[0-9]$/s/¥.//'` MaxBytes[temperature]: 1000 Title[temperature]: System Temperature PageTop[temperature]: <H1>System Temperature</H1> Options[temperature]: nopercent, gauge, absolute, unknaszero, growright Factor[temperature]: 0.1 YTicsFactor[temperature]: 0.1 YLegend[temperature]: Temperature ShortLegend[temperature]: degrees Legend1[temperature]: CPU Temperature Legend2[temperature]: M/B Temperature LegendI[temperature]: CPU Temp. LegendO[temperature]: M/B Temp.
# /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
テスト。
# vi /etc/crontab */5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
最後にindexを作っておく。
# indexmaker /usr/local/etc/mrtg/mrtg.cfg > /usr/local/www/apache22/data/mrtg/index.html
おわり。
参考
- http://www.softbreeze.jp/contents/freebsd/mrtg.html
- http://nadmin.org/howto/temperature.html