I have a local check called sinfo.py, which contain a command named sinfo that I open using subprocess.
Like this: cmd = subprocess.Popen('sinfo',shell = True, stdout=subprocess.PIPE)
This command sinfo outpud text orginized in colmuns for example:
Country Capital
Spain Madrid
etc etc
Then I save the ouput of the command in a list
msg,err = cmd.communicate()
mylist = msg.decode().split(‘\n’)
and I print the list as follow:
print(“1 AAA - OK: {mylist} crashed”.format(mylist=mylist))
This work fine if executed from the console but here is the problem.
Checkmk has problem executing the custom command “sinfo”. with command like “ls” it works perfect: img:
As you can see in the second imagen, after OK it shows the outputs, the list of files/folders.
However when using the custom command is does not work. In the first imagen,
After Ok: [u"] it should show the output of sinfo as it does with ls. Something like:
[u"]Country Capital, Spain Madrid.
Checkmk has a problem/limitation when executing custom commands?