1. Introduction
In Checkmk you can store custom notes for all hosts and services individually and specifically, or for entire groups. These notes are displayed in separate columns named Custom services notes and Custom host notes. By default, these columns are already displayed in the detailed views for hosts (Status of Host myhost) and services (Service myservice, myhost). Because these are standard columns, they can also be inserted into many other views in Checkmk.
2. Creating notes
Notes can be created directly in your Checkmk site’s configuration directory.
To do this, first create the notes
directory in ~/etc/check_mk/
.
OMD[mysite]:~$ mkdir ~/etc/check_mk/notes
2.1. Host notes
To next create notes for hosts, create the hosts
directory within the notes
directory.
OMD[mysite]:~$ mkdir ~/etc/check_mk/notes/hosts
If you now want to create a note for a specific host, create a file whose name corresponds exactly to that host’s name in Checkmk. Use the editor of your choice or the shell redirection, as in the following example:
OMD[mysite]:~$ echo "My custom host note for myhost" > ~/etc/check_mk/notes/hosts/myhost
Located at the very bottom of the Status of Host view, this note will look like this:
If you want a single such file to refer to and be displayed on multiple hosts at once, you can work with shell patterns such as the asterisk, the question mark, and also character classes.
To do this, the file name in the respective directory must actually contain these characters.
So a file named '*'
in the directory ~/etc/check_notes/hosts/
would refer to all hosts.
The contents of the '*'
file would consequently be displayed at each individual host in your site.
Important: The names of such files must be enclosed in single quotes.
If — for some reason — you want to display a specific note on all hosts whose name ends in t
, then create a file named '*t'
.
OMD[mysite]:~$ echo "The name auf this host ends with t" > ~/etc/check_mk/notes/hosts/'*t'
If more than one file matches the name of a host, the Custom host notes field will also display all matching notes. The different notes are separated by a horizontal line:
2.2. Service notes
To be able to create such notes for services as well, you will need the services
directory within ~/etc/check_mk/notes/
.
OMD[mysite]:~$ mkdir ~/etc/check_mk/notes/services
In contrast to the hosts, you cannot start right away in this directory with the files for your notes. Here you need another directory level, which defines, for which hosts a service note should be displayed.
So next, create a directory that designates one host — or following the patterns shown above — multiple hosts.
So a directory named '*'
would again refer to all hosts.
OMD[mysite]:~$ mkdir ~/etc/check_mk/notes/services/'*'
In a directory that corresponds exactly to a host name, you can then create notes only for the services for that one host.
OMD[mysite]:~$ mkdir ~/etc/check_mk/notes/services/myhost
So if you want to create notes for the services on all hosts that start with my
, you will need to create a directory named 'my*'
.
OMD[mysite]:~$ mkdir ~/etc/check_mk/notes/services/'my*'
Again, make sure to enclose the directory names in single quotes.
Once you have created the host level according to your requirements, you can — analogous to the host notes — again create files, which this time must correspond to the desired Service description. Likewise, you can work with asterisks, question marks, and character classes.
The following example creates a note for the Check_MK service on each of the hosts in your site.
OMD[mysite]:~$ echo "Note about service Check_MK for all hosts" > ~/etc/check_mk/notes/services/'*'/Check_MK
3. Macros that can be used
Within the notes you can use macros, which will then be replaced as appropriate in the view. The following macros are available for use here:
|
Host name |
|
Host name in lowercase letters |
|
Host name in uppercase letters |
|
Host name with the first letter uppercase and the rest lowercase |
|
The IP address of the host over which it is monitored. |
|
Service description (only for service notes) |
|
ID of the Checkmk site |
|
URL prefix of the site |
|
Output of the check plug-in (for host notes only) |
|
Output of the check plug-in (for service notes only) |
For example, you could use a single file to refer to different entries in your in-house wiki, each of which will always match the currently-open host.
Additional information about <a href="http://mywiki.local/page.php?host=$HOSTNAME$" target="_blank">this host in our wiki</a>