问题
I've deployed OpenNMS through the docker images and have SNMPv3 polling working but haven't been able to get SNMPv3 traps or informs working.
trapd-configuration.xml:
<?xml version="1.0"?>
<trapd-configuration snmp-trap-port="162" new-suspect-on-trap="true">
<snmpv3-user
security-name="trapuser"
security-level="3"
auth-passphrase="authsecret"
auth-protocol="SHA"
privacy-passphrase="privsecret"
privacy-protocol="AES"/>
</trapd-configuration>
If I run the following from another host, which is being polled by OpenNMS via SNMPv3:
snmptrap -Dusm -v 3 -l authPriv -u trapuser -a SHA -A authsecret -x AES -X privsecret <opennms-host-ip> 42 coldStart.0
OpenNMS doesn't generate any event. In the trapd.log I can see the following warning:
2018-04-26 09:26:33,364 WARN [DefaultUDPTransportMapping_0.0.0.0/162] o.s.MessageDispatcherImpl: statusInfo=1.3.6.1.6.3.15.1.1.3.0 = 0, status=1404
From what I can tell this relates to an unknown username.
Likewise informs aren't working either and I get the same warning in the trapd.log file and a similar one at the sender side. If I run tcpdump I can see it retrieve the remote engineID from opennms.
snmpinform -Dusm -v 3 -l authPriv -u trapuser -a SHA -A authsecret -x AES -X privsecret <opennms-host-ip> 42 coldStart.0
registered debug token usm, 1
usm: potentially bootstrapping the USM table from session data
usm: getting user
usm: USM processing has begun (offset 39)
usm: getting user
usm: Failed to find engine data.
usm: USM processing completed.
usm: USM processing begun...
usm: USM processing completed.
usm: potentially bootstrapping the USM table from session data
usm: no flag defined... continuing
usm: user exists? x=(nil)
usm: Building user trapuser...
usm: USM processing has begun (offset 80)
usm: getting user trapuser
usm: match on user trapuser
usm: Encryption successful.
usm: USM processing completed.
usm: USM processing begun...
usm: match on user trapuser
usm: USM processing completed.
snmpinform: Unknown user name
Any ideas on what I'm doing wrong?
回答1:
Can you please try the following:
open the $OPENNMS_HOME/etc/service-configuration.xml
and start the Trapd daemon after the AsteriskGatway
service. To do this locate the following XML block:
<service enabled="true">
<name>OpenNMS:Name=Trapd</name>
<class-name>org.opennms.netmgt.trapd.jmx.Trapd</class-name>
<invoke method="init" pass="0" at="start"/>
<invoke method="start" pass="1" at="start"/>
<invoke method="status" pass="0" at="status"/>
<invoke method="stop" pass="0" at="stop"/>
</service>
By default Trapd is started after the Correlator
. Cut & Paste the whole service definition block after the AsteriskGateway
service:
<service enabled="false">
<name>OpenNMS:Name=AsteriskGateway</name>
<class-name>org.opennms.netmgt.asterisk.agi.jmx.AsteriskGateway</class-name>
<invoke method="init" pass="0" at="start"/>
<invoke method="start" pass="1" at="start"/>
<invoke method="status" pass="0" at="status"/>
<invoke method="stop" pass="0" at="stop"/>
</service>
Can you try to get SNMPv3 Traps processed now?
来源:https://stackoverflow.com/questions/50031889/opennms-snmpv3-traps-and-informs