@robin.gierse as requested…
Checkmk Enterprise Free Edition 2.0.0p23
Reproduction steps:
- Create new custom Tag using UI
- Create new Host and assign the custom Tag using UI
- Save config using UI
- Show the Host using REST API - fails with 500
- Create a new Host with custom Tag using REST API - fails with 400
- Restart Checkmk - omd stop; omd start
- Show the Host using REST API - succeeds
- Create a new Host with custom Tag using REST API - succeeds
REST API request/response snips below:
// SHOW HOST REQUEST
curl -X 'GET' \
'http://10.20.163.153/enea/check_mk/api/v0/objects/host_config/test001?effective_attributes=true' \
-H 'accept: application/json'
// SHOW HOST RESPONSE BEFORE CHECKMK RESTART
{
"title": "Server was about to send an invalid response.",
"status": 500,
"detail": "This is an error of the implementation.",
"errors": {
"_schema": {
"tag_custom_tag": "Unknown field.",
"_schema": [
"tag_custom_tag is not a custom host attribute."
]
}
},
// SHOW HOST RESPONSE AFTER CHECKMK RESTART
...
"locked_attributes": [],
"labels": {},
"tag_address_family": "ip-v4-only",
"tag_custom_tag": "option2", <--- HERE
"tag_agent": "cmk-agent",
"tag_piggyback": "auto-piggyback",
"tag_snmp_ds": "no-snmp",
"tag_criticality": "prod",
"tag_networking": "lan"
...
// CREATE HOST REQUEST
curl -X 'POST' \
'http://10.20.163.153/enea/check_mk/api/v0/domain-types/host_config/collections/all' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"folder": "/",
"host_name": "test002",
"attributes": {
"ipaddress": "192.168.0.123",
"tag_custom_tag": "option1"
}
}'
// CREATE HOST REQUEST BEFORE CHECKMK RESTART
{
"title": "Bad Request",
"status": 400,
"detail": "These fields have problems: attributes",
"fields": {
"attributes": {
"_schema": [
"tag_custom_tag is not a custom host attribute."
]
}
}
}
// CREATE HOST REQUEST AFTER CHECKMK RESTART
"domainType": "host_config",
"id": "test002",
"title": "test002",
"members": {},
"extensions": {
"folder": "",
"attributes": {
"ipaddress": "192.168.0.123",
"meta_data": {
"created_at": "2022-05-19T14:53:19.255259+00:00",
"updated_at": "2022-05-19T14:53:19.309193+00:00",
"created_by": "cmkadmin"
},
"tag_custom_tag": "option1" <--- HERE
},
"effective_attributes": null,
"is_cluster": false,
"is_offline": false,
"cluster_nodes": null
}
}