# ⁣⁣trapd command (SNMP Traps support)

### Description <a href="#id-trapdcommand-snmptrapssupport-description" id="id-trapdcommand-snmptrapssupport-description"></a>

SNMP Traps support module. SNMP protocol allows a network agent to send asynchronous traps when some specific event occurs on the controlled unit (object). Built-in SNMP Traps support module (agent) performs a centralized information delivery from internal device subsystems to the configured SNMP-server. SNMP Traps agent is managed using the "*trapd*" command.

**Syntax:**

```
trapd dst[addr] x.x.x.x[:PORT][/v1|/v2] [[GROUPNAME] ...] [[[-]TYPENAME] ...]
trapd -dst[addr] x.x.x.x[:PORT]
trapd map
trapd agent x.x.x.x
trapd -agent
trapd gateway {xxxxxxxxxxxx|auto}
trapd -gateway
trapd type TYPENAME enable|disable
trapd start|stop
  where PORT default value is 162 if omitted
  possible GROUPNAMEs are:
    topoGroup
    radioGroup
    mintGroup
    ospfGroup
  and possible TYPENAMEs are:
    topoEvent
    newNeighborEvent
    lostNeighborEvent
    radioFreqChanged
    radioBandChanged
    mintRetries
    mintBitrate
    mintSignalLevel
    ospfNBRState
    ospfVirtNBRState
    ospfIFState
    ospfVirtIFState
    ospfConfigError
    linkEvent
    trapdColdStartEvent
    snmpdAuthenticationFailureEvent
    syslog
```

### Parameters <a href="#id-trapdcommand-snmptrapssupport-parameters" id="id-trapdcommand-snmptrapssupport-parameters"></a>

<table><thead><tr><th width="217">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em><strong>start|stop</strong></em></td><td>Starts/stops SNMP Trap agent on the device.</td></tr><tr><td><em><strong>dst[addr] x.x.x.x[:PORT][/v1|/v2] [[GROUPNAME] ...] [[[-]TYPENAME] ...]</strong></em></td><td><p>Sets an SNMP server address to the SNMP configuration. Multiple SNMP servers can be set in the configuration.</p><ul><li><em>"[addr] x.x.x.x" –</em> the server’s IP-address.</li><li><em>":PORT"</em> – the server’s UDP port (port 162 is used by default).</li><li><em>"/v1|/v2" –</em> SNMP Trap version (1 or 2), can be specified for each SNMP Trap receiver. Several receivers with different protocol version is possible to create. Version 1 is used by default.</li><li><em>"GROUPNAME" –</em> groups of Traps to be sent to the server.</li><li><em>"[-]TYPENAME" –</em> exact Traps to be sent to the server (or exclude from sending if "-" sign is added).</li></ul></td></tr><tr><td><em><strong>-dst[addr] x.x.x.x[:PORT]</strong></em></td><td>Deletes an SNMP server"s IP-address from the configuration.</td></tr><tr><td><em><strong>map</strong></em></td><td>Displays the allocated SNMP servers (their IP-addresses) and the defined Traps/groups for each server.</td></tr><tr><td><em><strong>agent x.x.x.x</strong></em></td><td>Sets agent’s own IP-address, which is set in SNMP Trap packet. Default agent’s own IP-address is 127.0.0.1.</td></tr><tr><td><em><strong>-agent</strong></em></td><td>Deletes the agent’s IP-address from the configuration.</td></tr><tr><td><strong>gateway {xxxxxxxxxxxx|auto}</strong></td><td><p>Allows to send SNMP Traps to the SNMP server via SNMP network agent running on some other device (gateway).</p><ul><li>"xxxxxxxxxxxx" – the gateways MAC-address.</li><li>“auto” –  SNMP Traps are automatically sent to the MINT SNMP relay, defined by the "<em>mint -snmprelay</em>" command, if it exists in the MINT network.</li></ul></td></tr><tr><td><em><strong>-gateway</strong></em></td><td>Deletes the gateway from the configuration.</td></tr><tr><td><em><strong>type TYPENAME enable|disable</strong></em></td><td><p>Allows/rejects sending of different Traps types. All Traps are disabled by default.</p><ul><li>"<em>TYPENAME</em>" <em>–</em> Trap type.</li></ul></td></tr></tbody></table>

