Die Checkmk-Konferenz #6 steht an! Regulärer Verkauf endet in . Tickets hier!
Sie können die neue Dokumentation hier finden, die im Laufe der Zeit die Artikel hier nach und nach ersetzt.
Dieser Artikel wird nicht mehr gepflegt und ist unter Umständen nicht mehr gültig - der neue Artikel hierzu ist jedoch noch nicht fertig!
1. Custom host and service notes
Nagios allows you to configure a noter_url for each host and service. This can be used to link to custom web pages showing more information about that specific item. It is not possible - however - to configure notes or in general text to be displayed in the GUI directly.
As of version 1.1.7i5 Multisite allows you to do exactly this in an easy and flexible way: It allows you to attach arbitrary HTML text to a service or a host. That text will be displayed in the detailed view of the host or service. That text is available as a new column named Custom host notes or Custom service notes and thus can be added to each view as you prefer.
2. How to add custom notes
Adding your own notes is easy. No configuration is needed. First create a subdirectory notes in the same directory where multisite.mk is present - usually /etc/check_mk:
root@linux# cd /etc/check_mk root@linux# mkdir notes
2.1. Notes for hosts
You can add notes for hosts and/or services. Let's start with hosts. Make a subdirectory called hosts:
root@linux# cd notes root@linux# mkdir hosts
Now let's make a note for the host b02nag01. This is done by creating a file with that name and writing HTML code into it:
This is a note for <tt>b02nag02</tt>
You can use one file for more hosts by making use of shell patterns like * and ?. Please note that here the filename aktually contains the *. While this concept is very unusual it is not at all impossible nor inconvenient. You just have to make sure that you use quotes in order to escape the patterns from the shell. The following example creates a description for all hosts containing nag:
root@linux# cd /etc/check_mk/notes/hosts root@linux# vim '*nag*'
2.2. Notes for services
Making notes for services is just as easy as for hosts but with one extra directory level. First you have to create a subdirectory services:
root@linux# cd /etc/check_mk/notes root@linux# mkdir services root@linux# cd services
Service notes can be specific to hosts. Therefore you first have to create directories for your hosts. Here exactly the same rules apply as for host notes with the only difference that we now create directories instead of files. In the following example we create the three directories b02nag02, b02* and *. They will be used for the host b02nag02, all hosts beginning with b02* (including b02nag02 and all of your host.
Just as with the host notes all matching directories will be used and scanned for matching notes. This allows you to make general notes for a specific type of services by using the directory * and at the same time additional notes for that service on one ore more specific hosts.
Within the directories spoken of you now create files matching the service descriptions the notes should be displayed at. Again those files may contain arbitrary HTML code. Here are some examples:
Make a note for service CPU Load on all hosts:
root@linux# cd /etc/check_mk/notes/services root@linux# mkdir '*' root@linux# vim '*/CPU Load'
Make an additional note for CPU Load just on b02nag02:
root@linux# mkdir 'b02nag02' root@linux# vim 'b02nag02/CPU Load'
Make notes for services containing eth0 on hosts beginning with srv:
root@linux# mkdir 'srv*' root@linux# vim 'srv*/*eth0*'
3. Replacing tags
You are for sure not the first one having the idea to add hyper links into your host or service notes. If your link contains host specific information (such as the host name or its ip address) you probably do not want to copy and paste your host notes file for each host.
Therefore, Multisite is so kind as to replace the following macros in your HTML code with the actual values:
|$HOSTNAME$||The host name|
|$HOSTNAME_LOWER$||The host name converted to lower case|
|$HOSTNAME_UPPER$||The host name converted to upper case (new in 1.1.8b2)|
|$HOSTNAME_TITLE$||The host name with the first character upper case and the rest lower case (new in 1.1.8b2)|
|$HOSTADDRESS$||The IP address of the host|
|$SERVICEDESC$||The service description (only for service notes)|
|$SITE$||The id of the site as defined in multisite.mk (new in 1.1.9i5)|
|$URL_PREFIX$||The URL prefix of the site as defined in multisite.mk (new in 1.1.9i5)|
|$HOSTOUTPUT$||The output of the host check plugin (new in 1.2.2, only for host notes)|
|$SERVICEOUTPUT$||The output of the check plugin (new in 1.2.2, only for service notes)|
Here is an example for a notes file making use of that:
Lookup <a href="http://mywiki.local/page.php?host=$HOSTNAME$">this host in Wiki</a>