Skip to main content

Linux snmpd

Last Updated: June 2, 2015

Update

Use this instead: https://docs.librenms.org/Support/SNMP-Configuration-Examples/#operating-systems

Installing the SNMP Server

RHEL-Based Operating Systems

yum install net-snmp net-snmp-utils

Debian-Based Operating Systems

apt-get install snmpd

Configuring

Remove the default configuration file

rm /etc/snmp/snmpd.conf

Make a new configuration file

nano /etc/snmp/snmpd.conf

Add these lines

rocommunity public
syscontact NAME
syslocation LOCATION

Use this if you want to change the port:

agentAddress 161

Linux Distro Detection

Download the script

cd /usr/bin
wget http://dl.bph.rocks/distro
chmod 555 distro

Add this line to enable it in the SNMPd config

extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro

Restart the SNMP Server

service snmpd restart

We can use the community name public because it is in our local network but if you are contacting a remote server you should probably create firewall rules and/or change the community name.