Скомилировал net-snmp 5.6 для ARM-процессора, поместил snmpd, MIB-ы и snmpd.conf на плату.
snmpd.conf, генерировал с использованием snmpconf
Код: Выделить всё
###########################################################################
# SECTION: System Information Setup
#
# This section defines some of the information reported in
# the "system" mib group in the mibII tree.
# syslocation: The [typically physical] location of the system.
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysLocation.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: location_string
syslocation DM355
# syscontact: The contact information for the administrator
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysContact.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: contact_string
syscontact user@test.com
# sysservices: The proper value for the sysServices object.
# arguments: sysservices_number
sysservices 76
###########################################################################
# SECTION: Access Control Setup
#
# This section defines who is allowed to talk to your running
# snmp agent.
# rocommunity: a SNMPv1/SNMPv2c read-only access community name
# arguments: community [default|hostname|network/bits] [oid]
rocommunity public
# rwcommunity: a SNMPv1/SNMPv2c read-write access community name
# arguments: community [default|hostname|network/bits] [oid]
rwcommunity privateЗапуск демона
Shell
# snmpd -c /etc/snmpd.conf -Le -M/root/mib -d -q -V
# NET-SNMP version 5.6
# ps w | grep snmpd | grep -v grep
317 root 3892 S snmpd -c /etc/snmpd.conf -Le -M/root/mib -d -q -V
# netstat -ane
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
netstat: /proc/net/tcp6: No such file or directory
udp 1380 0 0.0.0.0:161 0.0.0.0:*
udp 0 0 0.0.0.0:726 0.0.0.0:*MIB-ы:
Код: Выделить всё
# ls /root/mib/
AGENTX-MIB.txt RFC-1215.txt
BRIDGE-MIB.txt RFC1155-SMI.txt
DISMAN-EVENT-MIB.txt RFC1213-MIB.txt
DISMAN-SCHEDULE-MIB.txt RMON-MIB.txt
DISMAN-SCRIPT-MIB.txt SCTP-MIB.txt
EtherLike-MIB.txt SMUX-MIB.txt
HCNUM-TC.txt SNMP-COMMUNITY-MIB.txt
HOST-RESOURCES-MIB.txt SNMP-FRAMEWORK-MIB.txt
HOST-RESOURCES-TYPES.txt SNMP-MPD-MIB.txt
IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt SNMP-NOTIFICATION-MIB.txt
IANA-LANGUAGE-MIB.txt SNMP-PROXY-MIB.txt
IANA-RTPROTO-MIB.txt SNMP-TARGET-MIB.txt
IANAifType-MIB.txt SNMP-USER-BASED-SM-MIB.txt
IF-INVERTED-STACK-MIB.txt SNMP-USM-AES-MIB.txt
IF-MIB.txt SNMP-USM-DH-OBJECTS-MIB.txt
INET-ADDRESS-MIB.txt SNMP-VIEW-BASED-ACM-MIB.txt
IP-FORWARD-MIB.txt SNMPv2-CONF.txt
IP-MIB.txt SNMPv2-MIB.txt
IPV6-ICMP-MIB.txt SNMPv2-SMI.txt
IPV6-MIB.txt SNMPv2-TC.txt
IPV6-TC.txt SNMPv2-TM.txt
IPV6-TCP-MIB.txt TCP-MIB.txt
IPV6-UDP-MIB.txt TRANSPORT-ADDRESS-MIB.txt
NET-SNMP-AGENT-MIB.txt UCD-DEMO-MIB.txt
NET-SNMP-EXAMPLES-MIB.txt UCD-DISKIO-MIB.txt
NET-SNMP-EXTEND-MIB.txt UCD-DLMOD-MIB.txt
NET-SNMP-MIB.txt UCD-IPFWACC-MIB.txt
NET-SNMP-PASS-MIB.txt UCD-SNMP-MIB.txt
NET-SNMP-TC.txt UDP-MIB.txt
NOTIFICATION-LOG-MIB.txtПробую со своего рабочего места получить информацию следующей командой snmpget -v 2c -c public 192.168.10.253 .1.3.6.1
Вывод с платы:
Shell
Received 38 byte packet from UDP: [192.168.10.3]:36916->[192.168.10.253]:161
0000: 30 24 02 01 01 04 06 70 75 62 6C 69 63 A0 17 02 0$.....public...
0016: 04 5E 1C 99 3F 02 01 00 02 01 00 30 09 30 07 06 .^..?......0.0..
0032: 03 2B 06 01 05 00 .+....
Received SNMP packet(s) from UDP: [192.168.10.3]:36916->[192.168.10.253]:161
GET message
-- SNMPv2-SMI::internetИ всё, тишина. На стороне клиента я получаю Timeout: No Response from 192.168.10.253
С snmp только начинаю работать, поэтому ещё не ориентируюсь во всех тонкостях.
Собственно вопрос - в чём проблема и как её можно решить?
Спасибо.
Upd:
Пересобрал с поддержкой отладочного вывода, результат на команду snmpget -v 2c -c public 192.168.10.253 1.3.6.1.2.1.1.3 - SNMPv2-MIB::sysUpTime No Such Instance currently exists at this OID
Я правильно понимаю, что есть некая проблема с MIB-ми?
Upd:
И снова здравствуйте! С No Such Instance разобрался, была моя ошибка. Итак, команда snmpget -v 2c -c public 192.168.10.253 .1.3.6.1.2.1.1.3.0 даёт ответ Timeout: No Response from 192.168.10.253.
Отладочный вывод snmpd:
Код: Выделить всё
trace: netsnmp_handle_request(): snmp_agent.c, 3232:
results: request results (status = 0):
trace: netsnmp_handle_request(): snmp_agent.c, 3235:
results: SNMPv2-MIB::sysUpTime.0 0:0:00:33.33Таким образом получается, что команда успешно доходит до сервера и выполняется на нём. Но результат выполнения не возвращается клиенту. Почему?