How to make Net-SNMP configuration management friendly

If you have to configure Net-SNMP on a larger fleet of Linux systems, you probably want to use a configuration management tool like Puppet, Ansible or Salt Stack. To make it easier to roll out individual and more complex configurations you can use the include directive in the snmpd.conf file which allows you to drop configuration snippets into a directory which is automatically read when you start snmpd.

Step 1: Create a config directory

mkdir /etc/snmp/conf.d

Step 2: Enable the include directive for snmpd

vi /etc/snmp/snmpd.conf

Add the line

includeDir /etc/snmp/conf.d

Step 3: Restart snmpd

systemctl restart snmpd

Now you can drop any files with the suffix .conf in the conf.d directory and they will be included on snmpd restart. The configuration files are not processed in any particular order.