» Resource: signalfx_detector

Provides a SignalFx detector resource. This can be used to create and manage detectors.

» Example Usage

resource "signalfx_detector" "application_delay" {
    count = "${length(var.clusters)}"
    name = " max average delay - ${var.clusters[count.index]}"
    description = "your application is slow - ${var.clusters[count.index]}"
    max_delay = 30

    # Note that if you use these features, you must use a user's
    # admin key to authenticate the provider, lest Terraform not be able
    # to modify the detector in the future!
    authorized_writer_teams = [ "${signalfx_team.mycoolteam.id}" ]
    authorized_writer_users = [ "abc123" ]

    program_text = <<-EOF
        signal = data('app.delay', filter('cluster','${var.clusters[count.index]}'), extrapolation='last_value', maxExtrapolations=5).max()
        detect(when(signal > 60, '5m')).publish('Processing old messages 5m')
        detect(when(signal > 60, '30m')).publish('Processing old messages 30m')
    EOF
    rule {
        description = "maximum > 60 for 5m"
        severity = "Warning"
        detect_label = "Processing old messages 5m"
        notifications = ["Email,foo-alerts@bar.com"]
    }
    rule {
        description = "maximum > 60 for 30m"
        severity = "Critical"
        detect_label = "Processing old messages 30m"
        notifications = ["Email,foo-alerts@bar.com"]
    }
}

provider "signalfx" {}

variable "clusters" {
    default = ["clusterA", "clusterB"]
}

» Notification Format

As SignalFx supports different notification mechanisms a comma-delimited string is used to provide inputs. If you'd like to specify multiple notifications, then each should be a member in the list, like so:

notifications = ["Email,foo-alerts@example.com", "Slack,credentialId,channel"]

This will likely be changed in a future iteration of the provider. See SignalFX Docs for more information. For now, here are some example of how to configure each notification type:

» Email

notifications = ["Email,foo-alerts@bar.com"]

» Jira

Note that the credentialId is the SignalFx-provided ID shown after setting up your Jira integration. (See also signalfx_jira_integration.)

notifications = ["Jira,credentialId"]

» Opsgenie

Note that the credentialId is the SignalFx-provided ID shown after setting up your Opsgenie integration. Team here is hardcoded as the responderType as that is the only acceptable type as per the API docs.

notifications = ["Opsgenie,credentialId,responderName,responderId,Team"]

» PagerDuty

notifications = ["PagerDuty,credentialId"]

» Slack

Exclude the # on the channel name!

notifications = ["Slack,credentialId,channel"]

» Team

Sends notifications to a team.

notifications = ["Team,teamId"]

» Team

Sends an email to every member of a team.

notifications = ["TeamEmail,teamId"]

» Webhook

notifications = ["Webhook,secret,url"]

» Argument Reference

Notes

It is highly recommended that you use both max_delay in your detector configuration and an extrapolation policy in your program text to reduce false positives/negatives.

max_delay allows SignalFx to continue with computation if there is a lag in receiving data points.

extrapolation allows you to specify how to handle missing data. An extrapolation policy can be added to individual signals by updating the data block in your program_text.

See https://signalfx-product-docs.readthedocs-hosted.com/en/latest/charts/chart-builder.html#delayed-datapoints for more info.

» Attributes Reference

The following attributes are exported:

  • id - ID of the SignalFx detector

» Import

Downtimes can be imported using their string ID, e.g.

$ terraform import signalfx_detector.application_delay abc123