|
|
我的操作系统是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 <root@localhost> (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
这个问题把我都搞晕了,很久都没有搞定,请大家帮我看看 |
|