LinuxForum.Fans
Тема

Debian и SNMP

Автор: junior 9 сообщений 2862 просмотров
20.10.2014 23:54 · отредактировано #397409

Ситуация следующая: на сервере стоит Debian 7, установлен net-snmp. Необходимо его мониторить с помощью Cacti. Он мониторится, все норм. Но тут возникла необходимость мониторить disk i/o. Со стороны Cacti все настроено и сделано (шаблоны, xml-файлы), более того Cacti мониторит себя (т.е. localhost, там стоит CentOS 5.6) и в том числе disk i/o тоже (с ним также была проблема, решилась написанием в snmpd.conf строки view systemview included .1). Но мониторить disk i/o удаленного сервера, т.е. Debian 7, он отказывается. Много рылся в инете, разбирался, но так и не нашел в чем проблема.

Вот что выдает Cacti (Debug Information Data Query):

text
+ Running data query [11].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/share/cacti/resource/snmp_queries/net-snmp_devio.xml'
+ XML file parsed ok.
+ <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.13.15.1.1.1' Index Count: 0
+ No SNMP data returned

snmp.conf

text
#
# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loaging them by commenting out the following line.
#mibs :

snmpd.conf

text
###############################################################################
#
# EXAMPLE.conf:
#   An example configuration file for configuring the Net-SNMP agent ('snmpd')
#   See the 'snmpd.conf(5)' man page for details
#
#  Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
#  AGENT BEHAVIOUR
#

# Listen for connections from the local system only #agentAddress udp:127.0.0.1:161 # Listen for connections on all interfaces (both IPv4 *and* IPv6) agentAddress udp:161,udp6:[::1]:161

############################################################################### # # SNMPv3 AUTHENTICATION # # Note that these particular settings don't actually belong here. # They should be copied to the file /var/lib/snmp/snmpd.conf # and the passwords changed, before being uncommented in that file *only*. # Then restart the agent

# createUser authOnlyUser MD5 "remember to change this password" # createUser authPrivUser SHA "remember to change this one too" DES # createUser internalUser MD5 "this is only ever used internally, but still change the password"

# If you also change the usernames (which might be sensible), # then remember to update the other occurances in this example config file to match. ############################################################################### # # ACCESS CONTROL #

# system + hrSystem groups only #view all included .iso #view systemonly included .1 #view systemonly included .1.3.6.1.2.1 #view systemonly included .1.3.6.1.4.1.2021.13.15 #view systemonly included .1.3.6.1.2.1.25.1

# Full access from the local host rocommunity public localhost # Default access to basic system info #rocommunity public default -V systemonly

# Full access from an example network # Adjust this network address to match your local # settings, change the community string, # and check the 'agentAddress' setting above rocommunity public 5.9.17.175 # Full read-only access for SNMPv3 rouser authOnlyUser # Full write access for encrypted requests # Remember to activate the 'createUser' lines above #rwuser authPrivUser priv

# It's no longer typically necessary to use the full 'com2sec/group/access' configuration # r[ou]user and r[ow]community, together with suitable views, should cover most requirements

############################################################################### # # SYSTEM INFORMATION #

# Note that setting these values here, results in the corresponding MIB objects being 'read-only' # See snmpd.conf(5) for more details sysLocation Sitting on the Dock of the Bay sysContact Me <me@example.org> # Application + End-to-End layers sysServices 72

# # Process Monitoring # # At least one 'mountd' process proc mountd # No more than 4 'ntalkd' processes - 0 is OK proc ntalkd 4 # At least one 'sendmail' process, but no more than 10 proc sendmail 10 1

# Walk the UCD-SNMP-MIB::prTable to see the resulting output # Note that this table will be empty if there are no "proc" entries in the snmpd.conf file

# # Disk Monitoring # # 10MBs required on root disk, 5% free on /var, 10% free on all other disks disk / 10000 disk /var 5% includeAllDisks 10%

# Walk the UCD-SNMP-MIB::dskTable to see the resulting output # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file

# # System Load #

# Unacceptable 1-, 5-, and 15-minute load averages load 12 10 5

# Walk the UCD-SNMP-MIB::laTable to see the resulting output # Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file

############################################################################### # # ACTIVE MONITORING #

