-
Notifications
You must be signed in to change notification settings - Fork 584
Icinga DB: Add downtime.duration
& service_state.host_id
to Redis
#9061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icinga DB: Add downtime.duration
& service_state.host_id
to Redis
#9061
Conversation
b73b43f
to
b9abfdb
Compare
b9abfdb
to
73ce897
Compare
c507b96
to
3b348de
Compare
lib/icingadb/icingadb-objects.cpp
Outdated
auto duration = downtime->GetDuration(); | ||
if (downtime->GetFixed() || ! downtime->IsInEffect()) { | ||
duration = downtime->GetEndTime() - downtime->GetStartTime(); | ||
} | ||
attributes->Set("duration", TimestampToMilliseconds(duration)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain why this is set this way, in particular why a flexible downtime should use the scheduled duration when not in effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed this with Yonas yesterday. We have decided on the scheduled duration here, as the flexible downtime actually ends after this duration if it is not / never in effect. This duration will of course need to be updated when it comes into effect. I don't know if that's part of this PR (as it should).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we go back a step? #9049 says that you want to sort by this column. Is this just for when a user decides to sort downtimes by duration, or is this needed for some specific view? Maybe it helps to know what this will be used for in the end.
Anyways, so if you have a flexible 1h downtime in a 3h window, you want to day that the downtime has a duration of 1h while it's active, but 3h before and after that? This sounds strange to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duration refers to the actual downtime duration, i.e for fixed downtimes duration
is always scheduled_end - scheduled_start
, but for flexible downtime it is slightly different. If a flexible downtime is not in effect, then the actual duration is still scheduled_end - scheduled_start
, but if the downtime is triggered, then the duration is the same as flexible_duration
which you specified when creating the downtime. And yes this column is used for sorting downtimes by duration and for creating the downtime timeline progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why should the duration be reset to scheduled_end - scheduled_start
after a flexible downtime has ended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is, obviously, wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't get why it would be a problem if the duration was always the flexible_duration
for flexible downtimes. I'd still say it's a 1 hour downtime in a 3 hour window all the time.
However, even if you'd want to go for scheduled_duration
before it came into effect and flexible_duration
afterwards, I don't think you would want to check IsInEffect()
here as this tells you if the current time is within the effective period. I think you might want to check if the downtime has triggered at all. Check for that would be downtime->GetTriggerTime() != 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the comments below, have you tested that once a flexible downtime triggers, it sends a runtime update for the downtime config object?
lib/icingadb/icingadb-objects.cpp
Outdated
auto duration = downtime->GetDuration(); | ||
if (downtime->GetFixed() || ! downtime->IsInEffect()) { | ||
duration = downtime->GetEndTime() - downtime->GetStartTime(); | ||
} | ||
attributes->Set("duration", TimestampToMilliseconds(duration)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't get why it would be a problem if the duration was always the flexible_duration
for flexible downtimes. I'd still say it's a 1 hour downtime in a 3 hour window all the time.
However, even if you'd want to go for scheduled_duration
before it came into effect and flexible_duration
afterwards, I don't think you would want to check IsInEffect()
here as this tells you if the current time is within the effective period. I think you might want to check if the downtime has triggered at all. Check for that would be downtime->GetTriggerTime() != 0
.
Should the downtime be automatically canceled if the service object recovers before the flexible downtime expires? |
No, should exist until it ends or is canceled manually. |
ed164c1
to
75a691c
Compare
IcingaDB
: Add downtime.duration
& service_state.host_id
to redisdowntime.duration
& service_state.host_id
to Redis
75a691c
to
fe5aa1e
Compare
I removed the new columns from the history streams. These are not required in the history tables. |
resolves #9049
Corresponding Icinga DB PR: Icinga/icingadb#403
Corresponding Icinga DB Web PR(s): Icinga/icingadb-web#405, Icinga/icingadb-web#421