MRTGでCPUの負荷状況ををみてみたいというのが動機
CoolMaster:root {62} % whereis mrtg mrtg: /usr/ports/net-mgmt/mrtg CoolMaster:root {63} % cd /usr/ports/net-mgmt/mrtg CoolMaster:root {64} % make install
と「IPV6は使うのか?」聞くので、つかうと・・・
===> Vulnerability check disabled, database not found ===> Found saved configuration for mrtg-2.15.2,1 => mrtg-2.15.2.tar.gz doesn't seem to exist in /usr/ports/distfiles/. => Attempting to fetch from http://oss.oetiker.ch/mrtg/pub/. mrtg-2.15.2.tar.gz 12% of 1045 kB 14 kBps : : : : Created directory: /var/run/mrtg ############################################################################ # Please create a MRTG config file in /usr/local/etc/mrtg # # A configuration file can be automatically generated with cfgmaker # # A sample configuration file is installed as mrtg.cfg.sample # # # # To enable MRTG in daemon mode, put the following to your /etc/rc.conf or # # /etc/rc.conf.local file: # # mrtg_daemon_enable="YES" # ############################################################################ ===> Installing rc.d startup script(s) ===> Compressing manual pages for mrtg-2.15.2,1 ===> Registering installation for mrtg-2.15.2,1
どうやら最近のMRTGはdaemonで動くようになったらしい。
インストール完了したら、
CoolMaster:root {65} % cd /usr/local/etc/mrtg CoolMaster:root {66} % ll total 20 -r--r--r-- 1 root wheel 19038 Aug 23 16:41 mrtg.cfg.sample CoolMaster:root {67} % rehash
あらかじめ作成している snmp を描かせるために
CoolMaster:root {68} % cfgmaker PUBLIC@piano.smb.net > mrtg-public.cfg CoolMaster:root {69} % vi mrtg-public.cfg
このmrtg-public.cfgの中の記述に生成したファイルの保存場所として、今回、
# for UNIX #WorkDir: /usr/local/www/apache22/data/MRTG WorkDir: /usr/local/www/data/MRTG
としたため、/usr/local/www/data/MRTG を作成しておく。つづいて、このcfgで起動
CoolMaster:root {85} % mrtg mrtg-public.cfg 2007-08-23 18:02:39, Rateup WARNING: /usr/local/bin/rateup could not read the primary log file for piano.smb.net_2 2007-08-23 18:02:39, Rateup WARNING: /usr/local/bin/rateup The backup log file for piano.smb.net_2 was invalid as well 2007-08-23 18:02:39, Rateup WARNING: /usr/local/bin/rateup Can't remove piano.smb.net_2.old updating log file 2007-08-23 18:02:39, Rateup WARNING: /usr/local/bin/rateup Can't rename piano.smb.net_2.log to piano.smb.net_2.old updating log file
等と表示されるが、ターゲットのファイルが出来ているのを確認できたら、
http://piano.smb.net/MRTG/piano.smb.net_2.html
http://mail.smb.net/mrtg/219.117.246.199_2.html
へアクセスしてみて動作確認。
mrtgが表示ファイルを書き換え出来るようにwork dir の/usr/local/www/data で
CoolMaster:root {64} % chown -R mrtg:mrtg MRTG CoolMaster:root {65} % pwd /usr/local/www/data
しておく。
あとは、/etc/rc.conf に
mrtg_daemon_enable="YES"
を記述して自動起動なのだが、/usr/local/etc/rc.d/mrtg_daemon をみると、
: ${mrtg_daemon_config="/usr/local/etc/mrtg/mrtg.cfg"}
とあるので、
CoolMaster:root {70} % mv /usr/local/etc/mrtg/mrtg-public.cfg /usr/local/etc/mrtg/mrtg.cfg
しておく
Language: eucjp <--- とすると日本語表示になる RunAsDaemon: Yes Interval: 5
CoolMaster:root {63} % /usr/local/etc/rc.d/mrtg_daemon restart CoolMaster:root {64} % /usr/local/etc/rc.d/mrtg_daemon Usage: /usr/local/etc/rc.d/mrtg_daemon [fast|force|one](start|stop|restart|rcvar|status|poll)
CoolMaster:root {64} % indexmaker /usr/local/etc/mrtg/mrtg.cfg > index.html CoolMaster:root {76} % vi index.html <meta http-equiv="content-type" content="text/html; charset=euc-jp" > CoolMaster:root {76} % chown mrtg index.html
/usr/local/www/data/MRTG/index.html
2013-04-06 (土) 12:17:06
http://www.iin.gr.jp/~taka/server/mrtg.html
http://tatsuya.info/pukiwiki/