Skip to content
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

Put newly configured already running ScheduledDowntime immediately in effect #6704

Merged
merged 3 commits into from
Oct 19, 2018

Conversation

efuss
Copy link
Contributor

@efuss efuss commented Oct 18, 2018

Put running downtimes in effect

If Icinga2 was restarted with a newly configured downtime that should
be in effect at the time of restart, the should-be-running segment of
it was not put into effect.

Add new LegacyTimePeriod::FindRunningSegment() and
ScheduledDowntime::FindRunningSegment() functions, call the latter in
ScheduledDowntime::CreateNextDowntime() before trying the old
ScheduledDowntime::FindNextSegment().
Before that, remove some dead code and a spurious (or so I think)
debug string.

This is (or so I hope) the easier part of Pull Request #6579

efuss added 3 commits October 18, 2018 18:09
Remove some dead code in ScheduledDowntime::CreateNextDowntime().
Remove a spurious " at " in the "Evaluating segment" debug message in ScheduledDowntime::FindNextSegment().
If Icinga2 was restarted with a newly configured downtime that should
be in effect at the time of restart, the should-be-running segment of
it was not put into effect.

Add new LegacyTimePeriod::FindRunningSegment() and
ScheduledDowntime::FindRunningSegment() functions, call the latter in
ScheduledDowntime::CreateNextDowntime() before trying the old
ScheduledDowntime::FindNextSegment().
@dnsmichi dnsmichi requested a review from mcktr October 19, 2018 08:47
@mcktr mcktr added bug Something isn't working area/notifications Notification events labels Oct 19, 2018
@mcktr
Copy link
Member

mcktr commented Oct 19, 2018

Thanks for splitting up the PR.

Test

object Host "devel-host-001" {
	import "devel-host-template"

	address = "127.0.0.1"

	vars.notification["mail"] = {
		groups = [ "icingaadmins" ]
	}
}
// newly configured already running downtime
object ScheduledDowntime "devel-downtime-001" {
	host_name = "devel-host-001"

	author = "icingaadmin"
	comment = "Some comment"

	ranges = {
		"2018-10-19" = "10:00-11:50"
	}
}

// configured downtime with the beginning in the future 
object ScheduledDowntime "devel-downtime-002" {
	host_name = "devel-host-001"

	author = "icingaadmin"
	comment = "Some comment"

	ranges = {
		"2018-10-19" = "11:55-12:00"
	}
}

metis -coding-icinga-icinga2-debug michael _003

  • Immediately after starting icinga2 the newly configured and already running ScheduledDowntime is put in effect. The host object is put in downtime and a downtime start notification is send out.
  • the second downtime in the future was correct planned and put in effect at 11:55.

This fixes #4790

@mcktr mcktr changed the title Fix/scheduleddowntime1 Put newly configured already running ScheduledDowntime immediately in effect Oct 19, 2018
@dnsmichi dnsmichi added this to the 2.11.0 milestone Oct 19, 2018
@dnsmichi
Copy link
Contributor

Thanks. I trust your expertise on this, I won't test it again.

@dnsmichi
Copy link
Contributor

@efuss thanks for the patch 👍

@dnsmichi dnsmichi merged commit acd0ad6 into Icinga:master Oct 19, 2018
@dnsmichi dnsmichi modified the milestones: 2.11.0, 2.10.3 Dec 5, 2018
@dnsmichi dnsmichi added the backported Fix was included in a bugfix release label Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/notifications Notification events backported Fix was included in a bugfix release bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants