LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 582|回复: 2

snmp的问题(已经查了无数的老贴,极度郁闷)

[复制链接]
发表于 2005-3-3 15:15:49 | 显示全部楼层 |阅读模式
我的操作系统是rhel as 3.0 ,mrtg是系统自带的,按要求修改了/etc/snmp/snmpd.conf文件,cfgmaker过程也正常,但就是生成的/etc/mrtg/mrtg.cfg文件不正常,导致无法用mrtg命令生成流量图,指定的var/www/html目录下没有任何文件,为空,我生成的/etc/mrtg/mrtg.cfg有以下错误


### Interface 4 >> Descr: '' | Name: '' | Ip: '211.96.98.20' | Eth: '' ###
### The following interface is commented out because:
### * has a speed of  which makes no sense
### * got 'Received SNMP response with error code  
###       error status: noSuchName
###       index 1 (OID: 1.3.6.1.2.1.2.2.1.10.4)  
###     SNMPv1_Session (remote host: "10.0.0.199" [10.0.0.199].161)
###                       community: "public"
###                      request ID: 1564421508
###                     PDU bufsize: 8000 bytes
###                         timeout: 2s  
###                         retries: 5
###                         backoff: 1)' from interface when trying to query
#
                                             


一般正确的配置如下:
Target[10.0.0.2_10.0.0.2]: /10.0.0.2:public@10.0.0.2:
SetEnv[10.0.0.2_10.0.0.2]: MRTG_INT_IP="10.0.0.2" MRTG_INT_DESCR="eth1"
MaxBytes[10.0.0.2_10.0.0.2]: 12500000
Title[10.0.0.2_10.0.0.2]: Traffic Analysis for 10.0.0.2 -- gameserver
PageTop[10.0.0.2_10.0.0.2]: <H1>Traffic Analysis for 10.0.0.2 -- gameserver</H1>
<TABLE>
   <TR><TD>System:</TD>     <TD>gameserver in Unknown (edit /etc/snmp/snmpd.conf)</TD></TR>
   <TR><TD>Maintainer:</TD> <TD>Root &lt;root@localhost&gt; (configure /etc/snmp/snmp.local.conf)</TD></TR>
   <TR><TD>Description:</TD><TD>eth1  </TD></TR>
   <TR><TD>ifType:</TD>     <TD>ethernetCsmacd (6)</TD></TR>
   <TR><TD>ifName:</TD>     <TD></TD></TR>
   <TR><TD>Max Speed:</TD>  <TD>100.0 Mbits/s</TD></TR>
   <TR><TD>Ip:</TD>         <TD>10.0.0.2 ()</TD></TR>
</TABLE>

我的cfgmaker过程如下:
[root@gameserver root]#
cfgmaker --global "WorkDir: /var/www/html" --global "Options[_]: growright,bits" --ifref=ip --output /etc/mrtg/mrtg.cfg public@10.0.0.199
--base: Get Device Info on public@10.0.0.199:
--base: Vendor Id:
--base: Populating confcache
--snpo: confcache public@10.0.0.199: Descr lo --> 1
--snpo: confcache public@10.0.0.199: Descr eth0 --> 2
--snpo: confcache public@10.0.0.199: Descr eth1 --> 3
--snpo: confcache public@10.0.0.199: Ip 10.0.0.199 --> 5
--snpo: confcache public@10.0.0.199: Ip 127.0.0.1 --> 1
--snpo: confcache public@10.0.0.199: Ip 211.96.98.20 --> 4
--snpo: confcache public@10.0.0.199: Type 24 --> 1
--snpo: confcache public@10.0.0.199: Type 6 --> 2
--snpo: confcache public@10.0.0.199: Type 6 --> 3 (duplicate)
--snpo: confcache public@10.0.0.199: Eth  --> 1
--snpo: confcache public@10.0.0.199: Eth 00-07-e9-03-f3-f9 --> 2
--snpo: confcache public@10.0.0.199: Eth 00-07-e9-03-f3-f8 --> 3
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
--base: Walking ifAdminStatus
--base: Walking ifOperStatus
--base: Walking ifSpeed
--base: Writing /etc/mrtg/mrtg.cfg
[root@gameserver root]# mrtg /etc/mrtg/mrtg.cfg
[root@gameserver root]#  mrtg /etc/mrtg/mrtg.cfg
[root@gameserver root]#  mrtg /etc/mrtg/mrtg.cfg
[root@gameserver root]# ls /var/www/html
[root@gameserver root]#

snmpwalk命令结果如下:
[root@gameserver log]# snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.25.2.3.1.6.2
HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 819737
[root@gameserver log]# snmpwalk -v 1 -c public localhost uptime
SNMPv2-MIB::sysUpTime.0 = Timeticks: (186380) 0:31:03.80
[root@gameserver log]# rpm -qa | grep snmp
net-snmp-devel-5.0.8-11
net-snmp-5.0.8-11
net-snmp-utils-5.0.8-11

这个问题把我都搞晕了,很久都没有搞定,请大家帮我看看
 楼主| 发表于 2005-3-4 10:06:54 | 显示全部楼层
up
up
回复 支持 反对

使用道具 举报

发表于 2005-8-4 10:53:39 | 显示全部楼层
是格式的问题了。MRTG对格式要求很严格的,我经常做的。   比如空格和标点都会产生报错的。
Target[10.0.0.2_10.0.0.2]: /10.0.0.2ublic@10.0.0.2:
你这里的  /10.0.0.2是有问题的吧   应该没有/的。

检查一下格式吧。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表