- 论坛徽章:
- 0
|
系统:RedHat Enterprise Linux AS4
交换机:华为2100系列,ip:192.168.1.188
Apache服务已经配置完主目录为:/usr/local/apache2/htdocs
在此目录下创建一个mrtg目录:/usr/local/apache2/htdocs/mrtg
zlib,gd,libpng,JPEG,Freetype,Fontconfig等工具包都已经安装。
#tar -zxvf mrtg-2.12.2.tar.gz
#cd mrtg-2.12.2
#./configure --prefix=/usr/local/mrtg
--with-gd=/usr/include
--with-gd-lib=/usr/lib
--with-gd-inc=/usr/include
--with-png=/usr/include
--with-png-lib=/usr/lib
--with-zlib=/usr/include
--with-zlib-lib=/usr/lib
#make
#make install
1.配置并启动snmp服务
#vi /etc/snmp/snmpd.conf
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
改为
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
access notConfigGroup "" any noauth exact systemview none none
修改为:
access notConfigGroup "" any noauth exact mib2 none none
#/etc/rc.d/init.d/snmpd start
2.生成cfg文件
#usr/local/mrtg/bin/cfgmaker huawei7@92.168.1.188 > /usr/local/apache2/htdocs/mrtg/mrtg.cfg
#vi /usr/local/apache2/htdocs/mrtg/mrtg.cfg
mrtg.cfg内容:
# Created by
# /usr/local/mrtg/bin/cfgmaker huawei7@192.168.1.188
### Global Config Options
# for UNIX
WorkDir: /usr/local/apache2/htdocs/mrtg/
# or for NT
# WorkDir: c:\mrtgdata
### Global Defaults
# to get bits instead of bytes and graphs growing to the right
Options[_]: growright, bits
Language:Chinese
保存并退出:
#env LANG=C /usr/local/mrtg/bin/mrtg /usr/local/apache2/htdocs/mrtg/mrtg.cfg
生成页面命令:(/usr/local/apache2/htdocs是apache默认的路径,mrtg下的index.html是手动创建的空文件)
#/usr/local/mrtg/bin/indexmaker --output=/usr/local/apache2/htdocs/mrtg/index.html --title=标题 /usr/local/apache2/htdocs/mrtg/mrtg.cfg
ERROR: unable to open config file: of
总是提示ERROR: unable to open config file: of错误!不知道问题出在哪里?就算把主页换到apache的默认路径下的/usr/local/apache2/htdocs/index.html 也提示同样的错误!
后面继续的命令是:
启动Apache,让数据自动刷新,还需要让程序在后台定时运行:
#crontab -e
*/5 * * * * env LANG=C /usr/local/mrtg/bin/mrtg /var/www/html/mrtg/mrtg.cfg
该句表示让系统在后台每五分钟执行一次env LANG=C /usr/local/mrtg/bin/mrtg /var/www/html/mrtg/mrtg.cfg即每5分钟刷新一次
另外还可以在mrtg.cfg中加入脚本,用于监控CPU,MEM,SWAP的使用情况 |
|