Enabling SNMP on Linux

 Objective

Descrever os passos necessários para habilitar o SNMP em Sistemas Operacionais CentOS e Ubuntu/Debian, indicado para situações onde há configuração prévia ou necessidade específica.

Important

Caso você não possua configuração prévia ou necessidade específica, utilize o seguinte passo a passo (modo simplificado para habilitar o SNMP), clicando aqui, para realizar a configuração.

Installing SNMP on Operating System CentOS or Redhat

To install pack net-snmp run the follow command

yum install -y net-snmp*

The following command will backup from SNMP default config file

cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_original

Installing SNMP on Operating System Ubuntu/Debian

Run the following commands to install the pack snmpd

apt-get update 
apt-get install snmpd*

The following command will backup from SNMP default config file

cp /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf_original

Configuring snmpd.conf file

a) Edit the following file /etc/snmp/snmpd.conf

There are some basics requirements to configure SNMP, are them:

b) Community configuration

If this line does not exist you will must to create it, if exists you must keep according to shown below:

com2sec notConfigUser  default       public

c) Group configuration

If this line does not exist you will must to create it, if exists you must keep according to shown below:

group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser

d) SNMP tree configuration

If this line does not exist you will must to create it, if exists you must keep according to shown below:

view    systemview           included      .1

e) Access configuration from group

If this line does not exist you will must to create it, if exists you must keep according to shown below:

access notConfigGroup "" any noauth exact systemview none none

f) The full configuration must be equal the example shown below:

snmp_linux

g) Restart SNMP service using the follow command:

/etc/init.d/snmpd restart

h) After SNMP restart, make the tests in order to check if SNMP is running.

snmpwalk -v2c -c public localhost |head

The test should return the following result

snmp_linux2

Updated on December 14, 2017

Was this article helpful?