使用MRTG监控你的服务器

kevin.Zhu 发布于:2019-9-4 14:45 分类:文摘  有 16 人浏览,获得评论 0 条  

http://www.360doc.com/content/17/0326/19/11277047_640350882.shtml


[ 文章导读 ] 环境:ubuntu16.04简介:MRTG(Multi Router Traffic Grapher)是监控网络流量的工具。MRTG能将流量生成PNG图片展示在HTML页面上。安装snmproot@ubuntu:~# apt-get

环境:ubuntu16.04

简介:MRTG(Multi Router Traffic Grapher)是监控网络流量的工具。MRTG能将流量生成PNG图片展示在HTML页面上。

安装snmp

root@ubuntu:~# apt-get
install apache2 snmpd snmp

使用MRTG监控你的服务器

修改snmp配置文件

root@ubuntu:~# vi /etc/snmp/snmpd.conf

#rocommunity public localhost

取消注释为

rocommunity public localhost

使用MRTG监控你的服务器

重新启动snmp服务

root@ubuntu:~# service snmpd restart


安装mrtg

root@ubuntu:~# apt-get install mrtg

弹出窗口,选择YES确认,继续安装。

使用MRTG监控你的服务器

配置MRTG

在 /var/www/html目录建立文件夹mrtg

root@ubuntu:~# mkdir /var/www/html/mrtg

备份mrtg配置文件

root@ubuntu:~# cp /etc/mrtg.cfg /etc/mrtg.cfg.bak

修改mrtg配置文件

root@ubuntu:~# vi /etc/mrtg.cfg

更改路径为WorkDir: /var/www/html/mrtg

使用MRTG监控你的服务器

使用本地服务器监视输出

root@ubuntu:~# cfgmaker public@localhost > /etc/mrtg.cfg

使用MRTG监控你的服务器

生成html页面

root@ubuntu:~# indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html

使用MRTG监控你的服务器

使用浏览器访问页面

使用MRTG监控你的服务器

成功配置,结束。