SNMP ubuntu/centos--

Source: Internet
Author: User
Tags snmp snmpwalk


Software Installation

Switch to the System administrator account

Installing SNMP
Confirm that the SNMP agent is installed
Rpm-q NET-SNMP
If not installed, install SNMP
Yum Install Net-snmp

Set up auto-run SNMP on boot
/sbin/chkconfig snmpd on configuring SNMP


Vi/etc/snmp/snmpd
The first step is that the SNMP community name defaults to public and can be changed to something else, as follows:
# First, map the community name ' public ' into a ' security name '
# Sec.name Source Community
Com2sec notconfiguser Default Public

In the second step, change the SystemView in the following position to all, as follows:
####
# Finally, grant the group Read-only access to the SystemView view.
# Group Context Sec.model sec.level prefix read Write Notif
#access notconfiggroup "" Any noauth exact systemview none None
Access Notconfiggroup "" Any noauth exact none none

The third step is to remove the comments from the previous two lines, as follows:
# # INCL/EXCL Subtree Mask
View all included. 1 80
# #-or just the Mib2 tree-
View MIB2 included. Iso.org.dod.internet.mgmt.mib-2 FC

The fourth step is to remove the comments before this line, as follows:
#access notconfiggroup "" Any noauth exact roview rwview None
Access Notconfiggroup "" Any noauth exact mib2 none None

Fifth step, start the SNMPD, and set the boot auto-start:
Service SNMPD Restart
Chkconfig--level 345 snmpd on

Modifying a configuration file


Start SNMP

/ETC/INIT.D/SNMPD start
Restart the SNMP service if it is started
/ETC/INIT.D/SNMPD restart

Testing SNMP

To see if the port is open
Netstat-ln | grep 161

Installing the SNMP test tool
Yum Install Net-snmp-utils

Native Test SNMP data (modify monit for configured community name)
Snmpwalk-v 2c-c public localhost system

Snmpwalk-v3-u username-l auth-a md5-a password localhost

Create SNMP (v3) users

Net-snmp-config--create-snmpv3-user-ro-a MD5 Lyceemsnmp lyceem.com

Remotely test SNMP data (modify IP for Server ip,snmpwalk command requires installation of NET-SNMP)
Snmpwalk-v 2c-c Public IP system

So it is often handled

Error exclusion if the local test SNMP has data, the remote test SNMP is numerous because the server firewall prohibits the external Access server UDP 161 port:
Modify/etc/sysconfig/iptables (or:/etc/sysconfig/iptables-config) to add the following rule:
-A rh-firewall-1-input-p udp-m state cstate new-m UDP cdport 161-j ACCEPT
Restart Iptables
/etc/init.d/iptables restart

--Liu Linqiang 136-1133-1997[email protected] Beijing Foreign Studies Online Education Technology Co., Ltd. Foreign language teaching and research press

SNMP Configuration under Ubuntu11.04:

[Email protected]:~ #sudo apt-get Install SNMP snmpd/* Installation SNMP Service */

[Email protected]:~ #vi/etc/snmp/snmpd.conf/* Edit SNMP Profile */

The default community name public is used here, and changes are recommended in the actual environment.

1. Replace the original "Agentaddress udp:127.0.0.1:161" with the following:

Agentaddress 192.168.1.9/*192.168.1.9 is the native IP, the monitoring server to monitor the host ip*/

2. Add a line as follows:

Access Myrosystem "" Any noauth exact none none

3. Remove the "-V-systemonly" parameter from the original "Rocommunity public default-v systemonly" and turn it into:

Rocommunity Public Default

4. Remove the "#" in front of "#trap2sink localhost public" and "#informsink localhost public" instead:

Trap2sink localhost public

Informsink localhost public

5. Restart the SNMP service:

/ETC/INIT.D/SNMPD restart

6. Verify that SNMP obtains data:

Snmpwalk-v 2c-c Public 192.168.1.9

****************************************************************************

SNMP Configuration under CentOS6.3:

To install the SNMP service:

Yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils php-snmp
Edit SNMPD File:

Vi/etc/snmp/snmpd
The first step is that the SNMP community name defaults to public and can be changed to something else, as follows:
# First, map the community name ' public ' into a ' security name '
# Sec.name Source Community
Com2sec notconfiguser Default Public

In the second step, change the SystemView in the following position to all, as follows:
####
# Finally, grant the group Read-only access to the SystemView view.
# Group Context Sec.model sec.level prefix read Write Notif
#access notconfiggroup "" Any noauth exact systemview none None
Access Notconfiggroup "" Any noauth exact none none

The third step is to remove the comments from the previous two lines, as follows:
# # INCL/EXCL Subtree Mask
View all included. 1 80
# #-or just the Mib2 tree-
View MIB2 included. Iso.org.dod.internet.mgmt.mib-2 FC

The fourth step is to remove the comments before this line, as follows:
#access notconfiggroup "" Any noauth exact roview rwview None
Access Notconfiggroup "" Any noauth exact mib2 none None

Fifth step, start the SNMPD, and set the boot auto-start:
Service SNMPD Restart
Chkconfig--level 345 snmpd on

SNMP ubuntu/centos--

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.