Eight ---- Zabbix Zabbix Monitoring SNMP network devices

 SNMP protocol Introduction

1, SNMP protocol introduced

SNMP is the English "Simple Network Management Protocol" abbreviation, Chinese meaning "SNMP, SNMP is a SNMP, it is an application layer protocol TCP / IP protocol in five, protocols for network management , SNMP management for major network equipment.

SNMP basic idea: different kinds of devices from different manufacturers of equipment, different types of devices, defined as a unified interface and protocol allows administrators to use a uniform look to face the need to manage these network devices to be managed . Through the network, administrators can manage devices located in different physical space, thus greatly improving the efficiency of network management, simplifying the work of network administrators.

SNMP protocol is an application layer protocol TCP / IP protocol suite was developed in 1988, and Internet Structure Committee (IAB) system adopted as a short-term network management solutions, due to the simplicity of SNMP, has been in the Internet era vigorous development, SNMPv2 version released in 1992, to enhance the security and functionality of SNMPv1, SNMP protocol version currently there are three versions of SNMP v1, SNMP v2c and SNMP v3, the specific differences are as follows:

  • SNMP v1 uses community name (Community Name) certification, community name is used to define the relationship between SNMP NMS and SNMP Agent, if SNMP packets with community names have not been recognized by the device, the packet is discarded, played a similar community name on the role of passwords to limit access to the SNMP NMS's SNMP Agent.
  • SNMP v2c uses community name for authentication, it is compatible with SNMP v1 at the same time expanding the SNMP v1 functionality, it provides more type of operation (GetBulk and InformRequest), support for more data types (Counter64, etc.), provides richer error code and be able to distinguish more detailed error.
  • SNMP v3 authentication mechanism provides user-based security model (USM, User-Based Security Model), the user can set the authentication and encryption, authentication is used to verify the legitimacy of the message sender to prevent unauthorized user access, encryption is is the transmission of messages between the NMS and the Agent is encrypted to prevent eavesdropping. Have presence or absence of encryption and authentication function in combination can provide greater security for communication between the SNMP NMS and SNMP Agent.

2, SNMP mechanism

SNMP Mechanism An SNMP network station (NMS) and Agent:

  • NMS (Network Management Station, a network management station) is a workstation running SNMP client software. It offers a user friendly interface, making it easier for network administrators to perform most network management tasks.
  • Agent is a program that resides on the device, receives and handles requests sent from the NMS. In some emergency situations, such as interface state changes, etc., - Agent will take the initiative to inform the NMS.
  • NMS is an SNMP network manager, Agent is SNMP network manager is. Between the NMS and the Agent via SNMP protocol to exchange management information.

3, SNMP data exchange

Before SNMP management process and proxy process for exchanging information, defines five message: 
get -request: Extract one or more of the parameter values from the agent process. 
get -next -request: Extract a next parameter value from the one or more parameters of the agent process. 
set -request operation: one or more parameter values set the proxy process. 
get -response operation: one or more parameter values returned. This operation is issued by the agent process. 
trap operation: the message sent by the active agent process, notification management process there are certain things happen.

 

4, SNMP organizational structure

 a complete set of SNMP system includes the following aspects:

  • SNMP message protocol.
  • Structure of Management Information (SMI, Structure ofManagementInformation), and a common structure represented by the symbol.
  • Management Information Base (MIB, Management Information Base), MIB includes all processes for all agents can be queried and modified parameters.
  • OID (Object Identifiers), an OID is a unique key-value pairs to identify a specific information on a particular device (object identifier), such as port information, device name.

5、SNMP MIB  

 The so-called (MIB) MIB is included in all agent process, and the process can be managed collection of information queries and settings. MIB tree is based on the object identification, object identifier is a sequence of integers, to the middle. "" Splitting, these integers a tree structure, similar to the DNS or U n ix file system, MIB is divided into several groups, such as system, in terfaces, at (NAT), and the like ip group. is o. org. dod. in ternet .pr iv ate. enterp r is es (1. 3. 6. 1. 4. 1) This identification is reserved to the manufacturers to customize, such as Huawei 1.3. 6.1.4.1.2011, Wah is 1.3.6.1.4.1.25506.

 

Combat: Zabbix monitoring SNMP devices

1, install and configure the SNMP packet

[Root @ node1 ~] # yum install net-snmp -y # install the SNMP package

2, configure SNMP

