You are here

Integrate Nagvis maps nicely in Check_MK

Check_MK has build-in dashboards you can create and alter from within the Check_MK webinterface. However, they do not (or at least not at this moment) give you the opportunity to create a single icon that represents a group of checks together like Nagvis. Fortunately, the current check_mk builds (both the enterprise and raw editions) comes with Nagvis preinstalled. Nagvis, on the other hand, does not handle check_mk dashlets like graphs or the status-globe. So, in order to use both on one dashboard we'd have to mix things up a bit.

In order to make things look like they belong together I created some dashboards that look like they're created in check_mk but actually make use of Nagvis maps. I'll show you how in this article.

This is a very simplistic example of what I have created:
dashboard example

The text 'CPU', 'Memory' and 'Services' are from Nagvis as Check_MK dashboards don't offer custom text. Also the coloured spheres next to the text are Nagvis status icons. The globe, on the other hand, is a Check_MK dashlet.

First, I create a basic Nagvis map with no background and insert this one in a 'custom url' dashlet on a check_mk dashboard (which is practically an iframe). Make sure that 'Render background' and 'Render the titlebar...' are unticked. Tick the 'url' box and enter the url to your Nagvis-map.

Edit the map and put this in the global section:

url_target=main
header_menu=0

You can also do this from the Nagvis menu:
- url target: Edit Map -> Map Options -> Obj. Defaults.
- header menu: Edit Map -> Map Options -> Appearance.

The url_target setting makes sure that everything you click on will be loaded in the 'main' frame, which is the name of the frame where all check_mk pages are loaded. This way you will stay inside the check_mk webinterface whenever you click anything.

To make the underlaying Nagvis-maps look like they belong inside check_mk, I created a css file in <omd user>/local/share/nagvis/htdocs/userfiles/styles/check_mk.css with the following content:

body {
    background-image: url("/<omd user>/check_mk/images/contentframe_background.jpg");
    font-family: arial,helvetica,sans-serif;
}

.box {
    color: #FFFFFF;
}

This makes use of the same background-image all check_mk pages use and provide the same font and font color.

In the the map config files I'd put this in the global secion:

stylesheet=check_mk.css
url_target=main
header_menu=0

Bonus

You can use a dyngroup but that doesn't link back to anything. If you use the url in the example below you can use the same regex as used in the dyngroup so it itegrates more nicely. In this example I used a very simple regex ('Memory'). You can use more advanced regexes but you have to urlencode it when using characters like ^ or |. Off course you also have to change <omd user> with the OMD user of your instance.

define dyngroup {
name=All systems memory usage
object_types=service
object_filter=Filter: host_groups >= production\nFilter: description ~ Memory\n
x=145
y=400
url=/<omd user>/check_mk/view.py?filled_in=filter&opthost_group=production&service_regex=Memory&search=Search&view_name=searchsvc
}