DashboardsJanuary 29. 2012
Multisite DashbaordsSince version 1.1.12 Check_MK Multisite supports dashboards. Generally spoken a dashboard combines various contents (Multisite views, performance graphs and other things) into one page. What makes Multisite's dashboard special in comparison with other GUIs is its smart layout algorithm. It automatically adapts a dashboard to the size and aspect of the screen that a user is viewing it with. Multisite uses an example dashboard as the central main overview:
Creating your own dashboardsCustomizing dashboards can be done in two ways:
In the first case all users will see your modified dashboard instead of the builtin one. In the second case your additional dashboards can be called via the relative URL dashboard.py?name=<NAME>. If you refer to this from another application then do not forget to add the server name and full path, for example http://demo.mathias-kettner.de/demo/check_mk/dashboard.py?name=main. A good place for such links is the Custom Links snapin. The dashboards are defined as plugins to Multisite. You can find the definition of the builtin dashboard in share/check_mk/web/plugins/dashboards/builtin.py (the exact location of your share directory depends on your installation): share/check_mk/web/plugins/dashboards/builtin.py
builtin_dashboards["main"] = {
"title" : _("Main Overview"),
"dashlets" : [
{
"title" : _("Host Statistics"),
"url" : "dashlet_hoststats.py",
"position" : (1, 1),
"size" : (10, 6),
"shadow" : True,
"background" : True,
"refresh" : 60,
},
{
"title" : _("Service Statistics"),
"url" : "dashlet_servicestats.py",
"position" : (11, 1),
"size" : (10, 6),
"shadow" : True,
"background" : True,
"refresh" : 60,
},
# Further dashlets...
}
Modifying that file directly is no good idea since an update of Check_MK will overwrite your changes. A better way is to create an own file in the same directory (if you are using OMD, then place this file in ~/local/share/check_mk/web/plugins/dashboards). If you just want to modify the main dashboard, a copy of the original file is a good starting point. If you are using a manual non-OMD installation, then make sure that it does not begin with an a or b in order to make sure that it is read after the shipped file. Your own file can have any name as long as it ends with .py. Structure of a dashboard definitionEach dashboard definition begins with builtin_dashboards["myboard"] = {. If you want to modify the builtin dashboard then substitute myboard with main. From a Python point of view the dashboard definition is a dictionary with two keys:
The dashlets is what all in dashboards is about. A dashlet is a rectangular area showing some content. The configuration is again a Python dictionary with several mandatory and optional keys. An example is the dashlet with the statistics of all hosts:
{
"title" : _("Host Statistics"),
"url" : "dashlet_hoststats.py",
"position" : (1, 1),
"size" : (10, 6),
"shadow" : True,
"background" : True,
"refresh" : 60,
},
What do the various keys mean? Some deal with the content, other with the styling and yet other with the position and dimension. Let's begin with the easier ones:
The following group of keys is alternative and defines the content of the dashlet. You need to specify exactly one of those:
The Smart Layout AlgorithmWhat makes Multisite dashboards special is their capability to dynamically adapt to different screen sizes. This feature should more the compensate the (current) lack of a graphical dashboard editor. The basic idea behind this is that some dashlets are assigned dynamic dimensions and automatically grow to the maximum possible size while others have fixed sizes (like the host and service statistics in the default dashboard). In order to make exact positioning easier, all coordinates are measured in multiple of 32 pixels. You can think of the dashboard having an invisible raster of squares of the size 32x32 pixels.
This is how the smart layout algorithm will determine the size of all dashlets.
This happens not only when the dashboard is being drawn initially but also if you resize your browser windows or change the browser's zoom level (Firefox: Ctrl-+ or -). Two further notes about the layout:
|
| ||||||||||||||||||||||||||||||||||||||||||||