I’m upgrading Check MK from version 1.5.0 to 1.6.0, host.mk or static_config.mk file which contains tuple list of hosts and its tags. This works fine until 1.5.0. But it is causing an issue on “cmk -vvvC” command. Is there any good example configuration for how to change this tuple base configuration to dictionary configuration which is supported by 1.6 and higher?
I can’t share the actual configuration files, but error message:
Error precompiling checks for host HOSTNAME: ‘list’ object has no attribute ‘get’
/omd/site/SITENAME/etc/check_mk/conf.d/static_config.mk
has
all_hosts += [
”HOSTNAME1|TAG1”,
”HOSTNAME2|TAG1|TAG2”,
”HOSTNAME3|TAG-X”,
]
]
There is many tupl lists objects on
/omd/sites/SITENAME/var/check_mk/bse/precompiled_check_config.mk.orig
such as
snmp_communities = [()]
ignored_ckeck = [()]
datasource_programs = [()]
snmp_timing = [()]
statick_checks = [()]
So I don’t know which one violate new syntax, “cmk -vvvC” command doesn’t show more detail. If someone know how to debug this?
Frankly: Start from scratch with Checkmk 2.4.0.
If you are not @andreas-doehler, chances are, that you will be faster with a rebuild, than with an upgrade.
Migrate your configuration manually, by looking at the old site and configuring the new site accordingly. Of course, you can bulk import your hosts. But do not blindly carry rules over, it is likely that newer versions of Checkmk have better defaults and some of your old rules probably make no sense (anymore).
That’s 99% the possibilty last year i had such an old system and i also installed a new one only “migrated” my host objects as csv to the new system. The reason there for not updating was the very old OS where no real upgrade paths was available.
Thanks @andreas-doehler , I will follow the path you did. Only migrating host objects and create services rules from scratch.
I couldn’t find the good syntax document of new Json dictionary based file format for host and service rules. Where do you guys get these syntax information?
”cmk -vvvC” doesn’t show much error cause and which file and line, etc. So, I should get the proper syntax
Thanks @robin.gierse , I will follow your advice. Only migrating host objects and create services rules from scratch. It is actually I tried, and there are too many service rules without knowing new syntax with dictionary/JSON. So I changed the course to incremental upgrading.
I couldn’t find the good syntax document of new Json dictionary-based file format for host and service rules. Where do you guys get these syntax information?
”cmk -vvvC” doesn’t show much error cause and which file and line, etc. So, I should get the proper syntax
I mean previous check is like a list of tuples with positional directives in each tuple entry, such as
static_checks = [
([“HOST_GROUP“], ALL_HOSTS, “CMD1“, “CMD2” (“PARAMETERS” 1, 1, 999, 999)),
(),
]
The link you gave me showing a punctuation of dictionary/JSON, but it doesn’t mention each key-value pairs for translate these tuple entries into new dictionary format.
Host dictionary might also need some key-value pairs for each parameters, such as host group, IP addresses, OS type, etc.
This (manual edit of config files) should not be done anymore in current versions of CheckMK.
Please use the RestAPI or if you really want to edit manually the files, create some rules inside the setup and then inspect the result of this rule creation inside the rules.mk file.
Thank you @andreas-doehler
I was editing configuration MK files’ dictionary/JSON and “cmk -vvvO” repeatedly. I will use RestAPI for get, create, edit rules. Now you gave me the right approach.