Monitoring MongoDB

Hello everybody,

I’m trying to use the plugin mk_mongodb, I put it the file in the next mongo server path /usr/lib/check_mk_agent/plugins also I granted excute permissions like mk_postgres, but unfortunately this didn’t work.

image

image

Someone have any clue of how to use it this plugin?

Regards!
Cesar Valdez

Plugins run with the python (2) that comes with CheckMk 1.x.

To run the plugin manually, where that makes sense, just directly invoke your checkmk’s python with the script as an agument:

<omd-site-path>/bin/python mk_mongodb

I think there’s a better way than even this though that will pull in requisite env variables as well… (somebody else feel free to post).

@cjcox There is no

<omd-site-path>

on the client side.

Good point. (my bad) You can invoke a local python installed on the client. It might have some dependencies.

I’m not perfectly sure but I think e.g. Ubuntu 20.04 doesn’t come with Python 2.x but only with Python 3.x by default. I tried to run python3 mk_mongodb. I don’t have any MongoDB but just wanted to check if Python3 complains. It does so about the missing module 'pymongo' – but so it does when running it with python2. I guess that’s a module that would exist if I had MongoDB installed.

My suggestion would be to change the shebang line to

#!/usr/bin/env python3

and give it a try. If that doesn’t work, then either make the agent plugin Python3 compatible (the tool 2to3 can be of help here) or install Python2.


EDIT: Another possibility might be that python is already installed but not located in /usr/bin/python. Try which python. If that returns anything useful then change the shebang line accordingly. Or (prefered) set it to #!/usr/bin/env python (note the python vs. python3).