What are the network devices that Zabbix 3.0 monitors?

王林
Release: 2023-06-04 08:44:50
forward
2181 people have browsed it

Introduction to SNMP

1 Overview of SNMP

SNMP has developed to become the most widely used network management protocol. The currently applied versions mainly include SNMP v1, SNMP v2c and SNMP v3. The main differences between the versions are in the definition of information, the operation of communication protocols and the security mechanism. At the same time, two extensions of SNMP applications, RMON (Remote Network Monitoring) and RMON2, have also appeared.

From the perspective of the physical layer, using SNMP to manage the network should include: network management station (NMS), agent (Agent), and proxy server (proxy). In network management, at least one NMS is required to issue instructions and receive notification information. Agents can respond to requests from management nodes and can also proactively generate notification information. There can be one or more Agents in network management. Proxy forwards SNMP requests and notification messages between different networks or different versions.

From the perspective of the protocol layer, SNMP includes: SMI (Structure of Management Information, Management Information Structure) and MIB (Management Information Base, Management Information Base). SMI is a subset of ASN.1 (Abstract SyntaxNotation one). SMI stipulates that elements, custom data types and macros in ASN.1 can be used in SNMP. These elements, data types, macros and Other related syntaxes can be used to define MIBs in SNMP. MIB is an abstract description of manageable objects in Agent. In SNMP, MIB is organized and viewed in a tree structure. Each node in the tree is called an OID (Object Identifier). It is organized in a manner similar to a website domain name, and each node is represented by a certificate, such as 1.3. 6.4.

SNMP is an application layer protocol belonging to the TCP/IP protocol stack, similar to HTTP and FTP protocols. It's just that the SNMP transport layer uses the UDP protocol.

In SNMP v1, a simple authentication mode from NMS to Agent is provided - Community. NMS needs to provide the Community string when sending a request to Agent. The Agent needs to check after receiving the string. Is it consistent with the local one? There are obvious security risks due to the use of clear text to transfer Community.

In 1996, IETF released SNMP v2c (Community-BasedSNMP v2). This version defined communication between management stations based on v1. All support distributed network management, but in terms of security mechanism Same as v1.

In 1998, IETF released SNMP v3, which expanded security (user-based security model and view-based access control model) and management mechanisms based on SNMP v2. In terms of security, the v3 version adds security parameters to protocol messages, allowing encrypted transmission and mandatory verification of messages. It is a secure protocol. SNMP v3 uses the modular idea to define each component module in the protocol, improves the protocol architecture, and most importantly, remains compatible with SNMP v1 and SNMP v2.

2 Functions of SNMP

The agent in SNMP is mainly responsible for uploading information. In addition to the level functions of the SNMP protocol, NMS also has the ability to log and notify information that has been sent and received. recording, management and configuration functions, and can provide a graphical configuration and management interface.

In order to realize these functions, SNMP contains a series of operation commands, mainly including:

  • Reading commands: Get series commands, NMS sends requests for collection management like Agent information.

  • Set command: Set command, NMs writes the data carried in the message to the Agent.

  • Alarm function: Trap series, Agent actively sends alarm/event message information to NMS.

Zabbix 3.0监控网络设备有哪些

Figure 13-1

1. Get operation

Get operation is an operation actively initiated by NMS. In addition to the Get request flag, the outgoing message also includes the OID name and value pair to be requested, and the management object information is transferred in the form of binding of this name and value pair. Of course, the value corresponding to OID in the Get operation is NILL.

2. Get-Next operation

The Get-Next operation is similar to the Get function. The difference is that the queried information is not the OID information bound in the message but the next one of the object. OID information (if the next OID information is readable). For example, NMS wants to collect the information of sysLocation, the next node of sysName on the Agent side. In the request message, it is sysName.0, and the returned message is bound to sysLocation.0 and value.

3. The Get-Bulk operation

is actually a collection of multiple Get-Next operations. This is a newly added operation method in SNMP v2.

4. Set operation

Set operation can set parameters for OID with writable permissions to achieve parameter management, configuration and control of the device. Different from the Get operation binding variables, Set needs to bind the value of the corresponding OID setting.

5. Get-Response

Get-Response is a response to the Get and Set commands of NMS. Depending on the command and the parameters in the command, the corresponding return variable is bound. information and error status information (indicating the success or failure of command execution), etc.

6. Trap series

Trap is a mechanism for Agent to proactively report important events to NMS. For such reports, NMS does not need to respond to Agent. The content in the trap information indicates what happened at what time and where.

3 SMI and MIB

1、SMI

