I am going to update the CheckMK enterprise to v2.4 and therefore have to migrate the agent-based plugins as well as rulesets to v2. I’ve found the article New blog: agent-based v1 to v2 migration; however my concern is that how I can migrate relevant rules. In other words, how can I backup and restore all the related rules after migration?
As far as I know, v1 to v2 migration involves not only plugins moving but also rulesets moving to new locations. The thing is that we have a lot of rules created under those v1 plugins. After moving rulesets, shall those rules still persist or shall I have to recreate them manually?
Ideally a plugin supporting the new v2 API will use the same names for rulesets. Furthermore, if the v2 variant requires different underlying data structures they can & should provide migration code that converts the old data structures into new ones. The result of both should be that existing rules continue to work as-is, without the need to manually recreated them by the admin.
However, there’s no guarantee that this actually works. I guess the usual recommendation is to create a copy of the site in a lab environment (there are official docs how to easily create a copy by using CheckMK’s backup & restore functionality), give updating the plugin a try & see how it goes.
In my experience most plugins do offer such a seamless transition, though I have found a couple that are explicit that they don’t, and that admins have to recreate the rulesets.
All of this is from the PoV of an admin, not of a plugin developer. Your question isn’t really clear what PoV you’re asking about, though.
Thank you for your information. I am an admin and also a plugin developer. The fact is, there were a lot of rules created against the plugin. Additionally, those rules applied on a host that belongs to a distributed checkmk.
Recreating those rules manually would be crazy. That’s why I am looking for a solution to backup then restore them. Looks like there is no such the solution.
What @mbunkus wanted to say is you don’t have to recreate your rules if your API v2 ruleset has a proper migration function. If you need a migration function inside the is relatively easy to say. If the old ruleset only used tuples to store the configured values than you need a migrate for sure. With API v2 there are only dictionaries allowed for rulesets. If you current ruleset is already producing a dictionary for the parameters then you have high chance that you “only” need to transfer all your rule to the new API. But this is enough work to do.
I have migrated the plug-in API v2 ruleset with the same check group name. All the relevant existing rules are lost and I will have to recreate them. That would be fine, however I am getting a waring saying:
Found configured rules of deprecated check group. These rules are not used by any check plug-in. Maybe this check group has been renamed during an update, in this case you will have to migrate your configuration to the new ruleset manually. Please check out the release notes of the involved versions. You may use the page “Deprecated rules” in the “Rule search” to view your rules and move them to the new rulesets. If this is not the case, the rules could be related to a disabled or removed extension package (mkp). You would have to enable/upload the corresponding package and remove the related rules before disabling/removing the package again.
In fact, all those rules have been removed already when migrating to API v2, and I did not find them under “Deprecated rules” therefore I have no idea how to fix this warning.