I came across a weird problem. Or maybe it’s me.
A monitoring user had a notification period set to short-businesshours:
object User "user@example.com" {
display_name = "Example User"
groups = ["Group1"]
email = "user@example.com"
states = [ OK, Warning, Critical, Unknown, Up, Down ]
types = [ Problem, Recovery, Acknowledgement ]
period = "shortbusinesshours"
enable_notifications = 1
}
Now this period
was removed, which should use the default period.
After an Icinga 2 reload I expected to see the updated status in Icingaweb2 - but no:
Interestingly, both icinga2
(cli) and the Icinga 2 API show the updated contact details. Here’s the output from the API:
# curl -s -k -u root:pass 'https://localhost:5665/v1/objects/users?user=user@example.com' | jshon
{
"results": [
{
"attrs": {
"__name": "user@example.com",
"active": true,
"display_name": "Example User",
"email": "user@example.com",
"enable_notifications": true,
"groups": [
"Group1"
],
"ha_mode": 0.0,
"last_notification": 0.0,
"name": "user@example.com",
"original_attributes": null,
"package": "_cluster",
"pager": "",
"paused": false,
"period": "",
"source_location": {
"first_column": 0.0,
"first_line": 1.0,
"last_column": 36.0,
"last_line": 1.0,
"path": "\/var\/lib\/icinga2\/api\/zones\/global-templates\/_etc\/users\/exampleuser.conf"
},
"states": [
"OK",
"Warning",
"Critical",
"Unknown",
"Up",
"Down"
],
"templates": [
"user@example.com"
],
"type": "User",
"types": [
"Problem",
"Recovery",
"Acknowledgement"
],
"vars": null,
"version": 0.0,
"zone": "global-templates"
},
"joins": {},
"meta": {},
"name": "user@example.com",
"type": "User"
}
]
}
After some research I figured out that the old period is stuck in the contact object in IDO:
mysql> select email_address,host_timeperiod_object_id,service_timeperiod_object_id from icinga_contacts WHERE email_address = 'user@example.com';
+-------------------------+---------------------------+------------------------------+
| email_address | host_timeperiod_object_id | service_timeperiod_object_id |
+-------------------------+---------------------------+------------------------------+
| user@example.com | 973 | 973 |
+-------------------------+---------------------------+------------------------------+
1 row in set (0.00 sec)
mysql> select timeperiod_object_id,alias from icinga_timeperiods WHERE timeperiod_object_id = 973;
+----------------------+---------------------------------+
| timeperiod_object_id | alias |
+----------------------+---------------------------------+
| 973 | Short Businesshours Mo-Fr 09-17 |
+----------------------+---------------------------------+
1 row in set (0.00 sec)
So the questions are: Why is the old data still stuck in IDO and how can I force IDO to update?
Yes I’m aware that I can manipulate the data directly in the database, but I’d rather want to know if Icinga 2 itself offers something to update the IDO data.