Monitoring any linux Job with Check_MK

This article is obsolete and may be not valid anymore!

1. Overview

As of version 1.2.3i1 Check_MK ships a program and agent plugin for monitoring execution of programs like for example regular executed cron jobs on linux systems.

The current Linux agent is shipped with a program called mk-job. You can use it as wrapper for a programm call to let it record execution state and runtime statistics about the executed job.

2. Monitoring a Job

First you need to install the linux agent on your system and configure basic monitoring of the host. Once you installed the agent, you should have the mk-job command available.

Now lets assume you have a cron job with a definition like this:

/etc/cron.d/backup
5 0 * * * root /usr/local/bin/backup >/dev/null

This job executes the script /usr/local/bin/backup every night at 00:05 o'clock. Now to have this job monitored by Check_MK you simple need to add the call to mk-job before the original program call. Additional to the program call you need to provide a parameter which is then used as ident for the job. This will be used as part of the service description in Check_MK. We name it {nightly-backup}. Please keep in mind that this identifier must be unique per monitored host.

The definition now looks as follows:

/etc/cron.d/backup
5 0 * * * root mk-job nightly-backup /usr/local/bin/backup >/dev/null

Once the job gets executed the collected data is written to the file /var/lib/check_mk_agent/job/<job-ident>. The linux agent will output all information in this file to the requesting Check_MK server.

Finally after the first run of the job the only thing to do is to run a service inventory on the host and restart your monitoring process. This should create a new service prefied with the string Job for each job.

(MISSING WERK 0978)