SMI is an information module defined in ASN.1 syntax in SNMP and is a subset of ASN.1. These modules contain many SNMP-specific macros, custom data types and rules, etc. There are three main purposes for defining these macros, data types, and rules: one is to represent and define unique data types in SNMP applications; the other is to simplify the definition method of management objects; the third is to allocate the object identifier space and management objects in SNMP Coding method. SNMP is based on these information modules defined in RFC documents to standardize the protocol, allowing various organizations, enterprises and individuals to maintain consistency when defining management objects.

In SNMP, two versions of SMI are actually defined, namely SMI v1 defined in RFC 1151 and SMI v2 defined in RFC 2578. In SMI v1, several data types, rule descriptions, OBJECT-TYPE macros, etc. are simply defined. In SMI v2, all related content is completely organized in a modular definition manner.

The basic data types defined in SMI v1 are:

  • INTEGER: It is actually a 32-bit integer.

  • OCTET STRING: 0 or more 8-bit characters (single byte), which can represent text characters or physical addresses. The value range is 0 to 65535.

  • OBJECT IDENTIFIER: OID expressed in dotted decimal notation.

  • NULL: It is only defined in SMI v1 and is no longer used in SMI v2.

  • SEQUENCE: Definition list.

  • SEQUENCE OF: Define the table.

In SMI v2, the scope restrictions and updates for the above data types are further clarified, and the BITS type is also introduced.

Custom data types in SMI v1 include:

  • NetworkAddress (network address), which can be a network address family other than the Internet,

NetworkAddress::= CHOICE {Internet IPAddress}

  • 32-bit IP address, expressed in network byte order

IPAddress::= [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4))

  • Counter type value grows in one direction. After reaching the maximum, it returns to 0 and starts counting again (after Agent restarts It will also be reset to 0), mainly used to count the number of bytes sent and received by the interface

Counter::= [APPLICATION 1] IMPLICIT INTEGER (0.. 4294967295)

  • The Gauge type value can be increased or decreased, and remains at the maximum value when it reaches the maximum value. For example, the rate of the interface in the router can be expressed by this type

Gauge::= [APPLICATION 2]IMPLICIT INTEGER (0 .. 4294967295)

  • TimeTicks uses 0.01 seconds for timing, indicating the time interval between two time points. Requires the timing base to be stated in the description.

TimeTicks::= [APPLICATION 3] IMPLICIT INTEGER (0.. 4294967295)

  • Opaque encodes other ASN.1 types The value is encapsulated twice. For backward compatibility, this type is also defined in SMIv2 and is not recommended.

Opaque ::= [APPLICATION 4 ] IMPLICIT OCTET STRING

The custom data types that have changed in SMI v2 compared to SMI v1 are:

  • Gauge32 and Gauge are actually the same. Gauge32 and Unsigned32 share the same application type tag, therefore their encoding is essentially identical..

Gauge32 ::= [APPLICATION 2 ] IMPLICIT INTEGER (0 .. 4294967295)

Unsigned32 ::= [APPLICATION 2 ] IMPLICIT INTEGER (0 .. 4294967295)

  • Counter64 is a larger range of Counter, there are 64: 2^64-1 (0..18446744073709551615). Counter32 is used in the standard MIB module only when the counter returns to 0 in less than 1 hour.

Counter64::= [APPLICATION6] IMPLICIT INTEGER (0..18446744073709551615)

The IPAddress type is still retained in SMI v2 and has no changes. However, it does not apply to the 128-bit address of IPv6. A further explanation of Counter32: The current count value has a clear meaning only when there is an initial value and a recorded change.

From the perspective of MIB, SMI is a charter that directly guides the definition of MIB, defines the data type and syntax of MIB, and allocates OID space for management objects in MIB.

2, MIB

MIB is a collection of management information. It is organized according to the agreement based on business needs or network management standards. A structured text file written with rules and definition syntax.

Each management object in the management information base (MIB) needs to clearly describe all its attributes, including name, description, data type and other information. The contents of these properties can be identified by communicating parties through the object's unique identifier (OID). In other words, MIB is a bridge for communication between NMS and Agent. Only when Agent implements the MIB and NMS knows the MIB can the two work together correctly to implement corresponding management functions. Only after the MIB is imported into NMS can NMS know all the details of the objects to be managed. If the management object defined in the MIB is implemented in the agent, the agent supports the MIB.

An Agent can implement multiple MIBs, and each MIB can contain more or less management objects. There are no clear requirements. MIB is mainly composed of two parts. One part is the standard management object defined by the International Organization for Standardization, including MIB-I (RFC1156) and MIB-II (RFC1213). All devices connected to the network support general and basic management objects, which are defined in the standard MIB. The other part is the private MIB customized by major manufacturers, organizations or individuals. These private MIBs are customized by manufacturers according to the needs of device management, and objects that need to be managed that are not in the standard MIB. The private MIB is defined under the node enterprises (1.3.6.1.4.1).

