Greetings all,
I've been spending a few days attempting to get Log4j sending SNMP trap notifications, and have not had any luck. I was hoping that someone that is subscribed to this list may have the same sort of configuration as me, and could point me in the right direction.
Currently we use Log4j for logging in our JBoss 4 environment. We would like to have our JBoss errors sent out as SNMP traps to our management host (in our case, we are running OpenNMS). After many failed attempts at not having OpenNMS receive the traps, I've set up snmptrapd on a different box and tried sending the traps there. Again, no luck. Both the OpenNMS and snmptrapd logs showed no activity from the sending host. After much testing and trying, I'm thinking that I may have a configuration issue, which is why I decided to post to this list. I'm hoping that someone can point out a flaw in one of my configuration files, or let me know of something that I'm missing.
Here is a snippet of my log4j.xml file, located in my jboss/server/all/conf directory:
<!-- Log events through SNMP -->
<appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
<param name="ManagementHost" value="192.*.*.10"/>
<param name="ManagementHostTrapListenPort" value="162"/>
<param name="EnterpriseOID" value="1.3.6.1.4.1.24.0"/>
<param name="LocalIPAddress" value="192.*.*.50"/>
<param name="LocalTrapSendPort" value="161"/>
<param name="GenericTrapType" value="6"/>
<param name="SpecificTrapType" value="12345678"/>
<param name="CommunityString" value="public"/>
<param name="ForwardStackTraceWithTrap" value="true"/>
<param name="Threshold" value="INFO"/>
<param name="ApplicationTrapOID" value="1.3.6.1.4.1.24.12.10.22.64"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>
</layout>
</appender>
<category name="org.jboss.system.server.Server"> <priority value="INFO" /> <appender-ref ref="TRAP_LOG"/> </category>
<category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
<priority value="INFO" />
<appender-ref ref="TRAP_LOG"/>
</category>
<category name="org.jboss.deployment.MainDeployer"> <priority value="ERROR" /> <appender-ref ref="TRAP_LOG"/> </category>
<category name="org.jboss.ejb.EJBDeployer"> <priority value="INFO" /> <appender-ref ref="TRAP_LOG"/> </category>
<category name="org.jboss.deployment.EARDeployer"> <priority value="INFO" /> <appender-ref ref="TRAP_LOG"/> </category>
<root> <appender-ref ref="CONSOLE"/> <appender-ref ref="FILE"/> <appender-ref ref="TRAP_LOG"/> <appender-ref ref="SMTP"/> </root>
I am running snmpd on the same box that I am running JBoss. I know I am able to send SNMP traps from this box to the management host. When I start/stop the snmp daemon, I can see the traps being received in the snmptrapd log.
So, to reiterate, I am sending SNMP traps thusly: JBoss --> log4j --> snmptrapd
I am unable to see any output in my snmptrapd log. Am I missing anything noticeable? Is there anything I need to install on the management host side so that it recognizes the log4j traps? I have tried using the "traphandler" directive in my snmptrapd configuration by matching up the OIDs, but I haven't had any luck there either.
Any input is appreciated, thank you very much for your time!
Dylan Hansen How2Share Technologies Inc.