snmpd an SNMP Agent

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:

  1. Make sure the MIBs are open, for example:

Open specific MIBs only:

### system + hrSystem groups only ###view systemonly included .1.3.6.1.2.1.1view systemonly included .1.3.6.1.2.1.25.1

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:

#/etc/init.d/snmpd restart 

In RHEL7:

# service snmpd restart 

References:

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 trapsink, trap2sink or informsink in /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 trapsess.

References:

http://www.net-snmp.org/wiki/index.php/TUT:snmptraphttp://www.net-snmp.org/wiki/index.php/TUT:snmptrap_SNMPv3

Leave a Reply

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