How to configure SNMP on a Linux system

Source: Internet
Author: User
Tags snmp snmpwalk

Configure SNMP on Debian or Ubuntu

To install the SNMP agent (SNMPD) on a Debian based system, run the following command:

The code is as follows:

root@server:~# Apt-get Install SNMPD

Then, edit the configuration file as follows.

The code is as follows:

root@server:~# vim/etc/snmp/snmpd.conf

# Make SNMPD listen and all the interfaces

Agentaddress udp:161

# define a read-only community ' mycommunity ' and the source network

Rocommunity mycommunity 172.17.1.0/24

Syslocation Earth

Syscontact Email@domain.tld

After editing the configuration file, restart the snmpd.

The code is as follows:

root@server:~# Service SNMPD Restart

Configuring SNMP on CentOS or Rhel

To install the SNMP tools and libraries, run the following command.

The code is as follows:

root@server:~# sudo yum install Net-snmp

Then, edit the SNMP configuration file as follows.

The code is as follows:

root@server:~# vim/etc/snmp/snmpd.conf

# define a user ' myuser ' that uses the Community ' mycommunity ' and the source network 172.17.1.0/24

Com2sec myuser 172.17.1.0/24 mycommunity

# Add MyUser to ' MyGroup ' group, define group permissions

Group MyGroup v1 MyUser

Group MyGroup v2c MyUser

View all included 1

Access MyGroup "" Any noauth exact all none

root@server:~# Service SNMPD Restart

root@server:~# Chkconfig snmpd on

Restart the SNMPD service and add it to the Startup services list.

Testing SNMP

SNMP can be tested by running the Snmpwalk command. If SNMP has been configured successfully, this command generates a large amount of output.

The code is as follows:

root@server:~# snmpwalk-c mycommunity 172.17.1.44-v1

iso.3.6.1.2.1.1.1.0 = STRING: "Linux mrtg 3.5.0-17-generic #28-ubuntu SMP Tue Oct 9 19:31:23 UTC \ x86_64"

iso.3.6.1.2.1.1.2.0 = oid:iso.3.6.1.4.1.8072.3.2.10

iso.3.6.1.2.1.1.3.0 = timeticks: (2097) 0:00:20.97

~ ~ Output Truncated ~ ~

iso.3.6.1.2.1.92.1.1.2.0 = gauge32:1440

iso.3.6.1.2.1.92.1.2.1.0 = Counter32:1

iso.3.6.1.2.1.92.1.2.2.0 = counter32:0

iso.3.6.1.2.1.92.1.3.1.1.2.7.100.101.102.97.117.108.116.1 = timeticks: (1) 0:00:00.01

iso.3.6.1.2.1.92.1.3.1.1.3.7.100.101.102.97.117.108.116.1 = hex-string:07 DD 0B 2B 06 00

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.