linux mrtg 安装,mrtg-linux安装步骤

mkdir -p /usr/local/src

cd /usr/local/src

(或者直接在百度下载好各个软件包,就不需要下载,然后把软件包都上传到/usr/local/src 下 开始下边的安装。)

wget http://www.zlib.net/zlib-1.2.3.tar.gz

gunzip -c zlib-*.tar.gz | tar xf -

rm zlib-*.tar.gz

mv zlib-* zlib

cd zlib

./configure

make

make install cd ..

wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.40.tar.gz

gunzip -c libpng-1.2.34.tar.gz | tar xf -

mv libpng-* libpng

cd libpng

env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR

make

make install

cd ..

下边的步骤gd文件分两个版本,低版本系统就用1.8.4(redhat5.0以下版本),如果不好用就用2.0.33版本的。推荐直接用2.0.33版本。

gd1.8.4 安装步骤:

wget http://www.boutell.com/gd/http/gd-1.8.4.tar.gz

gunzip -c gd-*.tar.gz |tar xf -

rm gd-*.tar.gz

mv gd-* gd

cd gd

perl -i~ -p -e s/gd_jpeg.o//g Makefile

make INCLUDEDIRS="-I. -I../zlib -I../libpng" \

LIBDIRS="-L../zlib -L. -L../libpng" \

LIBS="-lgd -lpng -lz -lm" \

CFLAGS="-O -DHAVE_LIBPNG"

cd ..

gd2.0.33 安装:

wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

gunzip -c gd-2.0.33.tar.gz |tar xf -

mv gd-2.0.33 gd

cd gd

env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" \

./configure --disable-shared --without-freetype --without-jpeg

make

make install

安装mrtg:

cd /usr/local/src

gunzip -c mrtg-2.17.4.tar.gz | tar xvf -

cd mrtg-2.17.4

( ./configure --prefix=/usr/local/mrtg-2)

./configure --prefix=/usr/local/mrtg-2       \

--with-gd=/usr/local/src/gd      \

--with-z=/usr/local/src/zlib     \

--with-png=/usr/local/src/libpng

make

make install

安装apache :

cd /usr/local/src

tar zxvf  httpd-2.2.9.tar.gz

cd httpd-2.2.9/

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib

make

make install

到这里MRTG已被成功的安装到你的系统。

建立配置文档存放文件夹 ,在mrtg的安装路径下:

mkdir /usr/local/mrtg-2/etc

生成配置文件,假设我们要监控的交换机IP为:10.10.10.1,配置文件路径:/usr/local/mrtg-2/etc/mrtg.cfg

配置生成MRTG配置文件脚本。

vi mkcfg

/cfgmaker --global 'WorkDir: /usr/local/apache2/htdocs/mrtg' \  (这的路径要写对)

--global 'Refresh: 300' \

--global 'Interval: 5' \

--global 'Options[_]: bits,growright' \

--no-down \

--OUTPUT /usr/local/mrtg-2/etc/mrtg.cfg \  (这里当每扫描一个ip段就会重新生成,可以命别的名字例如:mrtg.cfg192.168.1.1 )

'htidc(’@192.168.1.1

vi mkindex.html

./indexmaker --output=index.html /usr/local/mrtg-2/etc/mrtg.cfg

~

编辑生成网页文件的脚本

vi mkindex.html

./indexmaker --output=index.html /usr/local/mrtg-2/etc/mrtg.cfg

执行脚本文件:

./mkindex.html

网页文件就生成了,然后把文件复制到 目的目录,

添加计划任务:

crontab -e

*/5 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/mrtg.cfg --logging /usr/local/mrtg-2/etc/mrtg.log &

最后启动mrtg

env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/mrtg.cfg

最后可以浏览网页了。

提供下载包地址:

( 注意 :每个程序都要 make 后 再make install  。程序里边的cfgmaker可能有问题,)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值