mrtg for linux 安装

linux   2008-03-22 16:27   阅读25   评论0  
字号:    

本文中使用的系统为RH9.0,本机IP地址为192.168.1.6
 
一、MRTG需要以SNMP服务为基础,所以请确保你的系统已经启用了此服务
 
1.请确保你的系统安装了以下软件包
net-snmp-5.0.6-17
net-snmp-devel-5.0.6-17
net-snmp-utils-5.0.6-17
 
2.修改/etc/snmp/snmpd.conf
 
去掉如下一行的注释
view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
 
在大约55行处添加如下一行
view    systemview    included   .1.3.6.1.2.1.2
 
把如下行
access  notConfigGroup ""      any       noauth    exact  systemview none none
改作:
access  notConfigGroup ""      any       noauth    exact  mib2 none none
 
3.启用snmpd服务
#service snmpd start
#chkconfig --levle 2345 snmpd on
 
4.查看端口的开启状况
# netstat -tunlp |grep snmp
tcp        0      0 0.0.0.0:199             0.0.0.0:*               LISTEN      4973/snmpd          
udp        0      0 0.0.0.0:161             0.0.0.0:*                           4973/snmpd    
 
二、MRTG生成供浏览图像需要httpd服务的支持,同时也需要gd、libpng和zlib三个软件包的支持,而gd的正常运行也需要其它的几个软件,下面一并安装它们
 
1.安装zlib-1.2.3
#tar zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure --prefix=/usr/local/zlib
#make
#make install
 
2.安装httpd-2.2.4
#tar zxvf httpd-2.2.4.tar.gz
#cd httpd-2.2.4
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib 
#make 
#make install
启动httpd
/usr/local/apache/bin/apachectl -k start
 
3.安装libpng-1.2.14 
#tar zxvf libpng-1.2.14.tar.gz   
# cd libpng-1.2.14 
# cp scripts/makefile.linux makefile 
# make (若是提示找不到zlib库文件或者头文件,多半是makefile文件里zlib的默认路径有误。可编辑makefile文件,找到zlib项并重新指定路径到/usr/local/zlib/lib和/usr/local/zlib/include)。
# make install
 
4.安装freetype-2.1.10 
# tar -zvxf freetype-2.1.10.tar.gz 
# cd freetype-2.1.10
# mkdir -p /usr/local/freetype 
# ./configure --prefix=/usr/local/freetype 
# make;make install  
 
5.安装jpegsrc.v6b
jpeg默认不会自建目录,因此需手动建立目录: 
# mkdir -pv /usr/local/jpeg6/{,bin,lib,include,man/{,man1},man1}
安装
#tar zxvf jpegsrc.v6b.tar.gz    
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static 
# make
# make install  
# make install-lib
 
6.安装libxml2-2.6.19
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make; make install
#cp xml2-config /usr/bin
 
7.安装GD-2.0.33库 
# tar -zvxf gd-2.0.33.tar.gz 
# mkdir -p /usr/local/gd2 
# cd gd-2.0.33 
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/ 
# make
# make install 
 
三、安装MRTG
 
1.下载mrtg,目前最新版本为mrtg-2.15.1
http://oss.oetiker.ch/mrtg/pub/mrtg-2.15.1.tar.gz
 
2.安装mrtg-2.15.1
#tar zxvf mrtg-2.15.1.tar.gz
# cd mrtg-2.15.1 
# ./configure --prefix=/usr/local/mrtg --sysconfdir=/etc/mrtg --with-gd=/usr/local/gd2/include --with-gd-lib=/usr/local/gd2/lib --with-gd-inc=/usr/local/gd2/include --with-png=/usr/local/include --with-png-lib=/usr/local/lib --with-png-inc=/usr/local/include --with-zlib=/usr/local/zlib/include --with-zlib-lib=/usr/local/zlib/include --with-zlib-inc=/usr/local/zlib/include
# make
# make install 
四、配置MRTG

[root@localhost bin]# cd /usr/local/mrtg/bin
[root@localhost bin]# ./cfgmaker --global 'WorkDir: /var/www/html/www/mrtg' --global 'Options[_]: bits,growright' --global 'Language: GB2312' --output /var/www/html/www/mrtg/mrtg.cfg public@localhost
[root@localhost bin]#
[root@localhost bin]#
[root@localhost bin]#
[root@localhost bin]# /bin/env LANG=en_US ./mrtg /var/www/html/www/mrtg/mrtg.cfg
2007-09-19 12:55:03, Rateup WARNING: /usr/local/mrtg/bin/rateup Can't remove localhost_3.old updating log file
[root@localhost bin]# /bin/env LANG=en_US ./mrtg /var/www/html/www/mrtg/mrtg.cfg
[root@localhost bin]# /bin/env LANG=en_US ./mrtg /var/www/html/www/mrtg/mrtg.cfg
[root@localhost bin]# ./indexmaker  --output="/var/www/html/www/mrtg/index.html" --title="Taffic Monitor Center" /var/www/html/www/mrtg/mrtg.cfg
ERROR: unable to open config file: /var/www/html/www/mrtg/cfg/mrtg.cfg
[root@localhost bin]# ./indexmaker  --output="/var/www/html/www/mrtg/index.html" --title="Taffic Monitor Center" /var/www/html/www/mrtg/mrtg.cfg

add other servers:

[root@localhost bin]# ./cfgmaker public@192.168.1.82 >> /var/www/html/www/mrtg/mrtg.cfg
[root@localhost bin]# ./indexmaker  --output="/var/www/html/www/mrtg/index.html" --title="Taffic Monitor Center" /var/www/html/www/mrtg/mrtg.cfg
[root@localhost bin]# /bin/env LANG=en_US ./mrtg /var/www/html/www/mrtg/mrtg.cfg
2007-09-19 13:47:13, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 192.168.1.82_65539
2007-09-19 13:47:13, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 192.168.1.82_65539 was invalid as well
2007-09-19 13:47:13, Rateup WARNING: /usr/local/mrtg/bin/rateup Can't remove 192.168.1.82_65539.old updating log file
2007-09-19 13:47:13, Rateup WARNING: /usr/local/mrtg/bin/rateup Can't rename 192.168.1.82_65539.log to 192.168.1.82_65539.old updating log file
[root@localhost bin]# /bin/env LANG=en_US ./mrtg /var/www/html/www/mrtg/mrtg.cfg
2007-09-19 13:47:15, Rateup WARNING: /usr/local/mrtg/bin/rateup Can't remove 192.168.1.82_65539.old updating log file
[root@localhost bin]# /bin/env LANG=en_US ./mrtg /var/www/html/www/mrtg/mrtg.cfg

评论(?)
阅读(?)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
网易公司版权所有 ©1997-2009