Linux system on SNMP monitoring

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/ximenjianxue/article/details/100104688

1, yum prepared local source, the local need iso image
2, to install software tools snmp: NET-snmp yum the install * -Y
Here Insert Picture Description
. 3, SNMP configuration file editing:
backup profile:
3.1 secure authentication provided

All hosts will be exposed to the SNMP agent on the network is very dangerous, in order to prevent other hosts to access your SNMP agent, authentication mechanisms need to be added on an SNMP agent. SNMP support different authentication mechanisms, depending on the SNMP protocol version currently supports two versions v2c and v3, which v2c version of the verification mechanism is relatively simple, it came clear text passwords for authentication and authorization based on IP, and v3 version through username and encrypted transmission of passwords to achieve authentication, we recommend using v3.
Note: SNMP protocol version and SNMP agent version are two different things, just said v2c and v3 is the version of SNMP, and Net-SNMP is used to implement SNMP the protocol suite of programs; SNMP version of the software I use is the first out: 5.5
Here Insert Picture Description
or use: snmpget --version view the current installed version number to verify that the installation was successful, return-SNMP version 5.5 NET
3.2 legacy SNMP protocol configuration
[V2C]: configuration v2c, SNMP agent
needs to be created in / usr / share / snmp / etc directory, there is no default; after creating the copy
, add the following in the snmpd.conf:
rocommunity sdomonitor 172.21.36.9
in which: "rocommunity" indicates that this is only a read access, monitoring platform can only get information from your server, but the server can not set any Home.

Followed by "sdomonitor" as a password, the default is "public".

The rightmost "172.21.36.9" monitoring platform that is designated ip address, that is, only monitoring platform has permission to access the object being monitored SNMP agent.
[V3]: v3 configuration version SNMP agent
#vim /usr/local/snmp/share/snmp/snmpd.conf
add a read-only account, as follows:
directives rouser Monitor the auth
in v3, "rouser" is used to indicate the read-only account type, followed by the "monitor" is specified user name, behind the "auth" indicates need for validation.

Then, you also need to add "monitor" the user, it is the special mechanism v3, we open the following configuration file:

#vim /var/net-snmp/snmpd.conf

The file is called automatically when snmpd start, we need to add instructions to create a user in its inside, as follows:

createUser sdomonitor MD5 password

This line means configured to create a "monitor" user name, password is "password", and the transmission is encrypted with MD5.

Requirements: a password must be at least 8 bytes, SNMP protocol provisions, if less than 8 bytes, the communication will fail.
3.3 5.5 protocol configuration;
Here Insert Picture Description
the actual community name configuration settings based on your user name field.

4, start snmp service

$ Service snmpd start
Here Insert Picture Description
if a successful start with the following command inspection services
$ snmpwalk -v 2c -c monitor 127.0.0.1 system or .1.3.6.1.2.1.1.5.0
or: netstat -an | grep 161 "of snmp service is started
If you want to turn off, you can directly kill the process, as follows:
$ killall -9 or $ service snmpd stop the snmpd

Guess you like

Origin blog.csdn.net/ximenjianxue/article/details/100104688