Sunday, August 2, 2009

Enabling snmp on Ubuntu

I thought I'd write down the recipe for enabling snmp on Ubuntu. Much the same instructions also work for RedHat.

First ensure that the packages snmp and snmpd are both installed. Login as root via ssh to the machine you need to configure, and then:

apt-get install snmp and
apt-get install snmpd

Follow the usual prompts to get it installed then

  1. Type snmpconf
  2. From the text-menus choose to load "none" of the existing snmpd.conf files.
  3. Choose option 1: snmpd.conf as the file to create
  4. Select the option "Access Control Setup" (the number varies)
  5. Choose option 3: "a SNMPv1/SNMPv2c read-only access community name"
  6. In answer to the first prompt type "public".
  7. In response to the request to specify a host address to accept this community name just hit return
  8. In response to the OID request just hit return.
  9. Then type "finished", "finished" and "quit"
  10. Copy the resulting snmpd.conf in the current directory to /etc/snmp/, overwriting what is there.
  11. Edit the file /etc/default/snmpd. At the end of the line saying SNMPDOPTS remove the " 127.0.0.1". This step is not required on RedHat.
  12. Save the file and restart the snmp daemon: service snmpd restart. If you haven't got the service command install the sysvconfig package or just type: /etc/init.d/snmpd restart (same thing)
  13. Test the snmp service: snmpwalk -c public -v2c localhost. You should get a sizeable chunk of responses, several pages worth. If only one page then your snmpd.conf file is not installed or mucked up or overridden by something else.
  14. Also test from another machine that can access the snmp server you just set up. snmpwalk -c public -v2c <snmp-host-ip-address>. You should get the same output. If it hangs, then you failed to remove the "127.0.0.1" from the snmpd file above.

No comments:

Post a Comment