snmpd is an SNMP agent for collecting, monitoring, and managing information from managed devices on IP network equipments.
This post will guide you how to enable and configure SNMP Server (snmpd) on Linux servers.
How to enable SNMP server on Linux
All Linux distributions arrives with net-snmp in-box. So, you only need to configure it with your needs.
Edit the file in /etc/snmp/snmpd.conf as follows:
- Make sure the MIBs are open, for example:
Open specific MIBs only:
### system + hrSystem groups only ###view systemonly included .126.96.36.199.2.1.1view systemonly included .188.8.131.52.184.108.40.206
Give Full access to specific host:
### Full access from the local host ###rocommunity public localhostrocommunity public 10.137.210.1
Give Full access to a range or hosts using the community string “secret”
### rocommunitysecret 10.0.0.0/16
2. (Optional) edit system information such as:
sysLocation my-labsysContact my-admin
Refer to snmpd.conf Linux man page for more advance configuration options
snmpd.conf(5) - Linux man page from references below.
3. Restart the server
In most Linux versions the command will be:
# service snmpd restart
http://www.net-snmp.org/docs/man/snmpd.htmlsnmpd.conf(5) - Linux man page - http://linux.die.net/man/5/snmpd.conf
How to let snmpd know where to send a trap
If you start to use and begin to learn how snmpd works around
snmpd.conf file in order to begin managing SNMP with puppet. The existing file has several alarms setup for things like excessive disk space, load, etc. Assuming that when these conditions are reached an snmp trap is sent to the manager. However, the snmpd.conf file does not contain any manager setup or information. In other words there is no mention of a host or port where the manager runs. Thus, how does it know where to send traps?
At a minimum, you need to define
/etc/snmp/snmpd.conf to specify the host to send SNMP traps to. You can also specify the community string and an alternate port number (if not using 162).
You can also set a
trapcommunity for a default community string to be used when sending traps. If other options above there are no something defined to specify where traps are sent, then they aren’t going to be sent anywhere.
For sending v3 traps, use