# send SNMPv1 traps trapsink localhost public # send SNMPv2c traps #trap2sink localhost public # send SNMPv2c INFORMs #informsink localhost public

# Note that you typically only want *one* of these three lines # Uncommenting two (or all three) will result in multiple copies of each notification.

# # Event MIB - automatically generate alerts # # Remember to activate the 'createUser' lines above iquerySecName internalUser rouser internalUser # generate traps on UCD error conditions defaultMonitors yes # generate traps on linkUp/Down linkUpDownNotifications yes ############################################################################### # # EXTENDING THE AGENT #

# # Arbitrary extension commands # extend test1 /bin/echo Hello, world! extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35 #extend-sh test3 /bin/sh /tmp/shtest

# Note that this last entry requires the script '/tmp/shtest' to be created first, # containing the same three shell commands, before the line is uncommented

# Walk the NET-SNMP-EXTEND-MIB tables (nsExtendConfigTable, nsExtendOutput1Table # and nsExtendOutput2Table) to see the resulting output

# Note that the "extend" directive supercedes the previous "exec" and "sh" directives # However, walking the UCD-SNMP-MIB::extTable should still returns the same output, # as well as the fuller results in the above tables.

# # "Pass-through" MIB extension command # #pass .1.3.6.1.4.1.8072.2.255 /bin/sh PREFIX/local/passtest #pass .1.3.6.1.4.1.8072.2.255 /usr/bin/perl PREFIX/local/passtest.pl

# Note that this requires one of the two 'passtest' scripts to be installed first, # before the appropriate line is uncommented. # These scripts can be found in the 'local' directory of the source distribution, # and are not installed automatically.

# Walk the NET-SNMP-PASS-MIB::netSnmpPassExamples subtree to see the resulting output

# # AgentX Sub-agents # # Run as an AgentX master agent master agentx # Listen for network connections (from localhost) # rather than the default named socket /var/agentx/master #agentXSocket tcp:localhost:705

Реакция на snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.13.15.1.1.1 (мониторю с Debian самого себя (с сервера там где Cacti тоже самое))

text
UCD-DISKIO-MIB::diskIOIndex = No Such Instance currently exists at this OID

Играясь с OID, дошел что .1.3.6.1.4.1.2021.13 выводит ещё что то:

text
UCD-DLMOD-MIB::dlmodNextIndex.0 = INTEGER: 1

А вот .1.3.6.1.4.1.2021.13.15 уже нет:

text
UCD-DISKIO-MIB::ucdDiskIOMIB = No Such Object available on this agent at this OID

В /usr/share/mibs следующие:

text
iana/   ietf/    netsnmp/

В /iana:

text
IANA-ADDRESS-FAMILY-NUMBERS-MIB  IANA-IPPM-METRICS-REGISTRY-MIB  IANA-MAU-MIB      IANATn3270eTC-MIB
IANA-CHARSET-MIB                 IANA-ITU-ALARM-TC-MIB           IANA-PRINTER-MIB  IANAifType-MIB
IANA-FINISHER-MIB                IANA-LANGUAGE-MIB               IANA-PWE3-MIB     IPFIX-SELECTOR-MIB
IANA-GMPLS-TC-MIB                IANA-MALLOC-MIB                 IANA-RTPROTO-MIB

В /ietf:

