手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网站运营>建站经验>列表

FreeBSD 6.1上用net-snmp-5.2.2和mrtg-2.13.2实现多种监控

来源:互联网 作者:west263.com 时间:2008-04-16
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

为了让系统在启动的时候自动启动snmpd监听服务,我们要对/etc/rc.conf进行配置,在该文档种添加下面内容:
snmpd_enable=”YES”
snmpd_flags=”-a -p /var/run/snmpd.pid”
snmptrapd_enable=”YES”
snmptrapd_flags=”-a -p /var/run/snmptrapd.pid”
下面参数可选
NET_SNMP_SYS_CONTACT=”Michael@toplee.com”
NET_SNMP_SYS_LOCATION=”Beijing,China”
DEFAULT_SNMP_VERSION=3
NET_SNMP_MIB_MODULES=”host smux mibII/mta_sendmail ucd-snmp/diskio”
NET_SNMP_LOGFILE=/var/log/snmpd.log
NET_SNMP_PERSISTENTDIR=/var/net-snmp

3、安装mrtg-2.13.2
在完成了上面的snmp安装配置之后,开始进行mrtg的安装配置,也使用很方便的ports进行安装
#cd /usr/ports/net-mgmt/mrtg/
#make install clean

4、配置mrtg
#vim /usr/local/etc/mrtg/mrtg.cfg
下面是我的配置文档

WorkDir: /var/www/mrtg
Language: gb2312

Options[_]: growright, bits

Target[traffic_1]: 1:public@localhost:
SetEnv[traffic_1]: MRTG_INT_IP="localhost" MRTG_INT_DESCR="流量分析"
Xsize[traffic_1]: 380
MaxBytes[traffic_1]: 2500000
Title[traffic_1]: 前端服务器流量监控
PageTop[traffic_1]: <h1>前端服务器流量监控控</h1>
<table>
<tr><td>System:</td> <td>FreeBSD web server of Toplee.com Col </td></tr>
<tr><td>Maintainer:</td> <td>Michael &lt;toplee@gamil.com&gt; </td></tr>
<tr><td>ifType:</td> <td>ethernetCsmacd (6)</td></tr>
<tr><td>Max Speed:</td> <td>2.5 MBytes/s</td></tr>
</table>


########################### TCP Cons ######################################
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
YLegend[tcpopen]: # conns
ShortLegend[tcpopen]: connections
LegendI[tcpopen]: Connections:
LegendO[tcpopen]:
Legend1[tcpopen]: Open TCP connections


######################### CPU ############################################
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
RouterUptime[cpu]: public@localhost
MaxBytes[cpu]: 100
Title[cpu]: CPU Load
PageTop[cpu]: <h1>Carga de CPU %</h1>
Unscaled[cpu]: ymwd
ShortLegend[cpu]: %
YLegend[cpu]: Uso de CPU
Legend1[cpu]: CPU Activa % (Carga)
Legend2[cpu]:
Legend3[cpu]:
Legend4[cpu]:
LegendI[cpu]: Active
LegendO[cpu]:
Options[cpu]: growright,nopercent

######################## CPU UsrSys ####################################
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[usrsys]:ssCpuRawUser.0&ssCpuRawSystem.0:public@localhost
RouterUptime[usrsys]: public@localhost
MaxBytes[usrsys]: 100
Title[usrsys]: CPU LOAD
PageTop[usrsys]: <h1>CPU (user and system) Load %</h1>
Unscaled[usrsys]: ymwd
ShortLegend[usrsys]: %
YLegend[usrsys]: CPU Utilization
Legend1[usrsys]: User CPU in % (Load)
Legend2[usrsys]: System CPU in % (Load)
Legend3[usrsys]:
Legend4[usrsys]:
LegendI[usrsys]: User
LegendO[usrsys]: System
Options[usrsys]: growright,nopercent


########################### Mem ###########################################
LoadMIBs: /usr/local/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.6.0:public@localhost
PageTop[mem]: <h1>Memory RAM</h1>
Options[mem]: nopercent,growright,gauge,noinfo
Title[mem]: Memory Libre
MaxBytes[mem]: 1055309824
kMG[mem]: k,M,G,T,P,X
YLegend[mem]: bytes
ShortLegend[mem]: bytes
LegendI[mem]: Free Memory:
LegendO[mem]:
Legend1[mem]: Free memory, not including swap, in bytes

####################### MEM1 ############################################
LoadMIBs: /usr/local/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[mem1]:.1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.15.0:public@localhost * 1024
MaxBytes[mem1]: 1055309824
Title[mem1]: MEMORY USAGE
kilo[mem1]: 1024
WithPeak[mem1]: my
Options[mem1]: gauge,growright
YLegend[mem1]: Memory Usage
LegendI[mem1]: Used:
LegendO[mem1]: Cached:

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!