Use this HOWTO when setting default behavior of the user interface.
Introduction
The Checkmk GUI can be customized easily by each user to fit the personal needs. Here are some examples:
- The start page
- The number of columns
- The row limit
- The Sidebar snapins
- The time format
- ...
How to set Defaults?
It might be useful to define your own defaults for some of these settings, so a new user doesn't have to change everything on his own.
The factory defaults are set in the file ~/lib/python(3)/cmk/gui/plugins/config/base.py. As this file is located below the ~/lib path, it might be changed during an "omd update", so it is not recommended to change this file. But many of the settings defined there can also be set in a file below the ~/local path. The exact path differs based on the Checkmk version.
Get the factory defaults from the original file, for example:
~/lib/python3/cmk/gui/plugins/config/base.py
|
Create a file below ~/local/share/check_mk/web/plugins/config and define your preferred default setting, for example:
~/local/share/check_mk/web/plugins/config/my_base.py
|
After doing an "omd restart apache", you will find this setting in your GUI:
The views for which you already explicitly have set the Time stamp format, will not be changed, because the settings in your personal config files below ~/var/check_mk/web/<username> are overriding the default settings.
Example 2: Default Sidebar Snapins
In case of the sidebar snapins, the file ~/lib/python3/cmk/gui/plugins/config/base.py doesn't help us, because the variable "sidebar" that is set there, seems to have a new data structure. You can find out this structure by explicitly configuring your sidebar in the GUI and then checking out the file ~/var/check_mk/web/<your_username>/sidebar.mk. The structure you find there, can be used in ~/local/share/check_mk/web/plugins/config/my_base.py:
~/local/share/check_mk/web/plugins/config/my_base.py
|
Recommendations
Sometimes its hard to work out the possible values of a setting. In that case, applying the setting in the GUI and then doing a "grep" in ~/var/check_mk/web might be helpful:
|