$ tar xvfz mrtg-2.8.11.tar.gz $ cd mrtg-2.8.11 $ ./configure --with-gd=../gd-1.7.3 --with-z=../zlib-1.1.3 --with-png=../libpng-1.0.5 $ make LD_RUN_PATH=../libpng-1.0.5:../zlib-1.1.3:../gd-1.7.3 gcc -g -O2 -I../gd-1.7.3 -I../zlib-1.1.3 -I../libpng-1.0.5 -DGFORM_GD=gdImagePng -Wall -pedantic src/rateup.c -L../gd-1.7.3 -lgd -L../zlib-1.1.3 -L../libpng-1.0.5 -lm -lpng -lz -lm -o run/rateup /usr/bin/perl -0777 -pi -e 's@^#!\s*/\S*perl@#! /usr/bin/perl@' run/cfgmaker run/cfgmaker_ip run/indexmaker run/mrtg /usr/bin/perl -0777 -pi -e 's@\.(png|gif)@.png@g' run/mrtg run/indexmaker* $ su # mkdir /usr/local/bin/mrtg <--- インストール先は好みで # cp run/** /usr/local/bin/mrtg # mkdir /usr/local/apache/htdocs/mrtg <--- MRTG が生成する HTML ファイル等の格納先 # cp images/* /usr/local/apache/htdocs/mrtg <--- MRTG が使用するイメージファイル # exit |
$ telnet xxx.xxx.xxx.xxx <--- ルータの IP アドレス (router.foo.co.jp) Trying xxx.xxx.xxx.xxx... Connected to router.foo.co.jp. Escape character is '^]'. User Access Verification Password: ROUTER>en Password: ROUTER>conf Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. ROUTER(config)#snmp-server community public RO <--- コミュニティ名は public ROUTER(config)#snmp-server location Japan ROUTER(config)#snmp-server contact root@foo.co.jp ROUTER(config)#^Z ROUTER#write memory Building configuration... [OK] ROUTER#exit Connection closed by foreign host. |
$ /usr/local/bin/mrtg/cfgmaker public@xxx.xxx.xxx.xxx > mrtg.cfg Can't locate BER.pm in @INC (@INC contains: /usr/lib/perl5/5.00502/i586-linux /usr/lib/perl5/5.00502 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 .) at /usr/local/bin/mrtg/cfgmaker line 13. BEGIN failed--compilation aborted at /usr/local/bin/mrtg/cfgmaker line 13. |
$ su # cd /usr/local/bin/mrtg # /usr/local/bin/mrtg/cfgmaker public@xxx.xxx.xxx.xxx > mrtg.cfg |
# Add a WorkDir: /some/path line to this file WorkDir: /usr/local/apache/htdocs/mrtg <--- 追加 |
# ./mrtg mrtg.cfg Rateup WARNING: .//rateup could not read the primary log file for router.foo.co.jp Rateup WARNING: .//rateup The backup log file for router.foo.co.jp was invalid as well Rateup WARNING: .//rateup Can't remove router.foo.co.jp.old updating log file Rateup WARNING: .//rateup Can't rename router.foo.co.jp.log to router.foo.co.jp.old updating log file Rateup WARNING: .//rateup could not read the primary log file for xxx.xxx.xxx.xxx.2 Rateup WARNING: .//rateup The backup log file for xxx.xxx.xxx.xxx.2 was invalid as well Rateup WARNING: .//rateup Can't remove xxx.xxx.xxx.xxx.2.old updating log file Rateup WARNING: .//rateup Can't rename xxx.xxx.xxx.xxx.2.log to xxx.xxx.xxx.xxx.2.old updating log file Rateup WARNING: .//rateup could not read the primary log file for xxx.xxx.xxx.xxx.3 Rateup WARNING: .//rateup The backup log file for xxx.xxx.xxx.xxx.3 was invalid as well Rateup WARNING: .//rateup Can't remove xxx.xxx.xxx.xxx.3.old updating log file Rateup WARNING: .//rateup Can't rename xxx.xxx.xxx.xxx.3.log to xxx.xxx.xxx.xxx.3.old updating log file |
# ./mrtg mrtg.cfg Rateup WARNING: .//rateup Can't remove router.foo.co.jp.old updating log file Rateup WARNING: .//rateup Can't remove xxx.xxx.xxx.xxx.2.old updating log file Rateup WARNING: .//rateup Can't remove xxx.xxx.xxx.xxx.3.old updating log file |
# ./mrtg mrtg.cfg |
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/mrtg/mrtg /usr/local/bin/mrtg/mrtg.cfg |