Defined Type: monitoring::openapi_service

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

Overview

Parameters:

  • target (String)
  • description (String)
  • notes_url (String)
  • active_host (String) (defaults to: $::profile::icinga::active_host)
  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • site (String) (defaults to: $::site)
  • params (Hash[String, Array[String]]) (defaults to: {})
  • timeout (Integer) (defaults to: 10)
  • host (String) (defaults to: $::hostname)
  • retries (Integer) (defaults to: 3)
  • group (Variant[String, Undef]) (defaults to: undef)
  • critical (Boolean) (defaults to: false)
  • check_interval (Integer) (defaults to: 1)
  • retry_interval (Integer) (defaults to: 1)
  • contact_group (String) (defaults to: lookup('contactgroups', {'default_value' => 'admins'}))
  • notifications_enabled (String) (defaults to: $::profile::base::notifications_enabled)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'modules/monitoring/manifests/openapi_service.pp', line 1

define monitoring::openapi_service (  # aka swagger
    String $target,
    String $description,
    String $notes_url,
    String $active_host                 = $::profile::icinga::active_host,
    Wmflib::Ensure $ensure              = 'present',
    String $site                        = $::site,
    Hash[String, Array[String]] $params = {},
    Integer $timeout                    = 10,
    String $host                        = $::hostname,
    Integer $retries                    = 3,
    Variant[String, Undef] $group       = undef,
    Boolean $critical                   = false,
    Integer $check_interval             = 1,
    Integer $retry_interval             = 1,
    String $contact_group               = lookup('contactgroups', {'default_value' => 'admins'}), # lint:ignore:wmf_styleguide
    String $notifications_enabled       = $::profile::base::notifications_enabled,
) {
    # only export if this is the active host
    if ($::fqdn == $active_host) {
        # Set up swagger exporter job if targets have been defined.
        prometheus::blackbox_check_endpoint { $title:
            targets          => [$target],
            site             => $site,
            params           => $params,
            timeout          => $timeout,
            exporter_address => '127.0.0.1:9220'  # from Prometheus host perspective
        }
    }

    if ($params['spec_segment'] != undef) {
        $check_command_real = "check_wmf_service_url!${target}!${timeout}!${params['spec_segment'][0]}"
    } else {
        $check_command_real = "check_wmf_service!${target}!${timeout}"
    }

    monitoring::service { $title:
        ensure                => $ensure,
        description           => $description,
        check_command         => $check_command_real,
        notes_url             => $notes_url,
        host                  => $host,
        retries               => $retries,
        group                 => $group,
        critical              => $critical,
        check_interval        => $check_interval,
        retry_interval        => $retry_interval,
        contact_group         => $contact_group,
        notifications_enabled => $notifications_enabled
    }
}