text
ACCOUNTING-CONTROL-MIB                   IF-INVERTED-STACK-MIB               RFC1382-MIB
ADSL-LINE-EXT-MIB                        IF-MIB                              RFC1414-MIB
ADSL-LINE-MIB                            IFCP-MGMT-MIB                       RIPv2-MIB
ADSL-TC-MIB                              IGMP-STD-MIB                        RMON-MIB
ADSL2-LINE-MIB                           INET-ADDRESS-MIB                    RMON2-MIB
ADSL2-LINE-TC-MIB                        INTEGRATED-SERVICES-GUARANTEED-MIB  ROHC-MIB
AGENTX-MIB                               INTEGRATED-SERVICES-MIB             ROHC-RTP-MIB
AGGREGATE-MIB                            INTERFACETOPN-MIB                   ROHC-UNCOMPRESSED-MIB
ALARM-MIB                                IP-FORWARD-MIB                      RS-232-MIB
APM-MIB                                  IP-MIB                              RSERPOOL-MIB
APPC-MIB                                 IPATM-IPMC-MIB                      RSTP-MIB
APPLETALK-MIB                            IPFIX-MIB                           RSVP-MIB
APPLICATION-MIB                          IPMCAST-MIB                         RTP-MIB
APPN-DLUR-MIB                            IPMROUTE-STD-MIB                    SCSI-MIB
APPN-MIB                                 IPOA-MIB                            SCTP-MIB
APPN-TRAP-MIB                            IPS-AUTH-MIB                        SFLOW-MIB
APS-MIB                                  IPSEC-SPD-MIB                       SIP-COMMON-MIB
ARC-MIB                                  IPV6-FLOW-LABEL-MIB                 SIP-MIB
ATM-ACCOUNTING-INFORMATION-MIB           IPV6-ICMP-MIB                       SIP-SERVER-MIB
ATM-MIB                                  IPV6-MIB                            SIP-TC-MIB
ATM-TC-MIB                               IPV6-MLD-MIB                        SIP-UA-MIB
ATM2-MIB                                 IPV6-TC                             SLAPM-MIB
BGP4-MIB                                 IPV6-TCP-MIB                        SMON-MIB
BRIDGE-MIB                               IPV6-UDP-MIB                        SMUX-MIB
CAPWAP-BASE-MIB                          ISCSI-MIB                           SNA-NAU-MIB
CAPWAP-DOT11-MIB                         ISDN-MIB                            SNA-SDLC-MIB
CHARACTER-MIB                            ISIS-MIB                            SNMP-COMMUNITY-MIB
CIRCUIT-IF-MIB                           ISNS-MIB                            SNMP-FRAMEWORK-MIB
CLNS-MIB                                 ITU-ALARM-MIB                       SNMP-IEEE802-TM-MIB
COPS-CLIENT-MIB                          ITU-ALARM-TC-MIB                    SNMP-MPD-MIB
DECNET-PHIV-MIB                          Job-Monitoring-MIB                  SNMP-NOTIFICATION-MIB
DIAL-CONTROL-MIB                         L2TP-MIB                            SNMP-PROXY-MIB
DIFFSERV-CONFIG-MIB                      LANGTAG-TC-MIB                      SNMP-REPEATER-MIB
DIFFSERV-DSCP-TC                         LMP-MIB                             SNMP-SSH-TM-MIB
DIFFSERV-MIB                             MALLOC-MIB                          SNMP-TARGET-MIB
DIRECTORY-SERVER-MIB                     MAU-MIB                             SNMP-TSM-MIB
DISMAN-EVENT-MIB                         MGMD-STD-MIB                        SNMP-USER-BASED-SM-MIB
DISMAN-EXPRESSION-MIB                    MIDCOM-MIB                          SNMP-USM-AES-MIB
DISMAN-NSLOOKUP-MIB                      MIOX25-MIB                          SNMP-USM-DH-OBJECTS-MIB
DISMAN-PING-MIB                          MIP-MIB                             SNMP-VIEW-BASED-ACM-MIB
DISMAN-SCHEDULE-MIB                      MOBILEIPV6-MIB                      SNMPv2-CONF
DISMAN-SCRIPT-MIB                        MPLS-FTN-STD-MIB                    SNMPv2-M2M-MIB
DISMAN-TRACEROUTE-MIB                    MPLS-L3VPN-STD-MIB                  SNMPv2-MIB
DLSW-MIB                                 MPLS-LC-ATM-STD-MIB                 SNMPv2-PARTY-MIB
DNS-RESOLVER-MIB                         MPLS-LC-FR-STD-MIB                  SNMPv2-PDU
DNS-SERVER-MIB                           MPLS-LDP-ATM-STD-MIB                SNMPv2-SMI
DOCS-BPI-MIB                             MPLS-LDP-FRAME-RELAY-STD-MIB        SNMPv2-TC
DOCS-CABLE-DEVICE-MIB                    MPLS-LDP-GENERIC-STD-MIB            SNMPv2-TM
DOCS-IETF-BPI2-MIB                       MPLS-LDP-STD-MIB                    SNMPv2-USEC-MIB
DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB  MPLS-LSR-STD-MIB                    SONET-MIB
DOCS-IETF-QOS-MIB                        MPLS-TC-STD-MIB                     SOURCE-ROUTING-MIB
DOCS-IETF-SUBMGT-MIB                     MPLS-TE-STD-MIB                     SSPM-MIB
DOCS-IF-MIB                              MSDP-MIB                            SYSAPPL-MIB
DOT12-IF-MIB                             MTA-MIB                             SYSLOG-MSG-MIB
DOT12-RPTR-MIB                           Modem-MIB                           SYSLOG-TC-MIB
DOT3-EPON-MIB                            NAT-MIB                             T11-FC-FABRIC-ADDR-MGR-MIB
DOT3-OAM-MIB                             NEMO-MIB                            T11-FC-FABRIC-CONFIG-SERVER-MIB
DPI20-MIB                                NETWORK-SERVICES-MIB                T11-FC-FABRIC-LOCK-MIB
DS0-MIB                                  NHRP-MIB                            T11-FC-FSPF-MIB
DS0BUNDLE-MIB                            NOTIFICATION-LOG-MIB                T11-FC-NAME-SERVER-MIB
DS1-MIB                                  OPT-IF-MIB                          T11-FC-ROUTE-MIB
DS3-MIB                                  OSPF-MIB                            T11-FC-RSCN-MIB
DSA-MIB                                  OSPF-TRAP-MIB                       T11-FC-SP-AUTHENTICATION-MIB
DSMON-MIB                                OSPFV3-MIB                          T11-FC-SP-POLICY-MIB
DVB-RCS-MIB                              P-BRIDGE-MIB                        T11-FC-SP-SA-MIB
EBN-MIB                                  PARALLEL-MIB                        T11-FC-SP-TC-MIB
EFM-CU-MIB                               PIM-BSR-MIB                         T11-FC-SP-ZONING-MIB
ENTITY-MIB                               PIM-MIB                             T11-FC-VIRTUAL-FABRIC-MIB
ENTITY-SENSOR-MIB                        PIM-STD-MIB                         T11-FC-ZONE-SERVER-MIB
ENTITY-STATE-MIB                         PINT-MIB                            T11-TC-MIB
ENTITY-STATE-TC-MIB                      PKTC-IETF-EVENT-MIB                 TCP-ESTATS-MIB
ETHER-CHIPSET-MIB                        PKTC-IETF-MTA-MIB                   TCP-MIB
EtherLike-MIB                            PKTC-IETF-SIG-MIB                   TCPIPX-MIB
FC-MGMT-MIB                              POLICY-BASED-MANAGEMENT-MIB         TE-LINK-STD-MIB
FCIP-MGMT-MIB                            POWER-ETHERNET-MIB                  TE-MIB
FDDI-SMT73-MIB                           PPP-BRIDGE-NCP-MIB                  TIME-AGGREGATE-MIB
FIBRE-CHANNEL-FE-MIB                     PPP-IP-NCP-MIB                      TN3270E-MIB
FLOW-METER-MIB                           PPP-LCP-MIB                         TN3270E-RT-MIB
FORCES-MIB                               PPP-SEC-MIB                         TOKEN-RING-RMON-MIB
FR-ATM-PVC-SERVICE-IWF-MIB               PTOPO-MIB                           TOKENRING-MIB
FR-MFR-MIB                               PW-ATM-MIB                          TOKENRING-STATION-SR-MIB
FRAME-RELAY-DTE-MIB                      PW-ENET-STD-MIB                     TPM-MIB
FRNETSERV-MIB                            PW-MPLS-STD-MIB                     TRANSPORT-ADDRESS-MIB
FRSLD-MIB                                PW-STD-MIB                          TRIP-MIB
Finisher-MIB                             PW-TC-STD-MIB                       TRIP-TC-MIB
GMPLS-LABEL-STD-MIB                      PW-TDM-MIB                          TUNNEL-MIB
GMPLS-LSR-STD-MIB                        PerfHist-TC-MIB                     UCD-DISKIO-MIB
GMPLS-TC-STD-MIB                         Printer-MIB                         UCD-SNMP-MIB
GMPLS-TE-STD-MIB                         Q-BRIDGE-MIB                        UDP-MIB
GSMP-MIB                                 RADIUS-ACC-CLIENT-MIB               UDPLITE-MIB
HC-ALARM-MIB                             RADIUS-ACC-SERVER-MIB               UPS-MIB
HC-PerfHist-TC-MIB                       RADIUS-AUTH-CLIENT-MIB              URI-TC-MIB
HC-RMON-MIB                              RADIUS-AUTH-SERVER-MIB              VDSL-LINE-EXT-MCM-MIB
HCNUM-TC                                 RADIUS-DYNAUTH-CLIENT-MIB           VDSL-LINE-EXT-SCM-MIB
HDSL2-SHDSL-LINE-MIB                     RADIUS-DYNAUTH-SERVER-MIB           VDSL-LINE-MIB
HOST-RESOURCES-MIB                       RAQMON-MIB                          VDSL2-LINE-MIB
HOST-RESOURCES-TYPES                     RAQMON-RDS-MIB                      VDSL2-LINE-TC-MIB
HPR-IP-MIB                               RDBMS-MIB                           VPN-TC-STD-MIB
HPR-MIB                                  RFC1155-SMI                         VRRP-MIB
IBM-6611-APPN-MIB                        RFC1213-MIB                         WWW-MIB
IF-CAP-STACK-MIB                         RFC1381-MIB

