Last active
June 21, 2017 11:17
-
-
Save calebhailey/8fed39a2eba3d230933f6d53de038f24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"handlers": { | |
"example_handler": { | |
"type": "pipe", | |
"command": "notify_somebody.rb", | |
"timeout": 30, | |
"filter": "filter_weekly_maintenance" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"filters": { | |
"filter_july_29_maintenance": { | |
"negate": true, | |
"attributes": { | |
"timestamp": "eval: Time.new(2016,7,29,18,0,0,'-06:00') < value && value < Time.new(2016,7,30,6,0,0,'-06:00')", | |
"check": { | |
"name": "eval: ['check_foo','check_bar','check_baz'].include?(value)" | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"filters": { | |
"filter_weekly_maintenance": { | |
"negate": true, | |
"attributes": { | |
"timestamp": "eval: (Time.at(value).wday == 5 && Time.at(value).hour > 18) || (Time.at(value).wday == 6 && Time.at(value).hour < 6)", | |
"check": { | |
"name": "eval: ['check_foo','check_bar','check_baz'].include?(value)" | |
} | |
} | |
} | |
} | |
} |
Thank you guys so much! This is exactly what I need until scheduled maintenance is available. 😄
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scenario: Friday night maintenance window(s) for three specific checks (from Friday at 6:00 PM to Saturday at 6:00 AM).
These are a couple of example eval filters someone could use for a one-time scheduled maintenance (i.e.
filter_july_29_maintenance
), or for a regular weekly maintenance (i.e.filter_weekly_maintenance
). While not as ideal as first-class support for scheduled maintenance (which is coming soon), these filters provide a good example of how powerful eval filters can be – and they're not even using filter eval tokens.PS- the example handler definition is provided as a reminder that filters are applied to handlers, not directly to checks. 😄