monitoring J2EE application deployed in Tomcat using snmp - linux

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 with CustomAppender 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.

Related

How exactly Nagios server communicates with remote nodes i.e which protocol does it use in agent and agentless settings?

I installed Nagios Core and NCPA on a Mac. Implemented a few checks via custom plugins to understand how to use it. I am trying to understand the following:
Protocol that Nagios server actually use to communicate with NCPA agent and how exactly does NCPA return the result back to Nagios. Does it ssh into Nagios server and writes a file that server processes?
From application monitoring standpoint how can it be leveraged? Is it just to monitor that application is up and running (I read its not just for that it can do more but couldn't find any place where I could see how its actually implemented) or is there a restful API as well that we invoke from with in our application to send custom notification to Nagios server. I understand it might require some configuration at Nagios server end as well.
I came across Pager Duty and Sematext articles i.e PagerDuty Integration and SemaText Nagios Alert Integration where they have integrated their solution with Nagios I am trying to do something similar. Adding integration support for Nagios so that a user can utilise our applications UI to configure alerts/notification. For e.g. if a condition is met then alert or notify Nagios server to show a notification on its dashboard.
Can we generate an alert from within a spark streaming application based on a variable e.g. if its value is above a threshold or some condition is met send an alert to Nagios Server to display as notification on Nagios Dashboard. I came across a link where we can monitor status of a spark application but didn't find anything for something within a spark application.
I tried looking for answers to above questions but couldn't find anything useful or complete as such online. I would really appreciate if someone could help me understand above.
Nagios is highly configurable, and can communicate across many protocols. NCPA can return JSON or XML data. The most common agentless protocol is probably SNMP. If you can read Python, look directly at the /usr/local/nagios/libexec/check_ncpa.py file to see what's up.
Nagios can check whether a system is running a service, how much resources it is consuming, etc... There is a restful API.
Nagios offers an application with a more advanced graphical interface called Nagios XI. Perhaps that is what you are after.
I bet you probably could, yeah. It might take some development work to get the systems to communicate though.

Is it possible to run Spring Boot REST API in Node.js

Is it possible to run a Spring Boot REST API service on top of Node.js instead of Tomcat,
or if not Node.js which are the other possible servers on which we can run our Spring Boot REST Application.
Please help me figure it out.
NodeJs is a server to run Javascript code. It can not run a Java web application, which needs a JVM (Java Virtual Machine) to be run into a JVM. Before you ask, no, NodeJS can not run a JVM. Is is just not made for that. To understand what I mean, it's like wanting a car to run with a outboard engine... Definitly not possible.
So NO, you can't run your Spring Boot REST Application on the top of NodeJs server.
If you don't want to use a Tomcat, then there is other options for you:
https://blog.idrsolutions.com/2015/04/top-10-open-source-java-and-javaee-application-servers/

How CUPS web interface works

I'm wondering how the Common Unix Printing System "CUPS" handels the user actions and affects the configuration files, from my humble background, a webpage only can access/edit files when there is some web server and a serverside script, so how it works without installing web server?
does it work through some shell script? if yes, how that occurs?
It is not the web frontend that alters the configuration files. At least not if you compare it to the 'typical' setup: http server, scripting engine, script.
CUPS itself contains a daemon, this also acts as a minimal web server. That deamon has control over the configuration files. And it is free to accept commands from some web client it serves. So no magic here.
Turned that around you could also setup a system running a 'normal' http server with such rights that is is able to alter all system configuration files. That's all a question of how that server/daemon is setup and started. It breaks down to simple rights management. You certainly do not want to do that, though ;-)

How do I start my grails dev server in single threaded mode?

grails run-app will start my app in an embedded tomcat server.
I would like to configure this embedded server so that only a single request processor thread is available and that multiple threads are processed serially rather than concurrently (similar to default webrick behaviour in the rails world)
Is it possible? If so, how do I do it?
As far as I know, this is not directly supported by the Tomcat plugin. But you could easily modify the Tomcat plug-in and run your own version.
If you look at the class org.grails.tomcat.TomcatServer, you will see it starts a Tomcat instance.
Here is the doc for this class: http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/startup/Tomcat.html
There is a getConnector() method which will return the default HTTP connector. Once you have it, you can probably change the settings, like maxThreads.
But be careful the performance will be awful. But I guess you already know that.

JavaFX console service with GUI

I need to make an application that runs as a server that accepts connections from various clients and responds to their requests (via proprietary protocol). This server also needs a GUI for configuration and monitoring. I (of course) need to run the server as a service, and the GUI has to be available only at certain moments. Since the server service and GUI share some of the hardware resources and part of the configuration they would run on the same machine. I would like that the GUI and the whole long running service are one process that will run in the background; the GUI would than be invoked (shown) only when needed.
My question is: can this be done with a JavaFX 2 GUI and how?
Thanks in advance
Josip
So you need Monitoring and Management in a Java application? You should be using the Java Management Extensions (JMX) Technology. http://docs.oracle.com/javase/6/docs/technotes/guides/management/overview.html
And if you decide that you can't just use a standard JMX client or create a plugin then you create your JavaFX application as a JMX client.

Resources