How to Setup SNMP TRAP on Ubuntu

Written by jonah quant
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Setup SNMP TRAP on Ubuntu
You can receive notifications of remote SNMP events in the form of traps. (Hemera Technologies/ Images)

The Simple Network Management Protocol is a standard way of managing devices connected to networks based on the Internet Protocol. Each SNMP "manager" can monitor in detail the operation of remote devices -- "clients" -- such as switches and routers and, in some cases, reconfigure them as well. In particular, the SNMP standard includes a mechanism for having clients send asynchronous notifications -- "traps" -- to managers at the time events deemed significant happen. You can configure your Ubuntu computer to receive and process SNMP traps from clients.

Skill level:
Moderately Easy


  1. 1

    Press the "Ctrl", "Alt" and "F1" keys at the Ubuntu login prompt to bring up a text-mode login prompt. Log in as your regular user. Ubuntu will present you with a command-line prompt, a "shell".

  2. 2

    Elevate the shell's privileges to superuser by typing the following command:

    sudo -l

    Press "Enter." Type your password, and press "Enter" again.

  3. 3

    Download and install the SNMP manager utilities by typing the following command:

    apt-get install snmpd

    Press "Enter."

  4. 4

    Open file "/etc./snmp/snmpd.conf" with a text editor, search for the line containing the words "master agentx" and remove the initial "#" character from that line. Save the file and exit the editor.

  5. 5

    Open file "/etc./snmp/snmptrapd.conf" with a text editor and add the following line at the end of the file:


    Save the file and exit the editor.

  6. 6

    Type the following commands to start the SNMP manager services and the logging of incoming traps:

    /etc./init.d/snmpd restart

    snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A\n"

    Press "Enter" after each line. At that point, snmptrapd will be listening for incoming SNMP traps. When snmptrapd receives a trap, it will log it to standard output, indicating the time of the day, the trap code and the host name of the device that originated the trap.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.