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

Re-send notifications previously suppressed by their time periods #7816

Merged
merged 1 commit into from Aug 3, 2020

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Feb 6, 2020

fixes #6167
fixes #7099

@Al2Klimov Al2Klimov marked this pull request as ready for review February 6, 2020 11:50
@Al2Klimov Al2Klimov added this to the 2.13.0 milestone Feb 6, 2020
@dnsmichi dnsmichi requested review from htriem and N-o-X February 6, 2020 14:34
Copy link
Contributor

@N-o-X N-o-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. Please add documentation about event::SetSuppressedNotificationTypes to the JSON-RPC Message API section in Technical Concepts.

@dnsmichi
Copy link
Contributor

When the docs are updated and @lippserd agrees, we can move this to 2.12.

@Al2Klimov
Copy link
Member Author

Will add docs, but I don't agree with adding this to v2.12.

@Al2Klimov Al2Klimov self-assigned this Feb 14, 2020
@N-o-X
Copy link
Contributor

N-o-X commented Feb 14, 2020

Forgot my test protocol.

Config:

object Host "notification-test-host" {
  check_command = "dummy"
  enable_active_checks = false
  max_check_attempts = 1
}

object TimePeriod "exthours" {
  ranges = {
    "friday" = "11:15-17:00"
  }
}

object User "test-user" {
}

apply Notification "host-exthours" to Host {
  interval = 1d
  command = "mail-host-notification"

  period = "exthours"
  users = [ "test-user" ]

  assign where host.name == "notification-test-host"
}

Test:

Processing check result with exit status 1:

curl -k -s -u root:icinga -H 'Accept: application/json' \
 -X POST 'https://localhost:5665/v1/actions/process-check-result' \
 -d '{ "filter": "host.name==\"notification-test-host\"", "type": "Host", "exit_status": 1, "plugin_output": "Host is not available." }'

Results in:

[2020-02-14 11:13:10 +0100] notice/Notification: Attempting to send notifications of type 'Problem' for notification object 'notification-test-host!host-exthours'
[2020-02-14 11:13:10 +0100] notice/Notification: Not sending notifications for notification object 'notification-test-host!host-exthours': not in timeperiod 'exthours'

2 Minutes later (in TP):

[2020-02-14 11:15:00 +0100] notice/NotificationComponent: Attempting to re-send previously suppressed notification 'notification-test-host!host-exthours'.
[2020-02-14 11:15:00 +0100] notice/Notification: Attempting to send notifications of type 'Problem' for notification object 'notification-test-host!host-exthours'.

@Al2Klimov Al2Klimov force-pushed the feature/notification-timeperiod-6167 branch from 4d512e9 to c515822 Compare July 29, 2020 15:13
@Al2Klimov Al2Klimov marked this pull request as ready for review July 29, 2020 15:13
@Al2Klimov Al2Klimov removed their assignment Jul 29, 2020
@Al2Klimov Al2Klimov requested a review from lippserd July 29, 2020 15:14
@Al2Klimov
Copy link
Member Author

Feel free to merge.

@lippserd lippserd merged commit e8745f7 into master Aug 3, 2020
@lippserd lippserd deleted the feature/notification-timeperiod-6167 branch August 3, 2020 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants