在Redhat上要怎么配置mrtg流量监控系统
在Redhat上要怎么配置mrtg流量监控系统
首先,你需要安装MRTG,可以从这里下载安装包:http://oss.oetiker.ch/mrtg/pub/
下载完成后,解压缩安装包,进入解压缩后的目录,执行以下命令安装MRTG:
tar xvzf mrtg-2.17.4.tar.gz
cd mrtg-2.17.4
./configure
make
make install
安装完成后,你可以在/usr/local/mrtg目录下看到MRTG的安装文件。
现在我们需要为MRTG配置一个配置文件,可以使用以下命令创建一个配置文件:
touch /usr/local/mrtg/mrtg.cfg
编辑配置文件,配置如下:
WorkDir: /usr/local/mrtg
Options[_]: growright, bits
MaxBytes[_]: 125000
Title[_]: Traffic Analysis for Local Network
PageTop[_]:
Traffic Analysis for Local Network
Target[_]: public@localhost SetEnv[_]: MRTG_INT_DESCR="1" SetEnv[_]: MRTG_INT_IP="" SetEnv[_]: MRTG_INT_NAME="eth0" SetEnv[_]: MRTG_LAN_DESCR="2" SetEnv[_]: MRTG_LAN_IP="192.168.1.1" SetEnv[_]: MRTG_LAN_NAME="eth1" 注意,上面的配置文件中,我们使用了两个网络接口,分别是eth0和eth1,你可以根据实际情况修改配置。 接下来,我们需要使用以下命令来生成配置文件: /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg 如果一切配置正确,你应该看到以下输出: Creating /usr/local/mrtg/mrtg.cfg ... OK Now you can start mrtg with /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg or /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 2nd minute (120 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 4th minute (240 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 8th minute (480 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 16th minute (960 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every hour (3600 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every day (86400 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every week (604800 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every month (2678400 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every year (31622400 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg 现在我们可以使用以下命令来启动MRTG: /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg 如果一切配置正确,你应该看到以下输出: Starting MRTG ... Running /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 2nd minute (120 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 4th minute (240 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 8th minute (480 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every 16th minute (960 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every hour (3600 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every day (86400 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every week (604800 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every month (2678400 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg Every year (31622400 seconds) /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg.cfg 现在我们可以在浏览器中输入http://localhost/mrtg/来查看实时流量图表了。相关文章