[root@node1 ~]# vim /etc/snmp/snmpd.conf   # 配置SNMP
#       sec.name  source          community
com2sec notConfigUser  default       public # SNMP默认密码public,设置团体认证,登陆的SNMP密码可以修改。

#       name           incl/excl     subtree         mask(optional)
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.  # 添加一个可以访问的主机地址

access  notConfigGroup ""      any       noauth    exact  systemview none none # 允许notConfigUser组名访问以上的IP地址信息。

3、SNMP配置文件的详细信息。

 4、启动SNMP服务,设置为开机启动,此时由于SNMP是UDP协议,需要查看UDP监听端口:161

[root@node1 ~]# systemctl start snmpd
[root@node1 ~]# systemctl enable snmpd

 5、在客户端进行测试SNMP OID

[root@node1 ~]# yum -y install net-snmp-utils
[root@node1 ~]# snmpwalk-h
USAGE: snmpwalk[OPTIONS] AGENT [OID]
–h:显示帮助。
–v:指定snmp的版本, 1或者2c或者3。
–c:指定连接设备SNMP密码。
–V:显示当前snmpwalk命令行版本。
–r:指定重试次数,默认为0次。
–t:指定每次请求的等待超时时间,单为秒,默认为3秒。
–l:指定安全级别:noAuthNoPriv|authNoPriv|authPriv。
–a:验证协议:MD5|SHA。只有-l指定为authNoPriv或authPriv时才需要。
–A:验证字符串。只有-l指定为authNoPriv或authPriv时才需要。
–x:加密协议:DES。只有-l指定为authPriv时才需要。
–X:加密字符串。只有-l指定为authPriv时才需要。

6、用客户端测试验证常用的OID,是否能够正常获取数据

[root@node1 ~]# snmpwalk -v 2c -c 123456 192.168.7.101 .1.3.6.1.4.1.2021.10.1.3.1
UCD-SNMP-MIB::laLoad.1 = STRING: 0.00
[root@node1 ~]# snmpwalk -v 2c -c 123456 192.168.7.101 .1.3.6.1.4.1.2021.10.1.3.2
UCD-SNMP-MIB::laLoad.2 = STRING: 0.03

Centos 部分常用的OID:  

CPU 负载:

1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1

5 minute Load: .1.3.6.1.4.1.2021.10.1.3.2

15 minute Load: .1.3.6.1.4.1.2021.10.1.3.3

 

CPU信息:

percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0

raw user cpu time: .1.3.6.1.4.1.2021.11.50.0

percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0

raw system cpu time: .1.3.6.1.4.1.2021.11.52.0

percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0

raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0

raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0

 

内存使用:

Total Swap Size: .1.3.6.1.4.1.2021.4.3.0

Available Swap Space: .1.3.6.1.4.1.2021.4.4.0

Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0

Total RAM used: .1.3.6.1.4.1.2021.4.6.0

Total RAM Free: .1.3.6.1.4.1.2021.4.11.0

Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0

Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0

Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0

 

硬盘使用:

Path where the disk is mounted: .1.3.6.1.4.1.2021.9.1.2.1

Path of the device for the partition: .1.3.6.1.4.1.2021.9.1.3.1

Total size of the disk/partion (kBytes): .1.3.6.1.4.1.2021.9.1.6.1

Available space on the disk: .1.3.6.1.4.1.2021.9.1.7.1

Used space on the disk: .1.3.6.1.4.1.2021.9.1.8.1

2、在zabbix网页上添加SNMP主机

1、验证OID成功后,在zabbix网页上添加SNMP主机。

2、配置SNMP主机,添加一个主机到一个群组

 3、将主机关联到SNMP模板上

 4、如果上面的SNMP登陆密码更改后,就需要修改此Template OS Linux SNMPv2模板,将密码进行修改,默认密码是public

 5、修改宏里边登陆SNMP密码

 

 6、修改Template OS Linux SNMPv2模板的监控项间隔时间,全部选中后,点击最下面的批量更新即可

 

 7、修改自动发现规则里边的间隔时间,不修改就会需要到一定的时间才会收集到数据,这里就演示修改几个配置项,生产中需要全部进行修改。

将监控项原型1的监控时间改为5s,生产中改为5m。

 

将监控项原型3的时间更新改为5s,生产中改为5m。

 

 8、查看配置好的SNMP监控网络信息,已经变绿了,说明SNMP验证成功。

  

 9、查看此时的网络信息,已经采集到数据了

 

 

 

 

 

 

 

 

 

 

  

Guess you like

Origin www.cnblogs.com/struggle-1216/p/12361210.html