Nagios XI - Receiving IPv6 SNMP Traps


This KB article explains how to configure Nagios XI to receive SNMP Traps that come in via IPv6 (Internet Protocol version 6).

It is a requirement to have already followed this guide to install all the SNMP Trap pre-requisites:

Documentation - How to Integrate SNMP Traps With Nagios XI



Editing Files

In many steps of this article you will be required to edit files. This documentation will use the vi text editor. When using the vi




These steps configure snmptrapd to listen for IPv6 traps.

Establish an SSH session to your Nagios XI server as a root user.

Edit the /etc/snmp/snmptrapd.conf file and add the following line:

snmpTrapdAddr    udp:162,udp6:162

Save and close the file.


Now restart the SNMPTRAPD service: 

RHEL 7+ | CentOS 7+ | Oracle Linux 7+ | Debian | Ubuntu 16/18/20

systemctl restart snmptrapd.service



Firewall Rules

You will also need to add a firewall rule allow IPv6 SNMP Traps using one of the commands below:


RHEL 7 + | CentOS 7 + | Oracle Linux 7 +

firewall-cmd --zone=public --add-port=162/udp
firewall-cmd --zone=public --add-port=162/udp --permanent



iptables -I INPUT -p udp --destination-port 162 -j ACCEPT



ufw allow proto udp from any to any port 162
ufw reload


At this point your Nagios XI server will listen for SNMP IPv6 traps (as well as IPv4).



Update Script

There is currently a bug in how the Net-SNMP libraries spool these received IPv6 traps. In brief, the side affects of this bug are:

Full details about the bug are reported here:

#2704 IPv6 Trap addresses not processed correctly


Without going into too much detail about the bug, lets compare the address in an IPv4 trap compared to an IPv6 trap:


Once the trap is spooled, it is processed by snmptt (SNMP Trap Translator).

Processed traps are submitted to Nagios using the EXEC statement, which executes the /usr/local/bin/ script and passes on the address value.


The following modifications to the script allow:


Edit the file


Change this:

host = sys.argv[1]

To this:

host = sys.argv[1]
if host.startswith("UDP/IPv6"):
import socket
host = socket.gethostbyaddr(sys.argv[1].partition('[')[-1].rpartition(']')[0])[0]
#host = host.partition('.')[0]
host = sys.argv[1].partition('[')[-1].rpartition(']')[0]


This line here:

                host = socket.gethostbyaddr(sys.argv[1].partition('[')[-1].rpartition(']')[0])[0]

Will result in something like myserver.mydomain.local


If you uncomment this line:

                #host = host.partition('.')[0]

The object will be the short version myserver



Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

Article ID: 499
Created On: Thu, Apr 28, 2016 at 1:50 AM
Last Updated On: Thu, Mar 11, 2021 at 12:54 PM
Authored by: tlea

Online URL: