1.0 Introduction
The purpose of this guide is to describe procedure to add a Simple Network Management Protocol (SNMP) trap handler to forward the traps from Sensu virtual machine (VM) to an SNMP Server.
2.0 Terminology References
SNMP - Simple Network Management Protocol
TCP - Transport Layer Security
UDP - User Datagram Protocol
3.0 Prerequisites
Before proceeding with the SNMP handler configuration, ensure the following:
The Sensu server is already set up and monitoring the Fortanix DSM targets.
The SNMP server is properly configured.
The Sensu VM has network connectivity to the SNMP server over the required TCP or UDP ports.
3.1 List of Required Ports
The following ports must be accessible from the Sensu VM to the SNMP server (one way):
Protocol | Port Number | Purpose |
|---|---|---|
TCP | 162 | To receive Sensu Traps over TCP |
UDP | 161 | To receive Sensu Traps over UDP |
4.0 Configure SNMP Trap Handler on Sensu VM
This section explains how to configure the SNMP trap handler on the Sensu VM for forwarding alerts to the SNMP server.
4.1 Setting Up SNMP Asset
Perform the following steps:
Run the following command to navigate to the
Monitoring-Server-Artifactsfolder on the Sensu VM created in “Section 5.1: Setting Up Sensu Server” in the Fortanix DSM with Sensu Monitoring and Alerting guide:cd Monitoring-Server-ArtifactsRun the following command to execute the
add_handlers.shscript to add an SNMP handler:./add_handlers.shWhen prompted, select
Yfor SNMP handler:./add_handlers.sh Do you want to create email handler ? (Y/N): N Do you want to create snmp-trap handler ? (Y/N): Y Creating SNMP trap handler Specify the snmp host : <SNMP_HOST_IP> Specify the snmp port: <SNMP_HOST_PORT>Run the following command to check the SNMP trap handler asset details:
sensuctl asset info sensu-snmp-trap-handlerThe output may resemble as follows:
=== sensu-snmp-trap-handler Name: sensu-snmp-trap-handler Namespace: default URL: http://10.197.188.16/sensu-snmp-trap-handler_0.2.2_linux_amd64.tar.gz SHA-512 Checksum: c350ec73cee0a38fbe05e8a11e217aae4cc77ced1f2f1c8ba31d287005e34e7f33b09850a4c810d6f1e0309cc569c7ae6ddfd686313e06aa73b2e44b885da61f Filters: entity.system.os == 'linux', entity.system.arch == 'amd64'Verify the SNMP handler configuration from Sensu Web user interface (UI):

Figure 1: Select SNMP handler
.png?sv=2022-11-02&spr=https&st=2025-11-03T04%3A45%3A48Z&se=2025-11-03T04%3A57%3A48Z&sr=c&sp=r&sig=vTJ3hLKar0TltUHBzaailkRNKE0uaH%2BzPYR7moT8360%3D)
Figure 2: SNMP handler specification
4.2 Verification of SNMP Traps
Verify the SNMP traps are received on the SNMP server:
tcpdump -i any src host <snmp-server-ip> -vvThe Sensu SNMP traps are received in the following format:

Figure 3: Sensu SNMP traps
5.0 Configure Keepalive Handler
This section explains how the keepalive handler monitors the status of the sensu-agent service on each node.
5.1 Configure Keepalive Handler on Sensu VM
Perform the following steps on the Sensu VM:
Run the following command to navigate to the
Monitoring-Server-Artifactsfolder in the Sensu VM created in “Section 5.1: Setting Up Sensu Server” in the Fortanix DSM with Sensu Monitoring and Alerting guide:cd Monitoring-Server-ArtifactsRun the following command to create the
keepalive-handler.ymlfile:vi keepalive-handler.ymlAdd the following configuration to the
keepalive-handler.ymlfile:type: Handler api_version: core/v2 metadata: name: keepalive namespace: default spec handlers: - snmp-handler type: set filters: - is_incident - not_silencedRun the following command to create the keepalive handler:
sensuctl create -f keepalive-handler.ymlRun the following commands to start and enable the
sensu-agentservice:sudo systemctl daemon-reload sudo systemctl restart sensu-agentRun the following command to check the status of the
sensu-agentservice:sudo systemctl status sensu-agent
5.2 Configuration Changes on Fortanix DSM Node
Perform the following steps on each Fortanix DSM node where the sensu-agent service is configured:
Add the following values in the
agent.yamlfile present in the/etc/sensu/directory:keepalive-warning-timeout: 60 keepalive-critical-timeout: 90Run the following commands to restart the
sensu-agentservice:sudo systemctl daemon-reload sudo systemctl restart sensu-agent sudo systemctl status sensu-agent
5.3 Verification of SNMP Traps
Run the following command to verify that SNMP traps are being received on the SNMP server:
tcpdump -i any src host <snmp-server-ip> -vvThe SNMP traps in Sensu appears in the following format:

Figure 4: SNMP traps in Sensu