Snmptrapd is working but traps do not show in device logs

Hello, I have installed LibreNMS and am having an issue with SNMP traps at the moment. I was able to configure everything and am receiving the traps on the system and they show in the snmptrapd logs. The issue is that I cannot seem to get them to show in the individual logs for a device in LibreNMS itself. I am sure that it is something simple that I am overlooking, but I just can’t seem to find it.

LibreNMS is installed on a CentOS 8.5 server and here are the related configuration files.


disableAuthorization yes
authCommunity log,execute,net COMMUNITYSTRING
traphandle default /opt/librenms/snmptrap.php


Description=Simple Network Management Protocol (SNMP) Trap Daemon.

ExecStart=/usr/sbin/snmptrapd $OPTIONS -f -m ALL -M /opt/librenms/mibs -tLf /var/log/snmptrap/traps.log
ExecReload=/bin/kill -HUP $MAINPID



#snmptrap Event Logging
$config[‘snmptraps’][‘eventlog’] = ‘all’;
$config[‘snmptraps’][‘eventlog_detailed’] = ‘true’;

Then on the LibreNMS server, I run the following test snmptrap command:

snmptrap -v 2c -c public localhost ‘’ i 123456

Then it shows the following in the snmptrapd logs /var/log/snmptrap/traps.log

NET-SNMP version 5.8
2021-12-14 09:01:48 localhost [UDP: []:59257->[]:162]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (8681570) 1 day, 0:06:55.70 SNMPv2-MIB::snmpTrapOID.0 = OID: NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate = INTEGER: 123456

But after that, it never shows in the Log for the LibreNMS device in the LibreNMS server. Thanks for your help and let me know if I can provide any other information.

Checking in to see if anyone has any ideas or needs any more information from me. Thanks.

Still struggling to find a solution, if anyone has an idea. Thanks.

I did find a little more information. It seems to be a permissions issue with the snmptrapd service and the LibreNMS log file. When I view the systemctrl status of snmptrapd after a snmp trap comes in it has the following error:

The stream or file “/opt/librenms/logs/librenms.log” could not be opened in append mode: failed to open stream: Permission denied

I have tried to change the permissions to the file to 777 and it still gives the permission error. The file is owned by librenms:librenms and the service is run by root.

Any thoughts on this additional information? Thanks.

It appears to be an SELinux issue but I am not sure what yet. If I set setenforce 0 then it works fine and the trap is added to the device event log.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.