LinuxSir.cn,穿越时空的Linuxsir!

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

配置mrtg遇到问题..哪位兄弟发个snmp.conf来看看!!!

[复制链接]
发表于 2004-2-20 22:00:40 | 显示全部楼层 |阅读模式
我感觉自己的snmp.conf配置的不太好!!

哪位配置好的给我看看...

我是RH8.0,net-snmp-5.0.1的好像...
 楼主| 发表于 2004-2-20 23:35:44 | 显示全部楼层

我的mrtg.cfg

这是我用cfgmaker得到的mrtg.cfg...

里面所有的东东都是#的...

[quoto]# Created by
# ./cfgmaker --global WorkDir:/web/www/html/mrtg --output /etc/mrtg/mrtg.cfg public@localhost


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
WorkDir:/web/www/html/mrtg

######################################################################
# System: linuxserver
# Description: Linux linuxserver 2.4.18-14 #1 Wed Sep 4 12:13:11 EDT 2002 i686
# Contact: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
# Location: Unknown (edit /etc/snmp/snmpd.conf)
######################################################################


### Interface 1 >> Descr: 'lo' | Name: '' | Ip: '' | Eth: '' ###
### The following interface is commented out because:
### * has a speed of  which makes no sense
### * got 'no response received
###     SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
###                       community: "public"
###                      request ID: -113874710
###                     PDU bufsize: 8000 bytes
###                         timeout: 2s
###                         retries: 5
###                         backoff: 1)' from interface when trying to query
#
# Target[localhost_1]: 1:public@localhost:
# SetEnv[localhost_1]: MRTG_INT_IP="" MRTG_INT_DESCR="lo"
# MaxBytes[localhost_1]: 0
# Title[localhost_1]: Traffic Analysis for 1 -- linuxserver
# PageTop[localhost_1]: <H1>Traffic Analysis for 1 -- linuxserver</H1>
#  <TABLE>
#    <TR><TD>System:</TD>     <TD>linuxserver 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>lo  </TD></TR>
#    <TR><TD>ifType:</TD>     <TD> ()</TD></TR>
#    <TR><TD>ifName:</TD>     <TD></TD></TR>
#    <TR><TD>Max Speed:</TD>  <TD>0.0 Bytes/s</TD></TR>
#  </TABLE>


### Interface 2 >> Descr: 'eth0' | Name: '' | Ip: '' | Eth: '' ###
### The following interface is commented out because:
### * has a speed of  which makes no sense
### * got 'no response received
###     SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
###                       community: "public"
###                      request ID: -113874709
###                     PDU bufsize: 8000 bytes
###                         timeout: 2s
###                         retries: 5
###                         backoff: 1)' from interface when trying to query
#
# Target[localhost_2]: 2:public@localhost:
# SetEnv[localhost_2]: MRTG_INT_IP="" MRTG_INT_DESCR="eth0"
# MaxBytes[localhost_2]: 0
# Title[localhost_2]: Traffic Analysis for 2 -- linuxserver
# PageTop[localhost_2]: <H1>Traffic Analysis for 2 -- linuxserver</H1>
#  <TABLE>
#    <TR><TD>System:</TD>     <TD>linuxserver 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>eth0  </TD></TR>
#    <TR><TD>ifType:</TD>     <TD> ()</TD></TR>
#    <TR><TD>ifName:</TD>     <TD></TD></TR>
#    <TR><TD>Max Speed:</TD>  <TD>0.0 Bytes/s</TD></TR>
#  </TABLE>


### Interface 3 >> Descr: 'eth1' | Name: '' | Ip: '' | Eth: '' ###
### The following interface is commented out because:
### * has a speed of  which makes no sense
### * got 'no response received
###     SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
###                       community: "public"
###                      request ID: -113874708
###                     PDU bufsize: 8000 bytes
###                         timeout: 2s
###                         retries: 5
###                         backoff: 1)' from interface when trying to query
#
# Target[localhost_3]: 3:public@localhost:
# SetEnv[localhost_3]: MRTG_INT_IP="" MRTG_INT_DESCR="eth1"
# MaxBytes[localhost_3]: 0
# Title[localhost_3]: Traffic Analysis for 3 -- linuxserver
# PageTop[localhost_3]: <H1>Traffic Analysis for 3 -- linuxserver</H1>
#  <TABLE>
#    <TR><TD>System:</TD>     <TD>linuxserver 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> ()</TD></TR>
#    <TR><TD>ifName:</TD>     <TD></TD></TR>
#    <TR><TD>Max Speed:</TD>  <TD>0.0 Bytes/s</TD></TR>
#  </TABLE>