**SNMP traps and trap groups supported by the system**

<table data-header-hidden><thead><tr><th width="216">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em><strong>trapdColdStartEvent</strong></em></td><td>Trap is sent when the unit is powered up.</td></tr><tr><td><em><strong>snmpdAuthenticationFailureEvent</strong></em></td><td>Trap is sent in case of failure in SNMP authentification.</td></tr><tr><td><em><strong>syslog</strong></em></td><td>All new messages in the system log are sent as a Trap.</td></tr></tbody></table>

**Group topoGroup**

<table data-header-hidden><thead><tr><th width="216"></th><th></th></tr></thead><tbody><tr><td><em><strong>topoEvent</strong></em></td><td>Full neighbor list is sent in case of any changes in number of neighbors or their status.</td></tr><tr><td><em><strong>lostNeighborEvent</strong></em></td><td>Trap is sent when a new neighbor appears.</td></tr><tr><td><em><strong>newNeighborEvent</strong></em></td><td>Trap is sent when the neighbor is lost.</td></tr><tr><td><strong>Group radioGroup</strong></td><td></td></tr><tr><td><em><strong>radioFreqChanged</strong></em></td><td>Trap is sent when frequency is changed.</td></tr><tr><td><em><strong>radioBandChanged</strong></em></td><td>Trap is sent when channel width is changed</td></tr></tbody></table>

**Group mintGroup**

<table data-header-hidden><thead><tr><th width="217"></th><th></th></tr></thead><tbody><tr><td><em><strong>mintBitrate</strong></em></td><td>Trap is sent when the bitrate is changed.</td></tr><tr><td><em><strong>mintRetries</strong></em></td><td>Trap is sent if more than 10% retries appear.</td></tr><tr><td><em><strong>mintSignalLevel</strong></em></td><td>Trap is sent if the signal level is changed by more than 10%.</td></tr></tbody></table>

**Group ospfGroup**

<table data-header-hidden><thead><tr><th width="220"></th><th></th></tr></thead><tbody><tr><td><em><strong>ospfNBRState</strong></em></td><td>Trap is sent when the state of a non-virtual OSPF neighbor is changed.</td></tr><tr><td><em><strong>ospfVirtNBRState</strong></em></td><td>Trap is sent when the state of a virtual OSPF neighbor is changed.</td></tr><tr><td><em><strong>ospfIFState</strong></em></td><td>Trap is sent when the state of a non-virtual OSPF interface is changed.</td></tr><tr><td><em><strong>ospfVirtIFState</strong></em></td><td>Trap is sent when the state of a virtual OSPF interface is changed.</td></tr><tr><td><em><strong>ospfConfigError</strong></em></td><td>Trap is sent when a packet has been received from a router whose configuration conflicts with this routers configuration.</td></tr><tr><td><em><strong>linkEvent</strong></em></td><td>Trap is sent when Ethernet state is changing. This trap enables/disables sending two generic SNMP traps: "<em>linkUp</em>" and "<em>linkDown</em>".</td></tr></tbody></table>

### Examples <a href="#id-trapdcommand-snmptrapssupport-examples" id="id-trapdcommand-snmptrapssupport-examples"></a>

Set an SNMP-server address, Traps are sent in case of any change in the network topology.

```
trapd dst 192.168.103.35
trapd type topoGroup enable
```

or

```
trapd dst 192.168.103.35 topoGroup
```

Using the *"trapd map*" command display the list of Traps enabled.

```
trapd map
trap name                          destination address[es]
--------------------------------------------------------------
topoEvent                          192.168.103.35
newNeighborEvent                   192.168.103.35
lostNeighborEvent                  192.168.103.35
any unaddressed trap from MINT     all addresses above
any addressed trap from MINT       its own destination address
--------------------------------------------------------------
```
