Hello,
- Debian Buster
- Icinga2 2.12.3-1.buster
I’ve added some passive service checks via API and later also added something like:
service.vars.sections = devops
neither my service group
object ServiceGroup "Devops Services" {
display_name = "Devops Services"
assign where "devops" in service.vars.sections || service.vars.notification_devops == "true"
}
nor the notification apply rule is picked up:
apply Notification "Devops service problems" to Service {
import "Generic Service Alarm by E-Mail"
interval = 0s
period = "24x7"
assign where "devops" in service.vars.sections || vars.notification_devops == "true"
states = [ Critical, OK, Unknown ]
types = [ Problem, Recovery ]
user_groups = [ "Devops" ]
}
but only for the passive service object, created via API (and later modified).
The object was created with curl and then later modified, to add the “sections”:
curl -k -X "POST" "https://${MON_HOST}/v1/objects/services/${MON_OBJECT_HOST}!${MON_OBJECT_SERVICE}" \
-H "Accept: application/json" \
-H "Content-Type: application/json; charset=utf-8" \
-u ${MON_USER}:${MON_SECRET} \
-d '{ "attrs": { "vars.sections": "devops" }, "pretty": true }'
It seems, it is not picked up.
(path via Director)
object Service "cron_gl" {
import "generic-passive-service"
check_command = "passive"
check_interval = "86600"
display_name = "cron_gl"
host_name = "host.example.com"
version = 1608969173.593560
zone = "foo"
}
So, I would assume to see on the filesystem also the sections = "devops"
, but that is not the case.
I can see my “sections: devops” on the Icingaweb2 in the correct service …
The complete service object looks like:
{
"results": [
{
"attrs": {
"__name": "host-example-01.example.com!cron_gl",
"acknowledgement": 0,
"acknowledgement_expiry": 0,
"acknowledgement_last_change": 1609191009.490543,
"action_url": "",
"active": true,
"check_attempt": 1,
"check_command": "passive",
"check_interval": 86600,
"check_period": "",
"check_timeout": null,
"command_endpoint": "",
"display_name": "cron_gl",
"downtime_depth": 0,
"enable_active_checks": true,
"enable_event_handler": true,
"enable_flapping": false,
"enable_notifications": true,
"enable_passive_checks": true,
"enable_perfdata": true,
"event_command": "",
"flapping": false,
"flapping_current": 24.800000000000004,
"flapping_last_change": 0,
"flapping_threshold": 0,
"flapping_threshold_high": 30,
"flapping_threshold_low": 25,
"force_next_check": false,
"force_next_notification": false,
"groups": [],
"ha_mode": 0,
"handled": false,
"host_name": "host-example-01.example.com",
"icon_image": "",
"icon_image_alt": "",
"last_check": 1610918500.821379,
"last_check_result": {
"active": true,
"check_source": "satellite-srv-monproxy.example.com",
"command": "passive",
"execution_end": 1610918500.821377,
"execution_start": 1610918500.821377,
"exit_status": 3,
"output": "No Passive Check Result Received.",
"performance_data": [],
"schedule_end": 1610918500.821379,
"schedule_start": 1610918500.8212419,
"state": 3,
"ttl": 0,
"type": "CheckResult",
"vars_after": {
"attempt": 1,
"reachable": true,
"state": 3,
"state_type": 1
},
"vars_before": {
"attempt": 1,
"reachable": true,
"state": 3,
"state_type": 1
}
},
"last_hard_state": 3,
"last_hard_state_change": 1610832813.751877,
"last_reachable": true,
"last_state": 3,
"last_state_change": 1610832813.751877,
"last_state_critical": 0,
"last_state_ok": 1610746213.75123,
"last_state_type": 1,
"last_state_unknown": 1610918500.822568,
"last_state_unreachable": 0,
"last_state_warning": 0,
"max_check_attempts": 1,
"name": "cron_gl",
"next_check": 1611004187.902575,
"next_update": 1611090787.9028454,
"notes": "",
"notes_url": "",
"original_attributes": {
"vars.sections": null
},
"package": "_api",
"paused": false,
"previous_state_change": 1610832813.751877,
"problem": true,
"retry_interval": 30,
"severity": 2112,
"source_location": {
"first_column": 0,
"first_line": 1,
"last_column": 23,
"last_line": 1,
"path": "/var/lib/icinga2/api/packages/_api/mon-01-1490446616-1/conf.d/services/host-example-01.example.com!cron_gl.conf"
},
"state": 3,
"state_type": 1,
"templates": [
"cron_gl",
"generic-passive-service",
"generic-service"
],
"type": "Service",
"vars": {
"notification_interval": "0",
"notification_period": "24x7",
"sections": "devops"
},
"version": 1610967090.592947,
"volatile": false,
"zone": "satellite"
},
"joins": {},
"meta": {},
"name": "host-example-01.example.com!cron_gl",
"type": "Service"
}
]
}
any suggestions ?
cu denny