Siddharth Siddharth - 1 month ago 11
Ruby Question

Sensu reports Found 0 matching processes for tomcat8

I am getting the following error

CheckProcess CRITICAL: Found 0 matching processes; cmd //usr/bin/java * -Dcatalina.base=/opt/tomcat8 */


My
config.json
has the following check

"command": "check-process.rb --pattern \"/usr/bin/java * -Dcatalina.base=/opt/tomcat8 *\" -W 1",


My
ps -ef | grep tomcat
gives the following

ubuntu 23100 1 0 Oct07 ? 00:01:32 /usr/bin/java -Djava.util.logging.config.file=/opt/tomcat8/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -classpath /opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat8 -Dcatalina.home=/opt/tomcat8 -Djava.io.tmpdir=/opt/tomcat8/temp org.apache.catalina.startup.Bootstrap start

Answer

Your Ruby regular expression is wrong. You forgot to escape the / and the * needs . before them to denote which caracters there can be any of.

It should be:

\/usr\/bin\/java .* -Dcatalina.base=\/opt\/tomcat8 .*

I use http://rubular.com/ to test my expressions before using them.

Comments