Junos OSPF Trap not correctly handled

Hello,

We are using LibreNMS with its SNMP trap handlers. It works fine, we have added someone of missing MIBs in mib/ and its subdirectories. The received traps are interpreted correctly except the Junos OSPF traps as you can see below :

Problem only concerns Juniper OSPF traps. We don’t have any issue with Cisco OSPF traps.

So, we checked all needed MIBs and their dependencies, standard and Junos entreprise MIBs but no way.

In our LibreNMS config we don’t load all mib/ subdirectories as it is advised in your documentation:

root# cat /etc/systemd/system/snmptrapd.service.d/mibs.conf
[Service]
Environment=MIBDIRS=+/opt/librenms/mibs:/opt/librenms/mibs/standard:/opt/librenms/mibs/juniper:/opt/librenms/mibs/junos:/opt/librenms/mibs/cisco:/opt/librenms/mibs/fortinet:/opt/librenms/mikrotik
Environment=MIBS=+ALL

We load these MIBs which seems to be related to Junos OSPF Traps:

OSPF-TRAP-MIB
OSPF-MIB
DISMAN-EVENT-MIB
SNMPv2-MIB
SNMPv2-SMI
SNMPv2-CONF
SNMPv2-TC
IF-MIB
IANAifType-MIB
JUNIPER-CHASSIS-DEFINES-MIB
Juniper-OSPF-MIB
Juniper-UNI-SMI
Juniper-MIBs
mib-ospf2mib.txt
mib-ospf2trap.txt

In addition, snmptrapd daemon is starting but with these logs:

● snmptrapd.service - Simple Network Management Protocol (SNMP) Trap Daemon.
Loaded: loaded (/lib/systemd/system/snmptrapd.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/snmptrapd.service.d
└─mibs.conf, override.conf
Active: active (running) since Wed 2021-12-08 12:38:21 CET; 1 months 4 days ago
Main PID: 3656994 (snmptrapd)
Tasks: 3 (limit: 19106)
Memory: 141.3M
CGroup: /system.slice/snmptrapd.service
├─1633088 sh -c /opt/librenms/snmptrap.php
├─1633089 php /opt/librenms/snmptrap.php
└─3656994 /usr/sbin/snmptrapd -LOw -f -p /run/snmptrapd.pid -tLf /var/log/snmptrap/traps.log

janv. 12 16:42:30 librenms snmptrapd[1600246]: Call to undefined method stdClass::save()
janv. 12 16:42:30 librenms snmptrapd[1600246]:
janv. 12 16:46:53 librenms snmptrapd[1610268]: In OspfNbrStateChange.php line 63:
janv. 12 16:46:53 librenms snmptrapd[1610268]:
janv. 12 16:46:53 librenms snmptrapd[1610268]: Call to undefined method stdClass::save()
janv. 12 16:46:53 librenms snmptrapd[1610268]:
janv. 12 16:47:08 librenms snmptrapd[1611990]: In OspfNbrStateChange.php line 63:
janv. 12 16:47:08 librenms snmptrapd[1611990]:
janv. 12 16:47:08 librenms snmptrapd[1611990]: Call to undefined method stdClass::save()
janv. 12 16:47:08 librenms snmptrapd[1611990]:

Any ideas ?

I’m not very well up on our trap support, however I think you will need to write some handlers for that trap type. These are the ones we have https://github.com/librenms/librenms/tree/master/LibreNMS/Snmptrap/Handlers and the only two ospf ones are not there ones in your trap.