SNMP - Configure SNMP service for Linux : Différence entre versions

De PedroWiki
(Install and configure the service)
(Useful links)
 
(2 révisions intermédiaires par le même utilisateur non affichées)
Ligne 13 : Ligne 13 :
 
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-an-snmp-daemon-and-client-on-ubuntu-18-04 Configure an SNMP daemon and client on Ubuntu 18.04].
 
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-an-snmp-daemon-and-client-on-ubuntu-18-04 Configure an SNMP daemon and client on Ubuntu 18.04].
 
* [https://net-snmp.sourceforge.io/docs/README.snmpv3.html net-snmp documentation on SourceForge].
 
* [https://net-snmp.sourceforge.io/docs/README.snmpv3.html net-snmp documentation on SourceForge].
 +
* [https://doc.ubuntu-fr.org/snmp Doc UbuntuFr sur le SNMP].
 +
* [https://www.loriotpro.com/ServiceAndSupport/How_to/UCD-SNMP_ConfigSNMPv1-v1.2.php Configuration de l’agent SNMP V3 Unix].
 
* ...
 
* ...
  
Ligne 30 : Ligne 32 :
 
* snmpd
 
* snmpd
 
* libsnmp-dev
 
* libsnmp-dev
 +
* snmp-mibs-downloader
  
 
Dependencies:
 
Dependencies:
Ligne 40 : Ligne 43 :
 
  apt-get install snmpd
 
  apt-get install snmpd
 
  apt-get install libsnmp-dev
 
  apt-get install libsnmp-dev
 +
apt-get install snmp-mibs-downloader
  
 
Service stop:
 
Service stop:
Ligne 54 : Ligne 58 :
 
  agentaddress  127.0.0.1,[::1],<IP of your server>
 
  agentaddress  127.0.0.1,[::1],<IP of your server>
 
  ...
 
  ...
 +
 
  net-snmp-config --create-snmpv3-user
 
  net-snmp-config --create-snmpv3-user
  
 +
'''Note regarding the use of MIBS downloader''': to use it, comment the line in ''/etc/snmp/snmp.conf'':
 +
# mibs :
  
 
'''Note regarding the user creation''': not sure this behavior is systematic but you may have to add such a line to ''/etc/snmp/snmpd.conf'' for your user to be properly created at service restart. This line may be deleted from ''/etc/snmp/snmpd.conf'' after service restart.
 
'''Note regarding the user creation''': not sure this behavior is systematic but you may have to add such a line to ''/etc/snmp/snmpd.conf'' for your user to be properly created at service restart. This line may be deleted from ''/etc/snmp/snmpd.conf'' after service restart.
  
  createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]
+
createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]
  
 
Service start:
 
Service start:

Version actuelle datée du 7 mars 2023 à 15:33

Introduction

SNMP configuration on Linux may be complex.

Many documentation exist on Internet but they describe so many different methods it makes it difficult to identify THE best way to do it.

This article will try to identify a kind of procedure to install and configure the service.

Useful links

Useful tools

Install and configure the service

Note: for the moment let's focus on SNMPv3. SNMPv2 should be documented later on.

Ubuntu / Debian

Useful packages:

  • snmp
  • snmpd
  • libsnmp-dev
  • snmp-mibs-downloader

Dependencies:

  • libsnmp-base
  • libsnmp35:amd64

Packages installation:

apt-get install snmp
apt-get install snmpd
apt-get install libsnmp-dev
apt-get install snmp-mibs-downloader

Service stop:

systemctl stop snmpd.service

Service configuration:

vi /etc/snmp/snmpd.conf
...
sysLocation    <location description>
sysContact     <your sysops contact>
...
agentaddress  127.0.0.1,[::1],<IP of your server>
...

net-snmp-config --create-snmpv3-user

Note regarding the use of MIBS downloader: to use it, comment the line in /etc/snmp/snmp.conf:

# mibs :

Note regarding the user creation: not sure this behavior is systematic but you may have to add such a line to /etc/snmp/snmpd.conf for your user to be properly created at service restart. This line may be deleted from /etc/snmp/snmpd.conf after service restart.

createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]

Service start:

systemctl start snmpd.service

Note: think about allowing flows on the firewall you use on or around the system.