#contents
----
&lastmodified;
&lastmod;
----
*MRTG 再び!? [#ja7ee610]

www.kuji-clinic.net 上で動いていたMRTG. 2013-04-06 12:14:16 時点での最新版にしてみることに。

 root@mail:/root # portupgrade mrtg-2.16.2_1,1
 root@mail:/root # portupgrade -rf mrtg-2.16.2_1,1
 root@mail:/root # portupgrade net-mgmt/mrtg
 root@mail:/root # portupgrade -rf net-mgmt/mrtg
 --->  Reinstalling 'mrtg-2.17.4_3,1' (net-mgmt/mrtg)
 --->  Building '/usr/ports/net-mgmt/mrtg'
 ===>  Cleaning for mrtg-2.17.4_3,1
 ===>  Found saved configuration for mrtg-2.17.4_3,1
 ===> Fetching all distfiles required by mrtg-2.17.4_3,1 for building
 ===>  Extracting for mrtg-2.17.4_3,1
 => SHA256 Checksum OK for mrtg-2.17.4.tar.gz.
 ===>   mrtg-2.17.4_3,1 depends on file: /usr/local/bin/perl5.14.2 - found
 ===>  Patching for mrtg-2.17.4_3,1
 ===>   mrtg-2.17.4_3,1 depends on file: /usr/local/bin/perl5.14.2 - found
 ===>  Applying FreeBSD patches for mrtg-2.17.4_3,1
 ===>   mrtg-2.17.4_3,1 depends on file: /usr/local/bin/perl5.14.2 - found
 ===>   mrtg-2.17.4_3,1 depends on shared library: gd - found
 ===>  Configuring for mrtg-2.17.4_3,1
 checking for gcc... cc
 checking whether the C compiler works...
 
 
 ===> Installing rc.d startup script(s)
 ############################################################################
 # 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:   #
 #      mrtg_daemon_enable="YES"                                            #
 ############################################################################
 ===> Correct pkg-plist sequence to create group(s) and user(s)
 ===>   Compressing manual pages for mrtg-2.17.4_3,1
 ===>   Registering installation for mrtg-2.17.4_3,1
 ===>  Cleaning for mrtg-2.17.4_3,1
 --->  Cleaning out obsolete shared libraries
 [Updating the pkgdb <format:bdb_btree> in /var/db/pkg ... - 480 packages found (-0 +1) . done]


*MRTG mrtg-2.15.2,1[#qcf0a593]
>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} % cp mrtg.cfg.sample mrtg.cfg
// CoolMaster:root {68} % vi mrtg.cfg
 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 {63} % chown mrtg:mrtg MRTG
 CoolMaster:root {64} % chown -R mrtg:mrtg MRTG
 CoolMaster:root {65} % pwd
 /usr/local/www/data
// CoolMaster:root {66} %

>しておく。


>あとは、/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

>しておく

**/usr/local/etc/mrtg/mrtg.cfg [#wa9ead53]

 Language: eucjp     <--- とすると日本語表示になる
 RunAsDaemon: Yes
 Interval: 5
**Tips [#e548447d]
***MRTGのデーモンの再起動 [#ee305379]
 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)
***MRTGのindex.htmlを自動生成 [#l54194d9]
 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
>http://piano.smb.net/MRTG/
>http://219.117.246.220/MRTG/
----
&lastmod;

&edit(MRTG,noicon){edit};

http://www.iin.gr.jp/~taka/server/mrtg.html~
http://tatsuya.info/pukiwiki/

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS