Python Scirpt monitor

i have python script to check the cloud backup status. i would like to monitor python script to ensure that if the script status is running or failed. Kindly guide the procedure to configure Python script in Checkmk Monitor.

If your python script runs on a regular basis (for example as a cronjob), then the mk-job tool might help you. It comes with the checkmk agent and is installed by default.

Basically instead of

/path/to/python-script

you would write

mk-job "My Python script" /path/to/python-script

This will then create a service for that job in the checkmk server.

Read more about it in the docs.

Another possibility would be to let your python script write a checkmk spool file below /var/lib/check_mk_agent/spool/ when it finishes and then write a check plugin that evaluates the content of the spool file. But this requires some coding.

1 Like

The spool directory sounds like a very good idea for me. I’ve been using checkmk in this mode for a while (a service that takes >1 minute to check things writes the Checkmk output to a text file and then a Powershell script reads the file), but this is way easier.

1 Like

Yes, spool files are great. Especially for tasks that run at random times and also take some (random) time to complete. For example a backup script: when finished it can write a spool file with “Hey, I’m done. I saved 2.5 GB, it took 4.3 minutes, and now it is 11:55 AM”.
All it needs is a check plugin that translates this into green, yellow and red.

Great idea, since I already have 2 backups which are set up, but I almost never look to see how long they take or if they do work at all. Thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.