Defined Type: monitoring::grafana_alert

Defined in:
modules/monitoring/manifests/grafana_alert.pp

Overview

Define: monitoring::grafana_alert

Provisions an Icinga check that “forwards” Grafana alerts for a given dashboard.

Parameters

dashboard_uid

Grafana dashboard uid. For example: '000000400'. Required.

grafana_url

URL of Grafana. Defaults to 'grafana.wikimedia.org'.

contact_group

Icinga contact group that should receive alerts. Defaults to 'admins'.

Examples

# Emit a critical if any grafana alert on the jobqueue-eventbus
# dashboard is in "alterting" state.
monitoring::grafana_alert { 'db/jobqueue-eventbus':
    dashboard_uid => '000000400',
}

Parameters:

  • dashboard_uid (Any)
  • ensure (Any) (defaults to: present)
  • grafana_url (Any) (defaults to: 'https://grafana.wikimedia.org')
  • contact_group (Any) (defaults to: 'admins')
  • notes_url (Any) (defaults to: undef)


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'modules/monitoring/manifests/grafana_alert.pp', line 28

define monitoring::grafana_alert(
    $dashboard_uid,
    $ensure        = present,
    $grafana_url   = 'https://grafana.wikimedia.org',
    $contact_group = 'admins',
    $notes_url     = undef,
) {
    $notes_urls = monitoring::build_notes_url($notes_url, ["${grafana_url}/d/${dashboard_uid}/"])

    monitoring::service { $title:
        ensure        => $ensure,
        description   => "${title} grafana alert",
        check_command => "check_grafana_alert!${dashboard_uid}!${grafana_url}",
        contact_group => $contact_group,
        notes_url     => $notes_urls,
    }
}