From e0975fdf14a5faa5a1821c02715248bf97f421bc Mon Sep 17 00:00:00 2001 From: Anthony Stanton Date: Fri, 5 Aug 2016 23:16:32 +0200 Subject: [PATCH] Support for Librato Alerts and Services --- r/alert.html.markdown | 66 +++++++++++++++++++++++++++++++++++++++++ r/service.html.markdown | 44 +++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 r/alert.html.markdown create mode 100644 r/service.html.markdown diff --git a/r/alert.html.markdown b/r/alert.html.markdown new file mode 100644 index 0000000..6e7d731 --- /dev/null +++ b/r/alert.html.markdown @@ -0,0 +1,66 @@ +--- +layout: "librato" +page_title: "Librato: librato_alert" +sidebar_current: "docs-librato-resource-alert" +description: |- + Provides a Librato Alert resource. This can be used to create and manage alerts on Librato. +--- + +# librato\_alert + +Provides a Librato Alert resource. This can be used to +create and manage alerts on Librato. + +## Example Usage + +``` +# Create a new Librato alert +resource "librato_alert" "myalert" { + name = "MyAlert" + description = "A Test Alert" + services = [ "${librato_service.myservice.id}" ] + condition { + type = "above" + threshold = 10 + metric_name = "librato.cpu.percent.idle" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the alert. +* `description` - (Required) Description of the alert. +* `active` - whether the alert is active (can be triggered). Defaults to true. +* `rearm_seconds` - minimum amount of time between sending alert notifications, in seconds. +* `services` - list of notification service IDs. +* `condition` - A trigger condition for the alert. Conditions documented below. +* `attributes` - A hash of additional attribtues for the alert. Attributes documented below. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the alert. +* `name` - The name of the alert. +* `description` - (Required) Description of the alert. +* `active` - whether the alert is active (can be triggered). Defaults to true. +* `rearm_seconds` - minimum amount of time between sending alert notifications, in seconds. +* `services` - list of notification service IDs. +* `condition` - A trigger condition for the alert. Conditions documented below. + +Conditions (`condition`) support the following: + +* `type` - The type of condition. Must be one of `above`, `below` or `absent`. +* `metric_name`- The name of the metric this alert condition applies to. +* `source`- A source expression which identifies which sources for the given metric to monitor. +* `detect_reset` - boolean: toggles the method used to calculate the delta from the previous sample when the summary_function is `derivative`. +* `duration` - number of seconds condition must be true to fire the alert (required for type `absent`). +* `threshold` - float: measurements over this number will fire the alert (only for `above` or `below`). +* `summary_function` - Indicates which statistic of an aggregated measurement to alert on. ((only for `above` or `below`). + +Attributes (`attributes`) support the following: + +* `runbook_url` - a URL for the runbook to be followed when this alert is firing. Used in the Librato UI if set. diff --git a/r/service.html.markdown b/r/service.html.markdown new file mode 100644 index 0000000..ee3cbc8 --- /dev/null +++ b/r/service.html.markdown @@ -0,0 +1,44 @@ +--- +layout: "librato" +page_title: "Librato: librato_service" +sidebar_current: "docs-librato-resource-service" +description: |- + Provides a Librato service resource. This can be used to create and manage notification services on Librato. +--- + +# librato\_service + +Provides a Librato Service resource. This can be used to +create and manage notification services on Librato. + +## Example Usage + +``` +# Create a new Librato service +resource "librato_service" "email" { + title = "Email the admins" + type = "mail" + settings = <