--------------------------------------------------------------------------------
MRTGのインストール
--------------------------------------------------------------------------------

http://people.ee.ethz.ch/~oetiker/webtools/mrtg/

まずコンパイル作業用のディレクトリ作成
mkdir /usr/local/src/mrtg

その中に必要なライブラリなどダウンロードしておく。

------------------------------------------------------------
zlibのコンパイル
------------------------------------------------------------
cd zlib ; ./configure ; make ; cd ..

------------------------------------------------------------
libpngのコンパイル
------------------------------------------------------------
cd libpng ; \
make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib ; \
rm *.so.* *.so ; cd ..

------------------------------------------------------------
gdのコンパイル
------------------------------------------------------------
cd gd ; \
/bin/env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" \
./configure \
--disable-shared \
--without-freetype \
--without-jpeg ; \
make ; cp .libs/* . ; cd ..

------------------------------------------------------------
MRTGのコンパイル&インストール
------------------------------------------------------------
cd mrtg ; \
./configure --prefix=/usr/local/mrtg-2 \
--with-gd=/usr/local/src/mrtg/gd \
--with-z=/usr/local/src/mrtg/zlib \
--with-png=/usr/local/src/mrtg/libpng ; \
make ; make install

------------------------------------------------------------
index.htmlの作成
------------------------------------------------------------
/usr/local/mrtg-2/bin/indexmaker /etc/mrtg/traffic.cfg > /home/mrtg/public_html/index.html
/usr/local/mrtg-2/bin/indexmaker /etc/mrtg/cpu.cfg >> /home/mrtg/public_html/index.html
/usr/local/mrtg-2/bin/indexmaker /etc/mrtg/memory.cfg >> /home/mrtg/public_html/index.html
/usr/local/mrtg-2/bin/indexmaker /etc/mrtg/disk.cfg >> /home/mrtg/public_html/index.html

------------------------------------------------------------
cfgの作成
------------------------------------------------------------
./cfgmaker --ifref=name --ifdesc=name private@localhost > /etc/mrtg/test.cfg
./cfgmaker --ifref=descr --ifdesc=descr private@localhost > /etc/mrtg/test.cfg

------------------------------------------------------------
実行コマンド
------------------------------------------------------------
/bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/traffic.cfg
/bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/memory.cfg
/bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/disk.cfg
/bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/cpu_load_average.cfg
/bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/cpu_percent.cfg
/bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/httpd.cfg

------------------------------------------------------------
CRONへの登録
------------------------------------------------------------
crontab -e

*/5 * * * * /bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/traffic.cfg
*/5 * * * * /bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/memory.cfg
*/5 * * * * /bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/disk.cfg
*/5 * * * * /bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/cpu_load_average.cfg
*/5 * * * * /bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/cpu_percent.cfg
*/5 * * * * /bin/env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg/httpd.cfg

------------------------------------------------------------
各CFGの設定
------------------------------------------------------------
/etc/mrtg/*.cfg に設置

------------------------------------------------------------
snmpd.confの設定
------------------------------------------------------------
/etc/init.d/snmpd restart

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です