В /netsnmp:

text
GNOME-SMI           NET-SNMP-EXAMPLES-MIB  NET-SNMP-MONITOR-MIB  NET-SNMP-TC        UCD-DISKIO-MIB   UCD-SNMP-MIB
LM-SENSORS-MIB      NET-SNMP-EXTEND-MIB    NET-SNMP-PASS-MIB     NET-SNMP-VACM-MIB  UCD-DLMOD-MIB
NET-SNMP-AGENT-MIB  NET-SNMP-MIB           NET-SNMP-SYSTEM-MIB   UCD-DEMO-MIB       UCD-IPFWACC-MIB

Заранее спасибо за помощь и подсказки)

21.10.2014 10:43 · отредактировано #397436

А что показывает

text
snmpwalk -v 2c -c public debianhost .1.3.6.1.4.1.2021.13.15

?

21.10.2014 11:09 · отредактировано #397444
Macumazan написал:
А что показывает
text
snmpwalk -v 2c -c public debianhost .1.3.6.1.4.1.2021.13.15

?

Показывает следующее:

text
getaddrinfo: debianhost Name or service not known
snmpwalk: Unknown host (debianhost)

Такое выдаёт всё, начиная с .1

21.10.2014 11:28 #397449

debianhost надо заменить на ip

21.10.2014 11:46 · отредактировано #397451

