I am going to write a J2EE application and application will be deployed in Tomcat. The requirement is that the server and the application must send snmp trap to external NMS. The details of my application is
- J2EE application
- Deployed in Tomcat v7
- The Server is Redhat Linux 6.2
We need to send trap for all the above 3 (For the application, Tomcat and the linux server).
Can we write our own agent using snmp4j for the above requirement and how will snmp agent know when to send trap to NMS?
Thanks in advance for support.
Yes you can for that you need to extend the logger framework. For Instance you can use
logback framework
. where you can extend the logging withCustomAppender
where you can write snmp-agent code and forward the log as an trap. Moreoever logback has nice and easy way to format, deny log if not necessary other other feature. And you can change the tomcat logging to logback is simple steps. However I'm not sure if you can really send a trap for any issues on linux server. I believe it would be a tedious task. You might look for some syslog server monitoring feature.