flapjack / flapjackfeeder

Nagios/Icinga event broker module (neb), inserts events to Flapjack's Redis queue
GNU General Public License v2.0
8 stars 5 forks source link

support multiple redis targets #12

Closed bs-github closed 9 years ago

bs-github commented 9 years ago

I've implemented support for feeding multiple redis targets.

Via specifying more than one (host, port) tuple as options when loading the event broker module into nagios, we can feed more than one reds now.

broker_module=/usr/local/lib/flapjackfeeder.o redis_host=127.0.0.1,redis_port=6381,redis_host=localhost,redis_port=6380

This will work with as many targets as you want. It will feed any reachable target and try to (re)connect to unreachable targets every 15 seconds (configurable via redis_connect_retry_interval=15). The reconnect attempt has a timeout of 1.5 seconds, which is the only nagios blocking part of the code except from the LPUSH to redis that could be slow as well, but if that fails to be fast (1.5s timeout), the connection will be considered unreachable and reconnected. Therefore watch out for lines like this in the nagios.log:

[1432570967] flapjackfeeder: redis connection has to be (re)established (redis host '127.0.0.1', redis port '6381').
[1432570967] flapjackfeeder: Connection error: 'Connection refused'. But I'll retry to connect regulary.
jessereynolds commented 9 years ago

Nice work!

What is the timeout behaviour in the previous version in the case where redis takes longer than 1.5 seconds to complete an LPUSH?

In particular, is that LPUSH retried or that event is dropped?

bs-github commented 9 years ago

Events will be dropped. The older versions act in the same way.

On 25 May 2015, at 11:32 pm, Jesse Reynolds notifications@github.com wrote:

Nice work!

What is the timeout behaviour in the previous version in the case where redis takes longer than 1.5 seconds to complete an LPUSH?

In particular, is that LPUSH retried or that event is dropped? — Reply to this email directly or view it on GitHub.

jessereynolds commented 9 years ago

@bs-github is this good to merge? I think it is?

bs-github commented 9 years ago

yep, merging