Tools

Account Tools

Search Tools


Enabling SNMP on Debian / Ubuntu

To configure snmp on Linux, you first need to install the snmpd package with the command :

copy
apt-get install snmpd

Then edit the configuration file :

copy
nano /etc/snmp/snmpd.conf

Change the following line (or put it as a comment):

agentAddress udp:127.0.0.1:161

And replace it with :

copy
agentAddress udp:0.0.0.0:161

Next, you need to configure the SNMP community:

copy
rocommunity read_community default

or rocommunity “ community name ” “ range ip (unique ip ) /subnet mask ”.

copy
rocommunity read_community 10.7.0.14/32

WARNING, do not leave rocommunity with the default systemonly view (comment, delete or modify the following line):

copy
# rocommunity public default -V systemonly

Then restart the SNMP service by typing :

copy
/etc/init.d/snmpd restart

Toavoid the agent adds a line every X minutes to your log file (each time the Esia server interrogates it), don't forget to make SNMP less verbose.

Make SNMP less verbose Debian (until Jessie) / Ubuntu

In the /etc/default/snmpd file, replace the following line :

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'

with the following:

copy
SNMPDOPTS='-LS4d -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'

Lsd stands for Ls FACILITY where facility can be ('d' for LOG_DAEMON, 'u' for LOG_USER, or '0'-'7' for LOG_LOCAL0 through LOG_LOCAL7).

LS4d stands for LS LEVEL FACILITY and is therefore used to specify the error LEVEL (5 LOG_NOTICE by default) before the FACILITY (see above). The different levels are :

0 ou ! pour LOG_EMERG,
1 ou a pour LOG_ALERT,
2 ou c pour LOG_CRIT,
3 ou e pour LOG_ERR,
4 ou w pour LOG_WARNING,
5 ou n pour LOG_NOTICE,
6 ou i pour LOG_INFO, and
7 ou d pour LOG_DEBUG.

Making SNMP less verbose Debian (From Stretch)

Enter the following command:

copy
systemctl edit snmpd

This will (among other things) create the file « /etc/systemd/system/snmpd.service.d/override.conf ». Add this code to the :

copy
[Service]
ExecStart=
ExecStart=/usr/sbin/snmpd -LS4d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f

Then restart the SNMP service by typing :

copy
service snmpd restart

On Debian Buster if the service command does not exist you can restart with this command:

copy
systemctl restart snmpd
en/snmp/snmp_debian_ubuntu.txt · Last modified: 2023/11/09 18:27 by 127.0.0.1