The standard MIB divides the management objects into 10 groups, which are 10 branches in the MIB tree. They are: System, Interfaces, AT (Address Translation, the status is deprecated, indicating that the next version will not Using), IP, ICMP, TCP, UDP, EGP, Transmission, SNMP, their parent node is 1.3.6.1.2.1 (mib-2). The management objects in these 10 groups are one of the most important parts of network management.

  • System group: Mainly used to describe Agent system level information. Including sysName, sysLocation, sysDescr, sysServices, sysUpTime, sysContact, sysObjectID, etc. These OIDs provide information such as the name, location, and online time of the device, which are very important in network management. In actual environments, this information cannot be updated in time and is easily ignored.

  • Interfaces group: This group is used to provide all interface information of network devices. Including interface type, interface description, interface rate, interface status, etc.

  • AT group: Address translation group. This group of times is a table object that implements the mapping relationship between network addresses and physical addresses. By traversing the table, the correspondence between the IP address and the MAC address can be obtained.

  • IP group: defines the management object of IP layer related information. These objects include IP packets, error information, address information, routing information, and address mapping information.

  • ICMP group: This group defines 26 scalar objects that describe the sending and receiving of various ICMP messages. They are all of Counter type. These objects can easily provide the message sending and receiving rate and the rate of various ICMP message types (requests, responses).

  • TCP group: This group mainly includes: TCP retransmission policy for configuration management, objects with the longest and shortest retransmission time, and link rejected requests for performance management. Objects such as the number of transfer records between TCP communication states, the total number of retransmissions, and the total number of receiving errors, technical objects for sending and receiving TCP data segments that may be used for billing management, and tcpConnTable table objects that may be used for security management. By analyzing the records in this table Get the remote IP, port number, status and other information, and track suspicious links from the remote end.

  • UDP group: This group includes objects that can be used for performance and accounting management of counting objects for receiving and sending UDP packets, error report counting objects, and related information such as ports and IP addresses. .

  • EGP (Exterior Gateway Protocol) group: EGP is a protocol used to exchange routing information between autonomous systems (neighbors). This group includes the egpNeighTable table object for various information such as neighbor running status for user failure management, the domain number of the local autonomous system for user configuration management, the rate of EGP messages entering and leaving the local entity for performance management, and the error count object.

  • Transmission group: The function of this group is to provide corresponding management information according to different transmission media. This group is quite special. MIB-II does not define clear management objects under this branch. Instead, the corresponding interface type is added to the reorganization when a certain transmission medium needs to be managed.

  • SNMP group: This group defines objects related to SNMP in detail. For example, statistics on the number of different types of errors that can be used for fault management, whether trap authentication failures generate message objects that can be used for configuration management, and statistics on the number of various messages sent and received that can be used for performance management.

4 OID tree

In SNMP, all management objects are organized in a tree structure, and the management objects are embodied as nodes in the tree, and this Trees are maintained and managed by relevant international standardization organizations. Through this structured and hierarchical organization, it is very convenient to manage and expand objects. This management and expansion is reflected in the allocation of nodes.

Enterprises, organizations or individuals have the right to apply for nodes from international organizations to become a branch in the tree structure. After successfully applying for a node, you can freely allocate other nodes under the branch to meet its monitoring or management business needs.

OID number, also called MIB number. MIB is actually an ASN.1 module composed of OIDs, which is embodied in a tree structure in reality. There are many standard MIBs on the Internet. SNMP defines MIB-I, MIB-II, etc., and also includes MIBs defined by enterprises, organizations, and individuals. As shown below.

In the OID tree, only the top-level root node does not have a specific number and can be regarded as a virtual node. The other nodes have unique numbers at the same level for distinction. .

The next-level nodes at the top are ccitt (0) managed by CCITT (the current ITU-T) and ISO (1) managed by ISO.

There are many sub-nodes under the internet node. Directory (1) is reserved and may be used for OSI directory services in the future. mgmt(2) is the responsibility of the IAB and is used to define standard management objects in RFC, which are actually MIB-I and MIB-II. experimental(3) is also managed by the IAB and is used to define management objects of the experimental nature of the internet. Private (4) and the lower-level node enterprises (1) are allocated and managed by IANA. The enterprises (1) node is mainly used for allocation to various enterprises or organizations.

The OID tree structure is shown in Figure 13-2 below.

                                                                                                                    Zabbix 3.0监控网络设备有哪些

Figure 13-2

