Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 579 forks source link

Icinga DB: only start multiple Redis connections after the first one succeeded #8920

Closed julianbrost closed 3 years ago

julianbrost commented 3 years ago

When you have configured broken connection details in an IcingaDB object, multiple connections are started at once and they will all log that they failed to connect. There already was #8883 which was fixed by #8894, but this only affects success messages.

This could be improved by only spawning secondary connections, after the first one succeeded. This would only help with connections that are broken from the very beginning, not if Redis dies while Icinga is running.

So another option would be to reuse the m_Parent relation between Redis connections that's already there for logging and stats collection and only actually attempt to establish a new connection in the child if the parent is in a good state. The trivial implementation (if (m_Parent && !m_Parent.IsGood()) { return; /* skip connection attempt */ }) would introduce a delay by having to wait for the next timer, so a notification mechanism from parent to child after a successful connection would be nice.

julianbrost commented 3 years ago

@Al2Klimov Can you please have a look at this?