| 订阅 RSS

ubuntu下安装配置mrtg

十月 26th, 2009 Posted in MRTG, Ubuntu | 1,099次浏览

制作:高进波
时间:2009-09-19

1.mrtg 安装
apt-get install mrtg snmpd
编辑snmpd:
nano  /etc/snmp/snmpd.conf
查找到类似的行,修改为如下所示:(仅仅修改屏蔽或放开)
# sec.name source community
# com2sec paranoid default public # kommentieren
com2sec readonly default public # <- auskommentieren
#com2sec readwrite default private
重启snmpd服务:
/etc/init.d/snmpd restart

 

2.生成并修改配置文件

cfgmaker public@localhost > /etc/mrtg.cfg

说明:将以下内容复制到/etc/mrtg.cfg文件最后,将里面的IP修改为本机服务器IP,主机名www2修改为自己的

vi /etc/mrtg.cfg

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[cpu]:ssCpuRawUser.0&ssCpuRawIdle.0:public@localhost
RouterUptime[cpu]: public@localhost
MaxBytes[cpu]: 100
Title[cpu]: CPU LOAD (localhost)
PageTop[cpu]: <H1>www2: <FONT color="FF9900">User CPU Load % (localhost)</FONT></H1>
Unscaled[cpu]: ymwd
ShortLegend[cpu]: %
YLegend[cpu]: CPU Utilization
Legend1[cpu]: User CPU in % (Load)
Legend2[cpu]: Idle CPU in % (Load)
LegendI[cpu]: User
LegendO[cpu]: Idle
Options[cpu]: growright,nopercent

Target[usrsys]:ssCpuRawUser.0&ssCpuRawSystem.0:public@localhost
RouterUptime[usrsys]: public@localhost
MaxBytes[usrsys]: 100
Title[usrsys]: CPU LOAD (localhost)
PageTop[usrsys]: <H1>www2: <FONT color="FF9900">CPU (user and system) Load % (localhost)</FONT></H1>
Unscaled[usrsys]: ymwd
ShortLegend[usrsys]: %
YLegend[usrsys]: CPU Utilization
Legend1[usrsys]: User CPU in % (Load)
Legend2[usrsys]: System CPU in % (Load)
LegendI[usrsys]: User
LegendO[usrsys]: System
Options[usrsys]: growright,nopercent

Target[cpusum]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
RouterUptime[cpusum]: public@localhost
MaxBytes[cpusum]: 100
Title[cpusum]: CPU LOAD (localhost)
PageTop[cpusum]: <H1>www2: <FONT color="FF9900">Active CPU Load % (localhost)</FONT></H1>
Unscaled[cpusum]: ymwd
ShortLegend[cpusum]: %
YLegend[cpusum]: CPU Utilization
Legend1[cpusum]: Active CPU in % (Load)
LegendI[cpusum]: Active
Options[cpusum]: growright,nopercent

Target[tcpopen]: .1.3.6.1.2.1.6.9.0&.1.3.6.1.2.1.6.9.0:public@localhost
Options[tcpopen]: nopercent,growright,gauge,noinfo
Title[tcpopen]: Open TCP connections
PageTop[tcpopen]: <h1>Open TCP connections</H1>
MaxBytes[tcpopen]: 1000000
ShortLegend[tcpopen]: connections
LegendI[tcpopen]: Connections:
Legend1[tcpopen]: Open TCP connections

Target[packet]:ifInUcastPkts.2&ifOutUcastPkts.2:public@localhost
MaxBytes[packet]: 80000000
Options[packet]:growright,bits
Title[packet]: IP Packet Count
PageTop[packet]: <H1> IP Packet Count </H1>
YLegend[packet]: IP Packet Count

 

3.生成首页
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html

完成!

Tags: ,

留下您的脚印