Update docs

This commit is contained in:
Jean Flach 2017-10-16 12:03:16 +02:00 committed by Michael Friedrich
parent c8561676ec
commit 26a758b941
1 changed files with 43 additions and 2 deletions

View File

@ -1,4 +1,46 @@
### Keys # Icinga2 Redis <a id="icinga-redis"></a>
## Subscriptions and events
Using the redis feature allows you to add subscriptions for events which will then be served by Icinga 2 over Redis.
Possible event types:
* CheckResult
* StateChange
* Notification
* AcknowledgementSet
* AcknowledgementCleared
* CommentAdded
* CommentRemoved
* DowntimeAdded
* DowntimeRemoved
* DowntimeStarted
* DowntimeTriggered
### Creating a subscription
A subscription is created by creating a new key `icinga:subscription:<name>` in redis with a set of event types. All
events matching the the type of those listed will then be added to a list at `icinga:event:<name>`. The events are
rotated on a first-in-first-out basis, the default limit is (TODO) and can be overwritten by setting
`icinga:subscription:<name>:limit` to the desired ammount.
The events are saved as json encoded strings, similar to the API.
It is recommended to use `LPOP` to read from the list and discard read events at the same time.
Example:
```
$ redis-cli
127.0.0.1:6379> SADD icinga:subscription:noma-2 "Notification" "CheckResult"
(integer) 2
127.0.0.1:6379> SET icinga:subscription:noma-2:limit 500
OK
...
127.0.0.1:6379> LRANGE icinga:event:noma-2 0 1
1) "{\"check_result\":{\"active\":true,\"check_source\":\"icinga-1\",\"command\":[\"/usr/lib/nagios/plugins/check_ping\" ... ]}}"
1) "{\"check_result\":{\"active\":true,\"check_source\":\"icinga-2\",\"command\":[\"/usr/lib/nagios/plugins/check_ping\" ... ]}}"
```
All Keys are prefixed with "icinga:" All Keys are prefixed with "icinga:"
@ -10,4 +52,3 @@ config:{type} | Hash | Config | Has all the config with name
config:{type}:checksum | Hash | Checksums | Key is name, returns a json encoded string of checksums config:{type}:checksum | Hash | Checksums | Key is name, returns a json encoded string of checksums
subscription:{name} | String | sub description | json string describing the subsciption subscription:{name} | String | sub description | json string describing the subsciption
event:{name} | List | sub output | Publish endpoint for subscription of the same name event:{name} | List | sub output | Publish endpoint for subscription of the same name
:trigger::configchange | List | ? | I have no idea what this is or where it comes from