Skip to content

Commit

Permalink
Support for Librato Alerts and Services
Browse files Browse the repository at this point in the history
  • Loading branch information
elblivion committed Aug 13, 2016
1 parent bd93641 commit e0975fd
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
66 changes: 66 additions & 0 deletions r/alert.html.markdown
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 44 additions & 0 deletions r/service.html.markdown
Original file line number Diff line number Diff line change
@@ -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 = <<EOF
{
"addresses": "admin@example.com"
}
EOF
}
```

## Argument Reference

The following arguments are supported. Please check the [relevant documentation](https://github.com/librato/librato-services/tree/master/services) for each type of alert.

* `type` - (Required) The type of notificaion.
* `title` - (Required) The alert title.
* `settings` - (Required) a JSON hash of settings specific to the alert type.

## Attributes Reference

The following attributes are exported:

* `id` - The ID of the alert.
* `type` - The type of notificaion.
* `title` - The alert title.
* `settings` - a JSON hash of settings specific to the alert type.

0 comments on commit e0975fd

Please sign in to comment.