Skip to content

Commit e2a1836

Browse files
committed
doc: Describe Rules and Version for Process Event
The "Process Event" section was a bit outdated, still referring the removed Icinga 2 source. Especially the added rules and rule version logic needed some explanation.
1 parent aa1886d commit e2a1836

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

doc/20-HTTP-API.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@ 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,
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,
1011
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).
12+
[`Event`](https://github.com/Icinga/icinga-go-library/blob/main/notifications/event/event.go).
1213

1314
The 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+
The event is sent to match specific Icinga Notifications rules, created in the web interface.
18+
Next to an array of `rule_ids`, a `rules_version` must be provided, ensuring that the source has no outdated state.
19+
20+
When the submitted `rules_version` is either outdated or empty, the `/process-event` endpoint returns an HTTP 412 response.
21+
The response's body is a JSON-encoded version of the
22+
[`RulesInfo`](https://github.com/Icinga/icinga-go-library/blob/main/notifications/source/client.go),
23+
containing the latest `rules_version` together with all rules for this source.
24+
After reevaluating these rules, one can resubmit the event with the updated `rules_version`.
25+
1626
```
1727
curl -v -u 'source-2:insecureinsecure' -d '@-' 'http://localhost:5680/process-event' <<EOF
1828
{
@@ -36,7 +46,7 @@ curl -v -u 'source-2:insecureinsecure' -d '@-' 'http://localhost:5680/process-ev
3646
"severity": "crit",
3747
"username": "",
3848
"message": "Something went somewhere very wrong.",
39-
"rule_version": "23",
49+
"rules_version": "23",
4050
"rule_ids": ["0"]
4151
}
4252
EOF

0 commit comments

Comments
 (0)