Hi,
I’ve already got some test data from @andreas-doehler and reproduced the error earlier today.
The error is caused by some active check MKP packages which (re)load the configuration while the configuration for the core is created.
You will get the error from at least three different MKPs
check_snmp_metric/server_side_calls/check_snmp_metric.py
59: loading_result = config.load(
60- discovery_rulesets=(), get_builtin_host_labels=lambda x: {}
check_snmp/server_side_calls/check_snmp.py
75: loading_result = config.load(
76- discovery_rulesets=(), get_builtin_host_labels=lambda x: {}
check_snmp_temperature_single/server_side_calls/check_snmp_temperature_single.py
55: loading_result = config.load(
56- discovery_rulesets=(), get_builtin_host_labels=lambda x: {}
This seems to break the existing configuration. But not only in a way that some hosts get invalid rules assigned.
Entire blocks of data get corrupted and contain value from different rules. This randomly breaks other mechanisms during the config generation.
For example, here I’ve printed the hostgroups for each host. Should be a list of strings.
config cache hostgroups {'router628': ['check_mk'], 'router703': ['check_mk'], 'router502': ['check_mk'], 'router248': ['check_mk'], 'router369': ['check_mk'], 'router750': ['check_mk'], 'router654': ['check_mk'], 'router459': ['check_mk'], 'router627': ['check_mk'], 'router770': ['check_mk'], 'router408': ['check_mk'], 'router483': ['check_mk'], 'router526': ['check_mk'], 'router003': ['check_mk'], 'router696': ['check_mk'], 'router421': ['check_mk'], 'router536': ['check_mk'], 'router315': ['check_mk'], 'router172': ['check_mk'], 'router800': ['check_mk'], 'router200': ['check_mk'], 'router500': ['check_mk'], 'router683': ['check_mk'], 'router431': ['check_mk'], 'router178': ['check_mk'], 'router741': ['check_mk'], 'router757': ['check_mk'], 'router436': ['check_mk'], 'router570': ['check_mk'], 'router579': ['check_mk'], 'router005': ['check_mk'], 'router378': ['check_mk'], 'router476': ['check_mk'], 'router180': ['check_mk'], 'router080': [{'description': 'PING'}]}
The last entry got a dictionary → Config generation crashes.
Right now I am investigating the reason how this can happen. Most likely because we refer the rulesets by their id(the_ruleset)- which is just a memory address. If something gets re-initialized it is possible that a different ruleset uses the same memory address. Under investiigation…
Until then I would strongly advise against using check_snmp_metric/check_snmp/check_snmp_temperature_single
UNLESS you can make sure that it does not reach this code block. Looks like that the args can specified in multiple ways.
def check_snmp_metric_arguments(params, host_config: HostConfig) -> Iterator[ActiveCheckCommand]:
if 'creds' in params:
args = _creds_to_args(params['creds'])
else:
##### BAD THINGS WILL HAPPEN FROM HERE ON
loading_result = config.load(
discovery_rulesets=(), get_builtin_host_labels=lambda x: {}
)
config_cache = loading_result.config_cache
ip_lookup_config = config_cache.ip_lookup_config()
host_name = HostName(host_config.name)
ip_family = ip_lookup_config.default_address_family(host_name)
ip_address = HostAddress(host_config.primary_ip_config.address)
snmp_config = config_cache.make_snmp_config(host_name, ip_family, ip_address, SourceType.HOST, backend_override=None)
args = _creds_to_args(snmp_config.credentials)