### Interface 4 >> Descr: 'ppp0' | Name: '' | Ip: '' | 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: "localhost" [127.0.0.1].161)
###                       community: "public"
###                      request ID: -113874707
###                     PDU bufsize: 8000 bytes
###                         timeout: 2s
###                         retries: 5
###                         backoff: 1)' from interface when trying to query
#
# Target[localhost_4]: 4:public@localhost:
# SetEnv[localhost_4]: MRTG_INT_IP="" MRTG_INT_DESCR="ppp0"
# MaxBytes[localhost_4]: 0
# Title[localhost_4]: Traffic Analysis for 4 -- linuxserver
# PageTop[localhost_4]: <H1>Traffic Analysis for 4 -- linuxserver</H1>
#  <TABLE>
#    <TR><TD>System:</TD>     <TD>linuxserver 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>ppp0  </TD></TR>
#    <TR><TD>ifType:</TD>     <TD> ()</TD></TR>
#    <TR><TD>ifName:</TD>     <TD></TD></TR>
#    <TR><TD>Max Speed:</TD>  <TD>0.0 Bytes/s</TD></TR>
#  </TABLE>


[/quoto]
发表于 2004-2-23 10:43:54 | 显示全部楼层
使用指令,检查是否有结果
# snmpwalk -v 1 -c public localhost  .1.3.6.1.2.1.2.2.1.10
IF-MIB::ifInOctets.1 = Counter32: 729209
IF-MIB::ifInOctets.2 = Counter32: 3535618
如果有类似的显示,则snmpd运行基本正常,
修改mrtg.cfg即可
 楼主| 发表于 2004-2-23 12:54:23 | 显示全部楼层
执行上述命令,返回Timeout:No Response...
发表于 2004-2-23 13:20:09 | 显示全部楼层
参考
http://www.linuxsir.cn/forum.php?mod=viewthread&tid=87742

//修改配置文件/etc/snmp/snmpd.conf,允许mrtg读取网络接口的流量数据。

view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
修改为:
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.2
view systemview included .1.3.6.1.2.1.25.1.1
//打开SNMPD服务
# chkconfig snmpd on
# service snmpd start

再重新测试#snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.2.2.1.10
 楼主| 发表于 2004-2-23 14:35:45 | 显示全部楼层
我就是参考他做的..所以才奇怪为啥不行...

才要个snmp.conf来看看...
发表于 2004-2-23 14:50:39 | 显示全部楼层
使用指令,检查是否有结果
#snmpwalk -v 1 -c public localhost uptime
system.sysUpTime.0 = Timeticks: (33930645) 3 days, 22:15:06.45
 楼主| 发表于 2004-2-23 15:34:01 | 显示全部楼层
不管执行什么...都是一个结果::

Timeout: No Response from localhost

所以,还是赶快把snmp.conf给我看看得了...
发表于 2004-2-23 15:51:19 | 显示全部楼层
兄弟,这么着急,我的snmpd.conf如下

com2sec notConfigUser  default       public
  
group   notConfigGroup v1            notConfigUser
group   notConfigGroup v2c           notConfigUser
  
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.2
view    systemview    included   .1.3.6.1.2.1.25.1.1
  
  
access  notConfigGroup ""      any       noauth    exact  systemview none none
  
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
  
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
发表于 2004-3-1 18:09:07 | 显示全部楼层
按照楼上的snmpd.conf和之前mrtg.cfg运行mrtg时得到以下错误信息:
SNMP Error:
Received SNMP response with error code
  error status: noSuchName
  index 2 (OID: 1.3.6.1.2.1.25.1.6.0)
SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
                  community: "public"
                 request ID: 442115856
                PDU bufsize: 8000 bytes
                    timeout: 2s
                    retries: 5
                    backoff: 1)
at /usr/local/mrtg/bin/../lib/mrtg2/SNMP_util.pm line 487
SNMPGET Problem for hrSystemProcesses.0 hrSystemProcesses.0 sysUptime sysName on public@localhost::::::v4only
at /usr/local/mrtg/bin/mrtg line 1835
ERROR: Target[mem][_IN_] ' $target->[2]{$mode} ' did not eval into defined data
ERROR: Target[mem][_OUT_] ' $target->[2]{$mode} ' did not eval into defined data
ERROR: Target[disk][_IN_] ' $target->[4]{$mode} ' did not eval into defined data
ERROR: Target[disk][_OUT_] ' $target->[4]{$mode} ' did not eval into defined data
ERROR: Target[process][_IN_] ' $target->[5]{$mode} ' did not eval into defined data
ERROR: Target[process][_OUT_] ' $target->[5]{$mode} ' did not eval into defined data
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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