We have configured the "processes" probe to monitor a java process for Tomcat. The probe is sending alarms as if the process is down (as shown in Figure 1).
Figure 1:
However, when we check the robot machine, the process is running. For example:
processsesRobotHostname:~ # ps aux | grep "/usr/java/java8/bin"
root 12850 0.0 0.0 4552 560 pts/1 S+ 13:58 0:00 grep /usr/java/java8/bin
ssuser 30002 3.7 3.5 5461372 433548 ? Sl Oct01 120:12 /usr/java/java8/bin/java -Djava.util.logging.config.file=/opt/tomcat-8/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dss.config=/opt/searchservice/config -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /opt/tomcat-8/bin/bootstrap.jar:/opt/tomcat-8/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat-8 -Dcatalina.home=/opt/tomcat-8 -Djava.io.tmpdir=/opt/tomcat-8/temp org.apache.catalina.startup.Bootstrap start
We are monitoring the "/usr/java/java8/bin" folder (as shown in Figure 2).
Figure 2:
We are using the "binary path" as opposed to the "name" as we have multiple java processes running on the same machine.
The "name + command line" did not work. So, we used "binary path" to point to the directory the java process is running from.
The processes probe is looking for the "binary path". In RedHat and other Linux distros, "java" may be an alias.
For example:
[[email protected] bin]# which java
/usr/bin/java
[[email protected] bin]# /usr/sbin/alternatives --config java
There are 5 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
* 2 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
3 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
4 /opt/jdk1.8.0_144/bin
+ 5 /opt/jdk1.8.0_144/bin/java
Check whether the java process is using an alias or alternative. Here are a few ways to check that.
Check the "Status" tab on the processes tab. Look for the "Binary Path". Is it different than the "Full Path/Command Line" (as shown in Figure 3).
Figure 3:
Check the RedHat Linux commands: "which java" and "/usr/sbin/alternatives --config java" as shown above.
Check the output of the "Test" button in the "processes" probe configuration. For example as shown in Figure 4.
Figure 4:
RedHat documentation on java alternative commands
You can also use a RegEx.
if the full process command was:
"java/bin/java -Djava.util.logging.config.file=/opt/CA/CABI/apache-tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli...."
I could use a regex, for example:
*java -Djava.util.logging.config.file\=/opt/CA/CABI/apache-tomcat/conf/logging.properties*