tripleo-image-elements/elements/check_mk-agent
Ryan Brady 2b113e1e29 Fix dib-lint failures
As part of an ongoing effort to apply more testing against
elements, this patch provides fixes for most dib-lint
failures outside of the set -o pipefail patch[1] including
set options, indention, and file permissions.  There are
still a few indention errors left after this patch, but
they should be ignored in a dib-lint patch soon to add
additional exclusions.

[1] Ib97e3a35dd0ee653f1298c9ffe6ea99cea9dfd55

Change-Id: Ibf3dfc5735752900598466b0a54342692ef77284
2014-07-31 12:25:59 -04:00
..
install.d Fix dib-lint failures 2014-07-31 12:25:59 -04:00
os-refresh-config/pre-configure.d Fix dib-lint failures 2014-07-31 12:25:59 -04:00
README.md Auto-collect local checks 2014-07-04 08:28:22 +01:00
element-deps Install the check_mk Agent 2014-03-27 07:44:14 +00:00

README.md

Install the check_mk monitoring client from the distribution's repositories

check_mk

This element installs the client, distributes any checks found in other elements and configures IPTables to allow traffic to it.

If you wish to configure the server, please include the check_mk-server element on your icinga server.

Adding custom checks

If you wish to add a custom check to check_mk, simply carry out the following steps:

  1. Add a dependency on this element to your "element-deps" file
  2. Write a script that conforms to the output required (see example below for details)
  3. Place that script into the "check_mk_checks" directory within your element
  4. Deploy the element

The check will be picked up and deployed during the image build.

Example Check

The output from a check_mk check is very simple:

<status_code> <check_name> <performance_data || - > <check_message>

For example, if we wanted to check that a webserver was returning a response and how long that response took, we would look for the following output for a "good" check:

0 website_is_up response_time=0.007 Website is up (response code was 200)

or alternatively the following for a bad check:

2 website_is_up response_time=0.002 Website is down (response code was 500)

A small bash script to achieve this is set out below.

#!/bin/bash
curlout=$(curl --write-out "%{http_code} %{time_total}" --silent --output /dev/null http://www.example.com/)
response=$(echo $curlout|cut -d " " -f 1)
timing=$(echo $curlout|cut -d " " -f 2)
if [ "$response" -eq "200" ]; then
  retstring="0 nova_api reponse_time=$timing nova_api is up (response code was $response)"
else
  retstring="2 nova_api response_time=$timing nova_api is down (response code was $response)"
fi
echo $retstringo

If you do not have any perfdata to display, just write a dash in the correct field as follows:

0 website_is_up - Website is up (response code was 200)