Commit Graph

42 Commits

Author SHA1 Message Date
Noah Hilverling 2202bde56c Add downtime handlers to state sync 2019-11-02 14:00:23 +01:00
Jean Flach 916bfd20fb Update state sync 2019-11-02 14:00:23 +01:00
Noah Hilverling 9aec47efb3 Use OnStateChange instead of OnStateChanged 2019-11-02 14:00:23 +01:00
Jean Flach 3def496b62 Update state sync
Makes state serialization its own function to be used also when writing
out the initial state
2019-11-02 14:00:23 +01:00
Jean Flach 2215e9e16f Implement minimal state sync 2019-11-02 14:00:23 +01:00
Jean Flach c825a3f4b5 Remove unnecessary parameter 2019-11-02 14:00:23 +01:00
Jean Flach 3c651b4c99 Fix icingadb specific type names 2019-11-02 14:00:23 +01:00
Jean Flach 6aaa35a0a6 Rewrite the RedisWriter
There should be more atomic commits but the whole thing was a mess. This
commit changes the synchrounous Redis connection into an asynchronous
one in its own class RedisConnection.
The RedisConnection uses a Workqueue with commands to fire against the
Redis server. When a response is required a callback must be supplied,
refer to RedisWriter::RedisGet().

Known Issues:
- Authentication has no error handling and can break the connection
- Error handling in general is iffy due to the nature of the async redis
connection
- Getting a reply out of RedisConnection is not trivial
- HandleRW... sunt dracones
2019-11-02 14:00:23 +01:00
Jean Flach 8f411c7475 Support comments for icingadb
This splits comments into Host and Service comments
2019-11-02 14:00:23 +01:00
Michael Friedrich de99d68351 Only use the type for commands in the object identifier checksum 2019-11-02 14:00:23 +01:00
Jean Flach c70316a835 Sync ranges_checksum for timeperiods
Signed-off-by: Michael Friedrich <michael.friedrich@icinga.com>
2019-11-02 14:00:23 +01:00
Michael Friedrich e31679b2de Update Redis prefix namespaces and move their declaration into the class
icinga:config:object:<type>:<sha1>
icinga:config:checksum:<type> <sha1>
icinga:config:customvar:<type> <sha1>

icinga:status:object:<type>:<sha1>

This avoids multiple definitions all over the code. Maybe we want
to make the schema configurable at some point.
2019-11-02 14:00:23 +01:00
Alexander A. Klimov 413e351805 RedisWriter: dump custom vars verbosely 2019-11-02 14:00:23 +01:00
Michael Friedrich c5e913dfd4 Fix error handling for GetSubscriptionTypes() 2019-11-02 14:00:23 +01:00
Alexander A. Klimov 724ce1f172 RedisWriter: dump also environment_checksum (per config object) 2019-11-02 14:00:23 +01:00
Alexander A. Klimov 4eee9572ab RedisWriter: identify config objects by SHA1(PackObject([Environment, __name])) 2019-11-02 14:00:23 +01:00
Michael Friedrich d7f6d7994b Move stats into a separate file 2019-11-02 14:00:23 +01:00
Alexander A. Klimov 3ea3b2ba27 RedisWriter: checksum package, source_location and templates separately in metadata_checksum 2019-11-02 14:00:23 +01:00
Alexander A. Klimov dcdf6b8a44 RedisWriter: Exclude explicitly checksummed properties from properties_checksum 2019-11-02 14:00:23 +01:00
Michael Friedrich ddf2aea065 Compile redis into the icinga2 binary; apply more C++11 code changes 2019-11-02 14:00:23 +01:00
Michael Friedrich 61edfcb68d Apply code style 2019-11-02 14:00:23 +01:00
Jean Flach 5eab856673 Publish events to one enpoint 2019-11-02 14:00:23 +01:00
Jean Flach c8561676ec Add limit for subscriptions 2019-11-02 14:00:23 +01:00
Gunnar Beutner 06211c3ac7 Implement support for the new config/state schema
fixes #5671
2019-11-02 14:00:23 +01:00
Gunnar Beutner 1725038ca8 Implement pipelining support for Redis queries
fixes #5670
2019-11-02 14:00:23 +01:00
Gunnar Beutner b6c86f98ec Clean up the code a bit 2019-11-02 14:00:23 +01:00
Gunnar Beutner b75e21a998 Redis support (WIP) 2019-11-02 14:00:23 +01:00
Michael Friedrich 6397fedc3d Remove experimental redis feature before 2.7 release 2017-06-20 11:52:24 +02:00
Michael Friedrich 17615ac444 Redis: Dump host and service state events
fixes #5163
2017-04-12 16:58:08 +02:00
Thomas Gelf ed2ebdf0d0 RedisWriter: publish Icinga 2 stats as a simple "keepalive"
Use case: a reader subscribes to config changes. As they happen rarely, chances
are good that the connection will time out in the meantime. Now, a reconnect is
easy - but you wouldn't know whether you missed any config changes. So you are
required to issue a new sync to be on the safe side. Given a 60sec connection
timeout (think: SSL layer, firewalls etc) when no traffic happens this would be
too expensive.

Some kind of a heartbeat available for subscription would allow subscribers to
artificially keep the connection alive. As a first simple solution to this I'd
suggest to publish CIB data, that might be useful anyways.

refs #4991
fixes #5098

Signed-off-by: Michael Friedrich <michael.friedrich@icinga.com>
2017-03-29 10:17:03 +02:00
Michael Friedrich af3e2c429f Add exception handler for Redis WorkQueue
refs #4991
2017-03-29 10:17:03 +02:00
Michael Friedrich fcd9e3666d Implement config dump/update/delete publishing; fix runtime created object creation
refs #4991
2017-03-29 10:17:03 +02:00
Gunnar Beutner 75bfd775b9 Implement RedisWriter::ExecuteQuery
refs #4991
2017-03-29 10:17:03 +02:00
Michael Friedrich f29a82bcfe Add properties and vars config checksums
refs #4991
2017-03-29 10:17:03 +02:00
Michael Friedrich 0b466aabc0 Start working on checksum config dump
refs #4991
2017-03-29 10:17:03 +02:00
Gunnar Beutner 00eba25ad7 Add ASSERTs for the Redis queries
refs #4991
2017-03-16 15:09:41 +01:00
Gunnar Beutner 04be7a1f1e Implement event handlers for config and status updates
fixes #5072
fixes #5073
refs #4991
2017-03-16 13:58:31 +01:00
Michael Friedrich e5c0295c9e Redis: First attempt of a reconnect config dump
refs #5072
refs #4991
2017-03-16 13:58:18 +01:00
Michael Friedrich d3e3159e6b Implement event subscriptions
refs #4991
2017-03-14 14:47:06 +01:00
Rune Darrud e6ae582104 Add a log message for RedisWriter on start and stop
fixes #5006

Signed-off-by: Gunnar Beutner <gunnar.beutner@icinga.com>
2017-02-15 14:33:04 +01:00
Gunnar Beutner 6d620e75ed Improve reconnect behavior for the RedisWriter class
refs #4991
2017-02-13 14:21:13 +01:00
Gunnar Beutner 31650b0beb Add RedisWriter class
refs #4991
2017-02-09 16:40:11 +01:00