SNMP Configuration (snmpd.conf) Cheat Sheet

A curated list of SNMP parameters for your /etc/snmp/snmpd.conf file

The article aims to highlight differences between Redhat (e.g. CentOS) based distributions and Debian (e.g. Ubuntu) based distributions.

Works with CentOS

With CentOS, you can get away with this line only `rocommunity your_secret_public_community` but here is a better template:

rocommunity your_secret_public_community

syslocation Rack, Room, Building, City, Country
syscontact Your Name <[email protected]>
sysDescr Hardware, Serial, Operating System, Platform

#Distro Detection
extend distro /usr/bin/distro

If you don’t have serial numbers for sysDescr, you could do something like:

sysDescr Guest, Host, Control Panel, Major Applications


sysDescr VM on SuperDaddy, Dedicated Machine at XYZ, Virtualmin, Email + Web

Distro detection script:

If you’re using LibreNMS or you want your SNMP program to automatically detect the distro, use this script:

curl -o /usr/bin/distro;
chmod +x /usr/bin/distro


Works with Ubuntu

Ubuntu needs more defaults to work than CentOS:

rocommunity your_secret_public_community
syslocation Rack, Room, Building, City, Country
syscontact Your Name <[email protected]>
com2sec readonly your_secret_public_community
agentaddress udp:161
sysservices 76
master yes


A curated set of configuration commands and options that should work with any distribution

Allow Firewalld

If you’re using Firewalld, use these two commands to quickly allow SNMP through:

firewall-cmd --zone=public --permanent --add-service=snmp;
firewall-cmd --reload

Turn off Repetitive Logging

Is your syslog overrun with SNMP connect requests? Try this:

dontLogTCPWrappersConnects yes

Execute your own OID Script


This parameter works in conjunction with another script to calculate Postfix queue size.

exec postqueue /etc/postfix/

When you have this as the first “application” for SNMPD, the OID will be:


Monitoring Asterisk

When monitoring Asterisk, you might end with these four entries:

exec AsteriskExtensionInUse /usr/bin/sudo /etc/snmp/
exec AsteriskExtensionNotInUse /usr/bin/sudo /etc/snmp/
exec AsteriskExtensionUnavailable /usr/bin/sudo /etc/snmp/
exec AsteriskExtensionRinging /usr/bin/sudo /etc/snmp/


Install on AlmaLinux

dnf install net-snmp

Install on CentOS

yum install net-tools

Automatic Start

Once the service is installed, verify that it is set to start at startup by running:

CentOS 6

chkconfig snmpd on

CentOS 7

systemctl enable snmpd
Result CentOS 7
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/snmpd.service.

Tip: If you do this again, you’ll have no output.


A beautiful elegant savvy way of testing your SNMP 😉

For CentOS, you need this:

yum install net-snmp-utils

Install on Ubuntu

sudo apt install snmpd

Then do this:

snmpwalk -c your_secret -v1

See Also

How to get SNMP daemon working on Ubuntu 18.04/20.04 LTS

How to set up SNMP for CentOS

How to monitor Postfix queue length using an SNMP monitor




Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top