Mirth_agent doesn't work

Hi together,

I need to use the mirth_agent (Checkmk Exchange), but although I use the right crendetials and Port for the Api, I get this error, although the agent_mirth file is executable and at the right place.


Any idea, what could be the problem?

Kind Regards,
Tobias

You can get the command line from cmk -D HOST.
Then try to execute the special agent as site user and see if any other error messages pop up.

Hi and thanks for your fast answer. :slight_smile:

I first had to “repair” python:

OMD[psgmon]:~$ /omd/sites/psgmon/local/share/check_mk/agents/special/agent_mirth
/usr/bin/env: ‘python’: No such file or directory
OMD[psgmon]:~$ exit
logout
checkmk:~# whereis python3
python3: /usr/bin/python3 /usr/bin/python3.9 /usr/lib/python3 /usr/lib/python3.9 /etc/python3 /etc/python3.9 /usr/local/lib/python3.9 /usr/share/python3 /usr/share/man/man1/python3.1.gz
checkmk:~# sudo ln -s /usr/bin/python3 /usr/bin/python

but now I get this here:

OMD[psgmon]:~$ /omd/sites/psgmon/local/share/check_mk/agents/special/agent_mirth
File “/omd/sites/psgmon/local/share/check_mk/agents/special/agent_mirth”, line 40
except getopt.GetoptError, err:
^
SyntaxError: invalid syntax

This “special”-agent is very terrible written…

Bevor this problems, I had to remove the spaces in the mirth_stats in ~/local/share/check_mk/checks,
because they where used together with tabs in one line. :confounded:

do all special-agents first need an adjustement like this? This agent should be removed, because it is not working at all.

KR,
Tobias

Cool, now, after finished repairing agent_mirth tabs and spaces the xml to dict was not found :frowning: :

OMD[psgmon]:~$ /omd/sites/psgmon/local/share/check_mk/agents/special/agent_mirth -u ‘admin’ -s ‘password’ -p ‘8443’ ‘pow-gw.test.de
Traceback (most recent call last):
File “/omd/sites/psgmon/local/share/check_mk/agents/special/agent_mirth”, line 11, in
import xmltodict
ModuleNotFoundError: No module named ‘xmltodict’

after copying it to the folder of agent_mirth, this comes up… “nice”:

checkmk:/# cp /./opt/omd/sites/psgmon/local/lib/python/xmltodict.py /./omd/sites/psgmon/local/share/check_mk/agents/special/
checkmk:/# su - psgmon
OMD[psgmon]:~$ /omd/sites/psgmon/local/share/check_mk/agents/special/agent_mirth -u ‘admin’ -s ‘password’ -p ‘8443’ ‘pow-gw.test.de
<<<mirth_stats>>>
%s %s %s %s %s %s %s
unsupported operand type(s) for %: 'NoneTyp

Shall I go on in fixing this or what would you say? “plug and play” is something different. It cost me the hole day and speaks not for cmk… :confounded:

The braket is/was wrong:?

now it works with this:

I really ask myself, how this agent got this rating!! without words…

Hi @Tobias13 :slight_smile:

I don’t know either :slight_smile:
I made this a couple years ago, it worked great back in time, but unfortunently i didn’t kept it up2date to newer checkmk versions.
Obviously everyone is free to share their inputs and open some issues on git for me to try to help and improve any bug community founds out.
Still, i’m glad that somehow you got it working with a few changes only.
Maybe you could make a pull request on git with your changes :slight_smile: and by that helping out others.

Cheers :slight_smile:

1 Like

Oh no. This agent is still on Python 2, whereas current Checkmk uses Python 3.

Do not symlink /usr/bin/python3 to /usr/bin/python.

Use #!/usr/bin/env python3 as shebang line in the special agent script and use 2to3 to convert it to Python 3.

Your screenshot shows that this extension package was made on Checkmk 1.5.0p25 in March 2021. This was an old version even back then. I would not expect this extension package to work on Checkmk 2.0 or 2.1 as we have gone through the Python 2 to 3 transition.

It would be helpful to know where to find that git repo.

Ok, thanks for your feedback. It works now for me. Please write us you git. :wink:

One final note for all: Chanel names in mirth cannot contain spaces, if there are spaces, it won’t work. :wink:

Further this Line:
image

must look like this:
image

KR,
Tobias

1 Like

Hi Martin, thanks for your response, but this line is wrong to:

has anyone an idea, why cmk is not able to display the received messages properly?

KR,
Tobias

I don’t think this is an issue with the Checkmk backend. You can investigate the raw data that the plugin produces using the command OMD[psgmon]:~$ cmk -nvp <host> and look for the service in question (-n: do not submit this to the core, -v: verbose, shows individual service outputs, -p include the metrics in the output).

hello at all, thanks to @Tobias13! after some trouble with xml2dict like described above, works for me too.
but now, only the special agent give outputs. so why did the installed linux agent doesnt queried anymore?

would be really nice to get both data… ideas?

You have to select “API integrations and agent” in the setup for this host.
Screenshot 2023-02-21 at 14-01-56 Checkmk Local site app - Properties of host motostage.m-app.mobi

1 Like

oh shit… shame on me :wink:

The channels are display correctly, “cmk -nvp” does anything here:

Oh, I thought the numbers where wrong, but the values actually are in the order of hundred thousands to millions. It which sense are they not “displayed properly”? What did you expect? (no sarcasm, it’s a genuine question!)

I would expect something like that:

A curve or graph,…

After the Update to CEE 2.2 the mirth-agent is dead now I think: :sleepy: