SNMP&MRTG
まあいろいろと設定中。
設定の大半は例によってパクリ。
net-snmp
apt-get install net-snmp net-snmp-utils
vi /etc/snmp/snmpd.conf
設定
## sec.name source community com2sec local localhost private com2sec mynetwork 192.168.0.0/16 public ## group.name sec.model sec.name group MyRWGroup any local group MyROGroup any mynetwork ## incl/excl subtree mask view all included .1 80 ## context sec.model sec.level prefix read write notif access MyROGroup "" any noauth 0 all none none access MyRWGroup "" any noauth 0 all all all disk / 1000
chkconfig --level 35 snmpd on
/etc/init.d/snmpd start
MRTG
apt-get install libpng-devel zlib-devel gd-devel
wget http://people.ee.ethz.ch/~oetiker/webtools/mrtg/pub/mrtg-2.12.2.tar.gz
tar xzvf mrtg-2.12.2.tar.gz
cd mrtg-2.12.2
./configure --with-gd-lib=/usr/lib --with-gd-inc=/usr/include --with-z-inc=/usr/include --with-z-lib=/usr/lib --with-png-inc=/usr/include --with-png-lib=/usr/lib --prefix=/usr
make
make install
cp -R /usr/man/ /usr/share/
rm -Rf /usr/man/
# cfgmaker public@192.168.0.1 > /etc/mrtg.conf
vi /etc/snmp/mrtg.conf
設定
# Created by # ./cfgmaker public@192.168.0.1 ### Global Config Options # for UNIX WorkDir: /home/httpd/html/mrtg ### Global Defaults # to get bits instead of bytes and graphs growing to the right Options[_]: growright, noinfo Language:eucjp EnableIPv6: no # Netwerk Traffic(eth0) Target[network]: 2:public@192.168.0.1: SetEnv[network]: MRTG_INT_IP="192.168.0.1" MRTG_INT_DESCR="eth0" MaxBytes[network]: 12500000 Title[network]: Netwerk Traffic Analysis PageTop[network]: <H1>Netwerk Traffic Analysis </H1> <H3>Host(192.168.0.1) Device:eth0</H3> # CPU Load Average Target[cpu]: .1.3.6.1.4.1.2021.10.1.5.1&.1.3.6.1.4.1.2021.10.1.5.2:public@192.168.0.1 MaxBytes[cpu]: 100 Unscaled[cpu]: dwmy Options[cpu]: gauge, absolute, growright, noinfo, nopercent YLegend[cpu]: CPU Load(%) ShortLegend[cpu]: (%) LegendI[cpu]: 1分間平均 LegendO[cpu]: 5分間平均 Legend1[cpu]: 1分間平均(%) Legend2[cpu]: 5分間平均(%) Title[cpu]: CPU使用率 PageTop[cpu]: <H1>CPU使用率 </H1> <H3>Host(192.168.0.1)</H3> # Memory Usage Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:public@192.168.0.1 MaxBytes1[mem]: 200000 MaxBytes2[mem]: 400000 Unscaled[mem]: dwmy Options[mem]: gauge, absolute, growright, noinfo YLegend[mem]: Mem Free(Bytes) ShortLegend[mem]: Bytes kilo[mem]: 1024 kMG[mem]: k,M,G,T,P LegendI[mem]: Real LegendO[mem]: Swap Legend1[mem]: 空き物理メモリ[MBytes] Legend2[mem]: 空きスワップメモリ[MBytes] Title[mem]: 空きメモリ量 PageTop[mem]: <H1>空きメモリ量 </H1> <H3>Host(192.168.0.1)</H3> # Disk Used Target[disk]: .1.3.6.1.4.1.2021.9.1.9.1&.1.3.6.1.4.1.2021.9.1.9.1:public@192.168.0.1 MaxBytes[disk]: 100 Unscaled[disk]: dwmy Options[disk]: gauge, absolute, growright, nopercent, noinfo YLegend[disk]: Disk Used(%) ShortLegend[disk]: (%) LegendI[disk]: / Disk used LegendO[disk]: / Disk Used Legend1[disk]: / Disk used Legend2[disk]: / Disk used Title[disk]: ディスク使用率 PageTop[disk]: <H1>ディスク使用率 </H1> <H3>Host(192.168.0.1)</H3>
mrtg /etc/snmp/mrtg.conf
mrtg /etc/snmp/mrtg.conf
mrtg /etc/snmp/mrtg.conf
indexmaker /etc/snmp/mrtg.conf > /home/httpd/mrtg/index.html
mozilla file:///home/httpd/html/mrtg/index.html
vi /etc/crontab
設定
*/5 * * * * root /usr/bin/mrtg /etc/snmp/mrtg.conf