Writing Service Plugin

CMK version: 2.1.0p22.cee

Hi,
i am writing a plugin, but Check MK does not detect it, maybe you have a clue for me ?

Agent on the server:

/usr/lib/check_mk_agent/plugins# cat wildfly_java
#!/bin/sh
echo ‘<<<wildfly_java>>>’
ps -ef | grep wildfly | grep -v root | awk -F" " ‘{print $1$8}’
root@HDCS18:/usr/lib/check_mk_agent/plugins#

Output:
<<<wildfly_java>>>
wildfly/bin/sh
wildfly/opt/jdk-11.0.2/bin/java

On OMD:

:~/local/lib/check_mk/base/plugins/agent_based$ cat wildfly_java.py
from .agent_based_api.v2 import *
import pprint

def discover_mk_java_check(section):
yield Service()

def check_mk_java_check(section):
for line in section:
if line[0].startswith(“wildfly”):
yield Result(state=State.OK, summary=“Wildfly Running”)
return
yield Result(state=State.CRIT, summary=“NO Wildfly found”)

register.check_plugin(
name=“wildfly_java”,
service_name=“JAVA WILDFLY”,
discovery_function=discover_mk_java_check,
check_function=check_mk_java_check,
)
OMD[monitor]:~/local/lib/check_mk/base/plugins/agent_based$

Output from cmk detect:

~/local/lib/check_mk/base/plugins/agent_based$ cmk --detect-plugins=wildfly_java -vI SERVERl
Discovering services and host labels on: SERVER
SERVER:

  • FETCHING DATA
    [TCPFetcher] Execute data source
    [PiggybackFetcher] Execute data source
    No piggyback files for ‘SERVER’. Skip processing.
    No piggyback files for ‘IP-ADRESS’. Skip processing.
  • ANALYSE DISCOVERED HOST LABELS
    SUCCESS - Found no new host labels
  • ANALYSE DISCOVERED SERVICES
  • EXECUTING DISCOVERY PLUGINS (0)
    SUCCESS - Found no new services

thank you,

br
Robert

Found the Issue :wink:

thanks :wink:

br
Robs

I would recommend that you use the ruleset “Process Discovery” to check for running processes.

Thank you, i will have a look !