@@ -5,14 +5,25 @@ via `listen` and `debug-password`.
55
66## Process Event
77
8- One possible source next to the Icinga 2 API is event submission to the Icinga Notifications HTTP API listener.
9- After creating a source with type _ Other_ in Icinga Notifications Web,
10- the specified credentials can be used for HTTP Basic Authentication of a JSON-encoded
11- [ Event] ( https://github.com/Icinga/icinga-notifications/blob/main/internal/event/event.go ) .
8+ Events can be submitted to Icinga Notifications using the ` /process-event ` HTTP API endpoint.
9+
10+ After creating a source in Icinga Notifications Web,
11+ the specified credentials can be used via HTTP Basic Authentication to submit a JSON-encoded
12+ [ ` Event ` ] ( https://github.com/Icinga/icinga-go-library/blob/main/notifications/event/event.go ) .
1213
1314The authentication is performed via HTTP Basic Authentication, expecting ` source-${id} ` as the username,
1415` ${id} ` being the source's ` id ` within the database, and the configured password.
1516
17+ Events sent to Icinga Notifications are expected to match rules that describe further event escalations.
18+ These rules can be created in the web interface.
19+ Next to an array of ` rule_ids ` , a ` rules_version ` must be provided to ensure that the source has no outdated state.
20+
21+ When the submitted ` rules_version ` is either outdated or empty, the ` /process-event ` endpoint returns an HTTP 412 response.
22+ The response's body is a JSON-encoded version of the
23+ [ ` RulesInfo ` ] ( https://github.com/Icinga/icinga-go-library/blob/main/notifications/source/client.go ) ,
24+ containing the latest ` rules_version ` together with all rules for this source.
25+ After reevaluating these rules, one can resubmit the event with the updated ` rules_version ` .
26+
1627```
1728curl -v -u 'source-2:insecureinsecure' -d '@-' 'http://localhost:5680/process-event' <<EOF
1829{
@@ -36,7 +47,7 @@ curl -v -u 'source-2:insecureinsecure' -d '@-' 'http://localhost:5680/process-ev
3647 "severity": "crit",
3748 "username": "",
3849 "message": "Something went somewhere very wrong.",
39- "rule_version ": "23",
50+ "rules_version ": "23",
4051 "rule_ids": ["0"]
4152}
4253EOF
0 commit comments