I need to check if java service is running on my solaris server or not, i have installed nagios plugins and nrpe on solaris server. (nagios-plugins-1.4.11 and nrpe-2.12)
I just need a check_java script or somthing like that which will check the java process.
i am only concerned with the following process is running or not.
My main concern is that the daemon “/opt/IBM/WebSphere/AppServer/java/bin/java -XX:MaxPermSize=256m -Dwas.status.so” should be running, if that daemon is killed , some how i should get a alert in my nagios monitoring system…
You could write a bash script for that and use it as a check_command for that service, something like this:
#!/bin/bash
check=`ps -auxf | grep /opt/IBM/WebSphere/AppServer/java | grep Dwas.status.so`
if -n $check ]; then
echo "Dwas.status.so is running" && exit 0
else "Dwas.status.so is not running" && exit 2
if
But definitely you should test this through before implementing it. If the command: ps -auxf | grep /opt/IBM/WebSphere/AppServer/java | grep Dwas.status.so
gives you only one line of output of the command is running (try to issue the command as non-root user) that should do the job, but if it gives you more that one line of output try to add | grep root: ps -auxf | grep /opt/IBM/WebSphere/AppServer/java | grep Dwas.status.so | grep root
When you have the script, test it from the terminal to see if there are any errors, or is it misbehaving. Try to kill the process and see what the script says then.
???
No, no, no,you’ve misunderstood.
Hm, I think you should first read the documentation of Nagios. It is necessary for you to understand what I’ve meant and how Nagios works.
I have written here the bash script which can be used as a plugin. The things you should do are to add a command definition to your Nagios configuration defining the Nagios command to use that script as a command (plugin), then use that command as a check_command for a service in a service definition.