Configuring SNMP in Zabbix

1 Data type

You will find in RFC 2578 Compared with the data types defined in SNMP, when configuring monitoring item options in Zabbix, it is recommended that the Type of information and Store value options be configured as shown in the following table.

## SNMP Object Identifier, expressed in dotted decimal IPAddressIPv4 Address##Counter32Gauge32##Counter64Unsigned integer, modulo 2^32 (4294967296), one hundredth of a second between two values

SNMP Type

Description Description

Recommended monitoring item options in Zabbix

INTEGER

Signed 32 is an integer

  • Numeric Unsigned, decimal

  • Store value: as is

  • show value mappings

STRING

Any binary or text data, can be multiple lines

  • Text

  • Store value: as is

##OID

    Character
  • Store value: as is

    Character
  • Store value: as is

One-way growth value (0 .. 4294967295), after reaching the maximum, it returns to 0 and starts counting again

Numeric Unsigned, decimal
  • Store value: delta (speed per second)

The value can be increased or decreased (0 .. 4294967295), and remains at the maximum value when reaching the maximum value

Numeric Unsigned, decimal
  • Store value: as is

The value grows in one direction until it reaches the maximum value and then starts counting from 0 again (0.. 18446744073709551615)

##Numeric Unsigned, decimal
  • Store value: delta (speed per second)

  • ##TimeTicks

