ubuntu下安装配置mrtg - [Ubuntu]
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]:
- 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]:
- 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]:
- 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]:
- 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]:
- YLegend[packet]: IP Packet Count
3.生成首页
- indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
Ubuntu下安装配置MRTG完成!
【编辑推荐】