# Notes - SNMP Traps

SNMP notifications are unsolicited messages to an NMS. There are two types of SNMP notifications: traps and informs. A trap is not acknowledged, and an inform requires an acknowledge.

Generally, traps are preferred over informs. Traps use less resources, because informs must be held in memory in case they must be retransmitted due to being un-acknowledged.

## IOS-XE <a href="#b57771b4-d692-416d-8e36-8fc7d1794ace" id="b57771b4-d692-416d-8e36-8fc7d1794ace"></a>

On IOS-XE, we enable SNMP notifications using the following command. This is required for both traps and informs. Trap types such as **aaa\_server**, **config**, **cpu**, etc. can be used. If you do not specify anything, all traps are enabled.

```
snmp-server enable traps [trap type]
```

Next you must configure at least one NMS to receive the traps using the following configuration:

```
snmp-server host 1.1.1.1 traps|informs version <SNMP version> [trap types]
```

To disable SNMP linkup/linkdown notifications on a per-interface basis we use:

```
int Gi3
 no snmp trap link-status
```

<br>

The source interface for traps can be set using:

```
snmp-server trap-source interface
```

### Example 1 <a href="#id-92d2de8b-f8b7-44dd-840a-39535f1c9c8a" id="id-92d2de8b-f8b7-44dd-840a-39535f1c9c8a"></a>

```
snmp-server enable traps snmp linkdown linkup
snmp-server enable traps config
snmp-server host 155.1.146.101 version 2c CISCO
```

Above, we limit what events can generate SNMP notifications using the “snmp-server enable traps” command. Then we enable traps to be sent to the NMS at 155.1.146.101 using the v2c community CISCO. Note that by default traps are enabled for a host, which is why the “traps” keyword is not used.

We can verify using **show snmp host**:

<div align="left"><figure><img src="/files/OlPyfm7P2N4CgArRdX87" alt=""><figcaption></figcaption></figure></div>

### Example 2 <a href="#id-31b9386d-af9f-45b6-a5db-21a9835cfa4e" id="id-31b9386d-af9f-45b6-a5db-21a9835cfa4e"></a>

```
snmp-server enable traps
snmp-server host 155.1.146.101 version 2c CISCO config snmp
```

In this example, we enable all traps but limit the trap types on a per-NMS basis.

Note that this will fill your config with many lines of snmp-server enable trap commands.

<div align="left"><figure><img src="/files/dHlEqnNbrBoqEOAsmARO" alt=""><figcaption></figcaption></figure></div>

## IOS-XR <a href="#b09ac043-ebcf-48b3-b3ed-c8ae9e3db95d" id="b09ac043-ebcf-48b3-b3ed-c8ae9e3db95d"></a>

Configuration appears to be extremely similar for IOS-XR. The only difference I see is that you use the syntax “snmp-server traps” instead of “snmp-server enable traps.”

Additionally, to disable SNMP notifications for linkup/linkdown on a per-interface basis, you use:

```
snmp-server interface GigabitEthernet0/0/0/0
 notification linkupdown disable
```

### Example <a href="#id-0fffae13-afe0-4cf3-a2eb-69abfe126e24" id="id-0fffae13-afe0-4cf3-a2eb-69abfe126e24"></a>

```
snmp-server host 1.1.1.1 traps version 2c CISCO
snmp-server traps snmp linkup
snmp-server traps snmp linkdown
```

<div align="left"><figure><img src="/files/AY3FRklijMDAqJQWSyQY" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ccie-sp.gitbook.io/ccie-spv5.1-labs/labs/assurance/notes-snmp-traps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
