Donating Host Data


This article is obsolete and may be not valid anymore!

1. What all about?

This time we need your help: some of your real monitoring data from your real hosts. Why? We want to create a public source of example monitoring data from real hosts. For that we need the output of the Check_MK agent of real hosts from as many different hardware and different operating systems as possible. And in order to provide live data, we need regular updates every five minutes.

2. Using donated host data

The donated data will be published on http://demo.mathias-kettner.de/donatehosts/. With that data it is possible create a test or demonstration monitoring system without touching any real target host and yet monitoring real time live data. All you have to do is to configure some of the hosts listed at that url into all_hosts in your main.mk and use HTTP to fetch the monitoring data. This can be done with the command line tool curl used as a datasource program. The following example shows a complete configuration for Check_MK doing some real monitoring:

main.mk
# Select some of the donated hosts and tag them with 'http'
all_hosts = [
  "abc123|http",
  "xyz456|http",
]

# Fetch data via HTTP (make sure curl is installed)
datasource_programs = [
  ( "curl --silent http://demo.mathias-kettner.de/donatehosts/<HOST>",
    [ "http" ], ALL_HOSTS )
]

# Set IP addresses to localhost, since they have to DNS names
ipaddresses = {
  "abc123" : "127.0.0.1",
  "xyz456" : "127.0.0.1",
}

# Set check interval for hosts to 5 minutes
extra_service_conf["check_interval"] = [
 ( "5", [ "http" ], ALL_HOSTS, [ "Check_MK$" ]),
]

Now make an inventory and let Check_MK do the rest of the work:

root@linux# cmk -I
root@linux# cmk -O

3. Donating Host Data

3.1. Juristical pre-conditions

You can help us and other Check_MK users by donating some of your host data. Before you do this, please make sure that:

  • You are allowed to publish that data.
  • The data does not contain any confidential information (passwords, IP-addresses, etc)

And make sure you've understood that:

  • Donating host data is completely voluntary.
  • Your data will be available worldwide with HTTP.
  • There is no way to revoke the data once you have sent it.
  • Mathias Kettner is not responsible for the consequences of publishing the data.

3.2. Technical pre-conditions

Donating data is done via Email. While other means such as HTTP surely have technical advantages over Email, the latter one is the easiest to get out through firewalls. And Nagios servers have a working email configuration in most cases anyway.

3.3. Setting up Check_MK

Please first make sure that your monitoring server can send Emails to donatehosts@mathias-kettner.de via the command line utility mail. Important is using a correctly formatted sender address which some mail clients generate by using the option -r (e.g. mailx). Mail coming from root@localhost will be rejected by our server.

As a next step, configure in your main.mk (or any other *.mk config file) which hosts you want to donate. This is done by the binary configuration list donation_hosts. The following example configures three hosts to donate:

donation_hosts = [
 ( [ "xsrv003", "winora12", "swi0017" ] ),
]

If you now call check_mk --donate, Check_MK will:

  • Create a gzip compressed tarball with all cached agent data from xsrv003, winora12 and swi0017 (the data below /var/lib/check_mk/cache/)
  • Encode that data with Base64
  • Send an email with that data to donatehosts@mathias-kettner.de.

The exact command for sending the email can be configured via donation_command in main.mk: the default value is:

donation_command = 'mail -r checkmk@yoursite.de -s "Host donation %s" donatehosts@mathias-kettner.de' % check_mk_version

The command is provided the Base64-encoded data on stdin. Your mail command does not need to handle attachments.

A short time after that, your host data should appear on http://demo.mathias-kettner.de/donatehosts/.

3.4. Make it regular

Since monitoring implies live data, your last step is to make the upper command regular. We propose an interval of 5 minutes. Easiest way is to configure a cron-job:

/etc/cron.d/check_mk_donate
*/5 * * * * nagios /usr/bin/check_mk --donate

Data which is not updated regularily will automatically be removed from our server. So if you want to stop donating your data then just delete your cronjob.