Linux: configure an SNMPv3 user (SHA and AES) for monitoring
Create a read-only SNMPv3 user with SHA authentication and AES encryption in snmpd.conf (net-snmp) and test it with snmpwalk.
To monitor Linux servers with a tool such as Centreon (or any SNMP monitor), SNMPv3 is preferable to v1/v2c because it authenticates and encrypts the traffic. This memo shows how to enable a read-only SNMPv3 user (SHA for authentication, AES for encryption) on a Linux server running net-snmp.
Configuring snmpd
Stop the daemon before changing the configuration: createUser lines are read at startup and then replaced by an encrypted version in net-snmp's persistent configuration.
systemctl stop snmpd
Add to /etc/snmp/snmpd.conf:
rouser snmp_ro
createUser snmp_ro SHA "<AUTH_PASSPHRASE>" AES "<PRIVACY_PASSPHRASE>"
Then restart:
systemctl start snmpd
rouser snmp_ro: grants the user read-only access.createUser snmp_ro SHA ... AES ...: creates the user with an authentication passphrase (SHA) and a privacy passphrase (AES). Both must be at least 8 characters long.
Testing
From the monitoring host or a test machine, with the net-snmp-utils package:
snmpwalk -v3 -l authPriv -u snmp_ro -a SHA -A "<AUTH_PASSPHRASE>" -x AES -X "<PRIVACY_PASSPHRASE>" sqlserver01.example.com system
Notes
- The SNMP port (UDP 161) must be open between the monitor (or poller) and the monitored server.
- The same settings (user, SHA/AES protocols, passphrases) must be entered in the monitor's host template.
- User names and passphrases are generic examples; the organisation-specific Centreon deployment plan and network diagrams of the original note are not reproduced.