Numeric Unsigned , decimal

    Store value: as is
  • 2 Discover OID

    Before using SNMP monitoring equipment in Zabbix, you need to determine the OID value and data type corresponding to the monitoring item. In addition to standard MIB and OID, you need to consult the equipment manufacturer. Through the documents and MIB library files provided by the manufacturer, you can quickly and accurately discover the OID value that needs to be monitored.

    You can use some graphical tools such as MG-SOFT MIB Browser to import the MIB file and query the device information in the graphical interface, as shown in Figure 13-3 below.

    Zabbix 3.0监控网络设备有哪些

    Figure 13-3

    Using graphical tools can help us quickly browse, query and determine the OID type and value of monitoring items,

    You can also use the snmpwalk tool to query directly from the device. Before using snmpwalk, please make sure that the system has installed the software. If it is not installed, you can install it through the following command:

    # yum install net-snmp-utils

    Execute snmpwalk to query device information.

    # snmpwalk -v 2c -c public 10.60.0.19 1.3.6.1.2.1.1

    SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, ME380x Software(ME380x- UNIVERSALK9-M), Version 15.4(3)S2, RELEASE SOFTWARE (fc1)

    Technical Support: http://www.cisco.com/techsupport

    Copyright (c) 1986-2015 by Cisco Systems, Inc.

    Compiled Wed 28-Jan-15 11:43 by prod_rel_team

    SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1. 1252

    DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2030697335) 235days, 0:49:33.35

    SNMPv2-MIB::sysContact.0 = STRING:

    SNMPv2-MIB::sysName.0 = STRING:

    SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00

    You can also output the digital path corresponding to the OID:

    # snmpwalk -v 2c -On -c public 10.60.0.19 1.3.6.1.2.1.1

    .1.3.6.1.2.1.1.1.0 = STRING: Cisco IOS Software, ME380x Software(ME380x-UNIVERSALK9-M), Version 15.4(3)S2, RELEASE SOFTWARE (fc1)

    Technical Support: http://www.cisco.com/techsupport

    Copyright (c) 1986-2015 by Cisco Systems, Inc.

    Compiled Wed 28-Jan-15 11:43 by prod_rel_team

    .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.9.1.1252

    .1.3.6.1.2.1.1.3.0 = Timeticks: (2030720756) 235 days, 0:53:27.56

    .1.3.6.1.2.1.1.4.0 = STRING:

    .1.3.6.1.2.1.1.5.0 = STRING: XZX-3800

    .1.3.6.1.2.1.1.6.0 = STRING:

    .1.3.6.1.2.1. 1.7.0 = INTEGER: 6

    .1.3.6.1.2.1.1.8.0 = Timeticks: (0) 0:00:00.00

    When executing the snmpwalk command with different parameters, The way the OID is displayed will also vary in the results. No matter how it is presented, the result always consists of three parts: OID, data type, and return value. For example, the device name is displayed as follows:

    SNMPv2-MIB::sysName.0 = STRING: XZX-3800

    .1.3.6.1.2.1.1.5.0= STRING: XZX-3800

    Although the displayed content is the same, which is the return value of sysName, the expression of OID is different. When defining items in Zabbix, some of the most commonly used OIDs in the SNMP OID configuration parameters can use OID names. Zabbix will automatically convert some of the most commonly used SNMP OIDs into numbers, for example SNMPv2-MIB::sysName.0 will be converted to 1.3.6.1.2.1.1.5.0. However, the OID of the enterprise private MIB can only use an all-digital path. The OIDs that can be automatically converted in Zabbix are shown in Table 13-1 below.

    Table 13-1

    Special OID##ifIndex##1.3.6.1.2.1.2.2.1.4Maximum transmission packet bytes of port Number##1.3.6.1.2.1.2.2.1.5##1.3.6.1.2.1.2.2.1.6ifAdminStatusPort operation statusNumber of bytes received by port##ifInUcastPkts1.3.6.1.2.1.2.2.1.11##1.3.6.1.2.1.2.2.1.16Port Number of bytes sent##ifOutUcastPktsifOutNUcastPkts##ifOutDiscards##Port send queue length

    Identifier

    Description

    1.3.6.1.2.1.2.2.1.1

    Port Index

    ifDescr
    1.3.6.1.2.1.2.2.1.2

    Port description

    ifType
    1.3.6.1.2.1.2.2.1.3

    Port Type

    ifMtu

    ifSpeed

    Port Speed

    ifPhysAddress

    Port physical address

    ##1.3.6.1.2.1.2.2.1.7
    Port Management Status

    ifOperStatus

    ##1.3.6.1. 2.1.2.2.1.8

    ##ifInOctets

    1.3.6.1.2.1.2.2.1.10

    Number of non-broadcast packets received by port

    ifInNUcastPkts

    1.3.6.1. 2.1.2.2.1.12

    Number of broadcast packets received by the port

    ifInDiscards

    1.3.6.1.2.1.2.2.1.13

    Number of discarded packets received by the port

    ifInErrors

    1.3.6.1.2.1.2.2.1.14

    Number of error packets received by the port

    ifInUnknownProtos

    ##1.3.6.1.2.1.2.2.1.15

    The number of unknown protocol packets received by the port

    ifOutOctets

    1.3.6.1.2.1.2.2.1.17

    Number of non-broadcast packets sent by the port

    1.3.6.1.2.1.2.2 .1.18

    Number of broadcast packets sent by the port

    1.3.6.1.2.1.2.2.1.19

    Number of discarded packets sent by port

    ##ifOutErrors
    1.3.6.1.2.1.2.2.1.20

    Number of error packets sent by port

    ifOutQLen
    1.3.6.1.2.1.2.2.1.21

    3 Configuring SNMP

    Before starting to configure SNMP in Zabbix, please make sure that the Zabbix server has turned on the SNMP monitoring function. When Zabbix server starts, the function list of Zabbixserver will be listed in the log file, as follows:

    911:20160218:103649.120 Starting Zabbix Server. Zabbix 3.0.1 (revision58734).

    911 :20160218:103649.160 ****** Enabled features ******

    911:20160218:103649.160 SNMPmonitoring: MI monitoring:                                                                                                                                                                                                                                                                                                     YES # 911:20160218:103649.160 SMTP authentication:             YES

    911:20160218:103649.160 Jabber notifications: YES YES

    911:20160218:103649.160 Ez Texting notifications: YES

    911 :20160218:103649.160 ODBC:                                                                                           ) 649.160 TLS support: YES

    911:20160218:103649.160 * *****************************

    911:20160218:103649.160 using configuration file:/etc/zabbix/zabbix_server .conf

    If no information about enabling SNMP monitoring is found, then you need to install Zabbixserver. If you use source code to compile and install, you need to use the compilation configuration option --with-net-snmp.

    Only UDP protocol is used for SNMP monitoring in Zabbix, and multiple values ​​can be queried in one request, whether it is regular SNMPitems, dynamic indexes (dynamic indexes) SNMP items, or SNMPlow-level discovery rules. This can provide efficiency when handling large volumes of SNMP. Enable or disable bulk queries by setting the option Use bulkrequests of the host's SNMP Interfaces. As shown in Figure 13-4 below.

    Figure 13-4

    All SNMP monitoring items with the same parameters in a single interface will be queried simultaneously at a set time interval. For regular SNMPitems For dynamic indexes SNMPitems, pollers will process 128 monitoring items at the same time, while SNMP low-level discovery rules will be processed separately. There are two types of operations completed during query: collecting multiple specified objects and traversing the OID tree. Collection means that a GetRequest-PDU can be bound to up to 128 variables. Traversal means using GetNextRequest-PDU in SNMP v1, and using GetBulkRequest with the max-repetitions field in SNMP v2 or SNMP v3, which can bind up to 128 variables. variable.

    Therefore, batch processing of each SNMP monitoring item has the following benefits:

    The performance of regular SNMP monitoring item collection data is improved.

    Dynamic indexes (Dynamic indexes) The performance of SNMP monitoring items collecting data and traversing data has been improved. Zabbix 3.0监控网络设备有哪些

    The performance of SNMP low-level discovery rules traversing data has been improved.

    But technically speaking, not all devices can return 128 values ​​​​for each request, some devices can return certain response values, and some devices return error codes tooBig ( 1) Or no response at all. In order to determine the optimal number of query objects for the device, Zabbix uses some strategies, initially querying only one value in the query request, querying 2 values ​​​​in the query request if successful, and querying 3 values ​​​​in the query request if successful. value, and continue the same query by multiplying the number of objects by 1.5 to query. These query numbers are in ascending order: 1, 2, 3, 4, 6, 9, 13, 19, 28, 42, 63, 94, 128. When a device refuses to return a correct response (such as querying 42 variables), Zabbix may do two things:

      The current batch query items are halved, that is, 21 variables are queried. If the device returns a normal value, then there should be no problem in most cases, because we know that there is no problem querying 28 variables, and 21 must be significantly smaller than 28. If you still cannot get a normal return value after halving the item, you need to roll back the number of queried variables one by one until you get a normal return value.

      Zabbix will query in subsequent queries based on the number of variables that were successfully queried last time (in our example, 28), and continue to increase the number of requested query variables (increase by 1 each time) until the upper limit is reached. For example, assume that the maximum response is 32 variables. Subsequent requests will be queried as per 29, 30, 31, 32 and 33, preferably one request will fail (33 variables) and Zabbix will never issue another request binding 33 variables. Zabbix's SNMP query can bind up to 32 variables on this device.

      When Zabbix server or proxy server receives an incorrect SNMP response, content similar to the following will be added to the log file:

      SNMP response from host "gateway" does not contain all of the requested variablebindings

      Although this information does not cover all problematic situations, at least one thing is that the option Use bulk requests in the SNMP interface of this host should be disabled.

      4 Configure regular SNMP monitoring items

      When using SNMP to monitor the device, regular SNMP monitoring items can be configured according to the following steps:

      Create a host and add an SNMP interface to it . You can use the Template SNMP Generic template provided in Zabbix to automatically add monitoring items that collect basic information about the device.

      2. Determine the monitored OID.

      Find and determine the OID that needs to be monitored through MIB Browser or snmpwalk. For example, if we want to monitor the traffic of a Gigabit port of the switch, the index of the GigabitEthernet0/1 interface found through snmpwalk is 10101.

      # snmpwalk -v 2c -c public 10.60.0.19 IF-MIB::ifDescr

      GigabitEthernet0/1 can be rewritten as the string value of IF-MIB::ifDescr.10101

      IF-MIB::ifDescr.10102 = STRING: GigabitEthernet0/2

      GigabitEthernet0/3 is identified as IF-MIB::ifDescr.10103.

      String "GigabitEthernet0 /4" is the value of "ifDescr.10104" in IF-MIB

      IF-MIB::ifDescr.10105 = STRING: GigabitEthernet0/5

      String"IF-MIB::ifDescr .10106" corresponds to "GigabitEthernet0/6"

      IF-MIB::ifDescr.10107 = STRING: GigabitEthernet0/7

      Get the GigabitEthernet0/1 interface outlet The OID of the traffic is .1.3.6.1.2.1.2.2.1.16.10101.

      # snmpwalk -v 2c -On -c qhdpublic 10.60.0.19IF-MIB::ifOutOctets.10101

      .1.3.6.1.2.1.2.2.1.16.10101 =Counter32: 3619738552

      3. Create monitoring items and use SNMPv2 agent monitoring mode. The SNMP OID is .1.3.6.1.2.1.2.2.1.16.10101.

      5 Configure dynamic index SNMP monitoring items

      In the OID tree of the device, the OIDs of some management objects often use index, such as network interfaces. Use the same index to associate to the network interface. on different objects. Just like the snmpwalk output below.

      # snmpwalk -v 2c -c public 10.60.0.19 .1.3.6.1.2.1.2.2.1

      IF-MIB::ifIndex.1 = INTEGER: 1

      IF-MIB::ifIndex.5001 = INTEGER: 5001

      IF-MIB::ifIndex.5002 = INTEGER: 5002

      IF-MIB::ifIndex.5003 = INTEGER: 5003

      IF-MIB::ifIndex.10101 = INTEGER: 10101

      IF-MIB::ifIndex.10102 = INTEGER: 10102

      ...

      IF-MIB::ifDescr.1 = STRING: Vlan1

      IF-MIB::ifDescr.5001 = STRING: Port-channel1

      IF-MIB::ifDescr.5002 = STRING: Port -channel2

      IF-MIB::ifDescr.5003 = STRING: Port-channel3

      GigabitEthernet0/1 can be rewritten as the string value of IF-MIB::ifDescr.10101

      IF-MIB::ifDescr.10102 = STRING: GigabitEthernet0/2

      ...

      IF-MIB::ifType.1 = INTEGER: propVirtual(53)

      IF-MIB::ifType.5001 = INTEGER: propVirtual(53)

      IF-MIB::ifType.5002 = INTEGER: propVirtual(53)

      IF-MIB: :ifType.5003 = INTEGER: propVirtual(53)

      IF-MIB::ifType.10101 = INTEGER: ethernetCsmacd(6)

      IF-MIB::ifType.10102 = INTEGER: ethernetCsmacd (6)

      ...

      IF-MIB::ifMtu.1 = INTEGER: 1500

      IF-MIB::ifMtu.5001 = INTEGER: 1500

      IF-MIB::ifMtu.5002 = INTEGER: 1500

      IF-MIB::ifMtu.5003 = INTEGER: 1500

      IF-MIB::ifMtu.10101 = INTEGER : 1500

      IF-MIB::ifMtu.10102 = INTEGER: 1500

      ...

      IF-MIB::ifSpeed.1 = Gauge32: 1000000000

      IF-MIB::ifSpeed.5001 = Gauge32: 2000000000

      IF-MIB::ifSpeed.5002 = Gauge32: 2000000000

      IF-MIB::ifSpeed.5003 = Gauge32: 1000000000

      IF-MIB::ifSpeed.10101 = Gauge32: 1000000000

      IF-MIB::ifSpeed.10102 = Gauge32: 1000000000

      ...

      IF-MIB::ifPhysAddress.1 = STRING: b0:7d:47:be:ea:c0

      IF-MIB::ifPhysAddress.5001 = STRING: b0:7d:47:be:ea :c2

      IF-MIB::ifPhysAddress.5002 = STRING: b0:7d:47:be:ea:c3

      IF-MIB::ifPhysAddress.5003 = STRING: b0:7d :47:be:ea:c4

      IF-MIB::ifPhysAddress.10101 = STRING: b0:7d:47:be:ea:c2

      IF-MIB::ifPhysAddress.10102 = STRING: b0:7d:47:be:ea:c3

      ...

      IF-MIB::ifAdminStatus.1 = INTEGER: down(2)

      IF-MIB::ifAdminStatus.5001 = INTEGER: up(1)

      IF-MIB::ifAdminStatus.5002 = INTEGER: up(1)

      IF-MIB::ifAdminStatus.5003 = INTEGER: up(1)

      IF-MIB::ifAdminStatus.10101 = INTEGER: up(1)

      IF-MIB::ifAdminStatus.10102 = INTEGER: up(1)

      ...

      From the above data, you can see that each network interface has many OIDs. Each OID represents different indicators of the network interface, such as the name, type, physical address of the interface, etc. You will find that different OIDs are related through the same index. For example, the name of the first Gigabit interface is GigabitEthernet0/1, the physical address is b0:7d:47:be:ea:c2, the status is up (1), and its index is 10101.

      In order to monitor different indicators of the same network interface, you can create different monitoring items and enter the completed OID in the SNMP OID field. There is no problem with this method, but there will be some problems when using index in the actual environment. The reason is that the index will change due to software or hardware upgrades, causing configuration inconsistencies. In order to solve this problem, Zabbix provides a dynamic index method, which does not affect the monitoring of monitoring items even if the index value changes.

      The syntax for using dynamic indexes SNMP OID is as follows:

      ["index","",""]

      The meaning of each part in the syntax is as follows:

      • OID of data: The OID defined in item that needs to be queried.

      • Index: Processing method, currently only this method is supported. Index means searching for index and appending it to the OID.

      • Base OID of index: The corresponding index value will be found according to this OID.

      • string to search for: Use this string for matching when searching, case-sensitive.

      For example, if you want to monitor the ifInOctets of the GigabitEthernet0/1 interface, according to the syntax, it can be defined as:

      ifInOctets["index","ifDescr","GigabitEthernet0/1" ]

      can be understood as matching and searching for the GigabitEthernet0/1 interface in ifDescr, and or the index value of the interface in ifDescr, and then appending the collected index value to ifInOctets, thereby collecting the GigabitEthernet0/1 interface ifInOctets value.

      When using dynamic indexes, Zabbix will receive and cache the entire SNMP table of the index OID. The index OID can be quickly discovered through the cache. If other monitoring items query the same index OID in the future, it will be directly retrieved from the cache. Search, there is no need to query the monitoring host.

      Then when receiving the data of the monitoring item, it will be verified whether the index has changed. If the index does not send changes, the value query will continue. If the index sends changes, Zabbix will rebuild the cache, and each poller will traverse the index again. SNMP table of OIDs.

      In Zabbix, each poller process has its own cache.

      6 Configure SNMP low-level discovery rules

      When creating discovery rules for SNMP OIDs, unlike defining discovery rules for file systems or network interfaces, do not use the snmp.discovery Key, use SNMP The agnet monitoring method is sufficient. Define the OIDs that need to be discovered in the SNMPOID field. The format is discovery[{#MACRO1}, oid1, {#MACRO2}, oid2, …,].

      {#MACRO1}, {#MACRO2}... are all valid macro variable names, oid1, oid2... are used to generate the values ​​of macro variables. In discovery, the system creates a macro variable named {#SNMPINDEX} by default, which is used to create an index for the discovery OID. The discovery results are grouped by {#SNMPINDEX}.

      The following examples can help you understand better. First use snmpwalk to collect relevant data from the switch.

      # snmpwalk -v 2c -OT -c public 10.60.0.19 IF-MIB::ifDescr

      IF-MIB::ifDescr.1 = STRING: Vlan1

      GigabitEthernet0 /1 can be rewritten as the string value of IF-MIB::ifDescr.10101

      IF-MIB::ifDescr.10102 = STRING: GigabitEthernet0/2

      GigabitEthernet0/3 is identified as IF-MIB::ifDescr.10103.

      # snmpwalk -v 2c -OT -c public 10.60.0.19 IF-MIB::ifPhysAddress

      IF-MIB::ifPhysAddress.1 = STRING: b0:7d:47:be:ea:c0

      IF-MIB::ifPhysAddress.10101 = STRING: b0:7d:47:be:ea:c2

      IF-MIB ::ifPhysAddress.10102 = STRING: b0:7d:47:be:ea:c3

      IF-MIB::ifPhysAddress.10103 = STRING: b0:7d:47:be:ea:c4

      Then enter in the SNMP OID field when creating the discovery rule:

      discovery[{#IFDESCR}, ifDescr, {#IFPHYSADDRESS}, ifPhysAddress]

      After running the discovery rule, you get the following Result:

      {

      "data": [

      "{

      "{#SNMPINDEX}":"1",

      "{#IFDESCR}": " Vlan1",

      "{#IFPHYSADDRESS}": " b0:7d:47:be:ea:c0"

      },

                                                                                                                                                                                                                                 "{#SNMPINDEX}": "2",

      "{#IFPHYSADDRESS}": " b0:7d:47:be:ea:c2"

      },

      "{

      "{#SNMPINDEX}" :"3",

      "{#IFDESCR}": " GigabitEthernet0/2",

      "{#IFPHYSADDRESS}":" b0:7d:47:be:ea:c3"

                                                                                                                                                                                                                                       “ ,

      “{#IFPHYSADDRESS}”:" b0:7d:47:be:ea:c4"

                                                                                                                                              

      #If the specified OID does not return a value, the corresponding macro will be ignored in the discovery results, as in the example below.

      The assumed data is as follows:

      ifDescr.1 "Interface #1"

      ifDescr.2 "Interface #2"

      ifDescr.4 "Interface #4"

      ifAlias.1 "eth0"

      ifAlias.2 "eth2"

      ifAlias.3 "eth3"

      ifAlias.5 "eth5 "

      Then enter in the SNMP OID field when creating a discovery rule:

      discovery[{#IFDESCR},ifDescr, {#IFALIAS}, ifAlias]

      Run the discovery rule Finally, the following results are obtained:

      {

      "data": [

      "{

      "{#SNMPINDEX}": 1,

                                                                                                                                                                                                                                  ## "{#SNMPINDEX}": 2,

      "{#IFDESCR}": "Interface #2",

      "{#IFALIAS}": "eth2"

                                                                                                                                                                                                   

      "{

      "{#SNMPINDEX}": 4,

      "{#IFDESCR}":"Interface #4"

      },

      "{

      "{#SNMPINDEX}": 5,

      "{#IFALIAS}": "eth5"

      }

      ]

      }

      As a practical example, first create a discovery rule, as shown in Figure 13-5 below.

      Figure 13-5

      Create an item prototype based on the defined discovery rules, as shown in Figure 13-6 below.

      Figure 13-6

      You can create multiple item prototypes, as shown in Figure 13-7 below.

      Figure 13-7

The above is the detailed content of What are the network devices that Zabbix 3.0 monitors?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template