网络流量监控mrtg

安装一个Nginx(http)服务器(略)


yum install net-snmp -y 安装网管协议snmp
yum install mrtg -y     监控软件


编辑snmpd.conf
vim /etc/snmp/snmpd.conf


编辑62行:
access  notConfigGroup ""      any       noauth    exact  systemview none none

access  notConfigGroup ""      any       noauth    exact  mib2       none none


取消89行注释:
#view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc


启动snmpd
service snmpd start


//创建mrtg配置/Web目录到nginx/html下
makedir /usr/local/nginx/html/mrtg/


//生成配置文件
cfgmaker --output==/usr/local/nginx/html/mrtg/mrtg.cfg public@IP


//更新配置文件
env LANG=C /usr/bin/mrtg /usr/local/nginx/html/mrtg/mrtg.cfg


//生成主页模板
indexmaker --output=/usr/local/nginx/html/mrtg/index.html --title=服务器流量统计 /usr/local/nginx/html/mrtg/mrtg.cfg




//定时更新


crontab -e  自动调用viw编辑器,然后输入下面内容


*/5 * * * * env LANG=C /usr/bin/mrtg /usr/local/nginx/html/mrtg/mrtg.cfg


修改index.html编码
vim /usr/local/nginx/html/mrtg/index.html


<meta http-equiv="content-type" content="text/html; charset=utf-8" />
发布了84 篇原创文章 · 获赞 15 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/TDGX2004/article/details/8822233