Siddharth Siddharth - 1 year ago 76
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 */

has the following check

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

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/ -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 org.apache.catalina.startup.Bootstrap start

Answer Source

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 to test my expressions before using them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download