Если со стороны этого же дебианхоста, то

text
snmpwalk -v 2c -c public 85.131.179.201 .1
Timeout: No Response from 85.131.179.201

Если со стороны сервера где стоит Cacti, то что я писал раньше:

text
UCD-DISKIO-MIB::ucdDiskIOMIB = No Such Object available on this agent at this OID
21.10.2014 12:00 · отредактировано #397452

Собственно такое же со стандартным в Cacti ucd/net - Get Monitored Partitions. Даже на локалхосте где стоит Cacti.

text
+ Running data query [2].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/share/cacti/resource/snmp_queries/net-snmp_disk.xml'
+ XML file parsed ok.
+ <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.9.1.1' Index Count: 0
+ No SNMP data returned
 
 snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.9.1.1
UCD-SNMP-MIB::dskIndex = No Such Instance currently exists at this OID

Такое впечатление что нету доступа к обьектам, но в snmpd.conf стоит view .1 , т.е. все как я понимаю. Каким чудом на локлхосте хотя бы diski/o заработал, тоже не совсем понятно.

21.10.2014 15:04 #397500

junior,
Пользуйтесь тегами оформления сообщений BBCode.

21.10.2014 18:46 #397520

А если с самого дебиана?

text
snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.13.15
21.10.2014 18:59 · отредактировано #397522

Писал в первом сообщении:

text
UCD-DISKIO-MIB::ucdDiskIOMIB = No Such Object available on this agent at this OID
Войдите или зарегистрируйтесь, чтобы ответить.