Puppet Class: profile::orchestrator::monitoring

Defined in:
modules/profile/manifests/orchestrator/monitoring.pp

Overview

SPDX-License-Identifier: Apache-2.0 monitoring for mysql orchestrator - T266338

Parameters:

  • check_procs (Boolean) (defaults to: lookup('profile::orchestrator::monitoring::check_procs', {'default_value' => false}))
  • check_tcp_host (Stdlib::Host) (defaults to: lookup('profile::orchestrator::monitoring::check_tcp_host', {'default_value' => '127.0.0.1'}))
  • check_tcp_port (Stdlib::Port) (defaults to: lookup('profile::orchestrator::monitoring::check_tcp_port', {'default_value' => 3000}))
  • check_http_vhost (Stdlib::Fqdn) (defaults to: lookup('profile::orchestrator::monitoring::check_http_vhost', {'default_value' => 'orchestrator.wikimedia.org'}))
  • check_http_host (Optional[Stdlib::Fqdn]) (defaults to: lookup('profile::orchestrator::monitoring::check_http_host', {'default_value' => undef}))
  • check_resolve_cache (Boolean) (defaults to: lookup('profile::orchestrator::monitoring::check_resolve_cache', {'default_value' => false}))


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
52
53
54
55
56
57
58
# File 'modules/profile/manifests/orchestrator/monitoring.pp', line 3

class profile::orchestrator::monitoring(
    Boolean $check_procs = lookup('profile::orchestrator::monitoring::check_procs', {'default_value' => false}),
    Stdlib::Host $check_tcp_host = lookup('profile::orchestrator::monitoring::check_tcp_host', {'default_value' => '127.0.0.1'}),
    Stdlib::Port $check_tcp_port = lookup('profile::orchestrator::monitoring::check_tcp_port', {'default_value' => 3000}),
    Stdlib::Fqdn $check_http_vhost = lookup('profile::orchestrator::monitoring::check_http_vhost', {'default_value' => 'orchestrator.wikimedia.org'}),
    Optional[Stdlib::Fqdn] $check_http_host = lookup('profile::orchestrator::monitoring::check_http_host', {'default_value' => undef}),
    Boolean $check_resolve_cache = lookup('profile::orchestrator::monitoring::check_resolve_cache', {'default_value' => false}),
){

    $check_procs_ensure = $check_procs ? {
        true    => 'present',
        false   => 'absent',
        default => 'absent',
    }

    $check_resolve_cache_ensure = $check_resolve_cache ? {
        true    => 'present',
        false   => 'absent',
        default => 'absent',
    }

    nrpe::monitor_service { 'orchestrator_process':
        ensure         => $check_procs_ensure,
        description    => 'orchestrator process',
        nrpe_command   => "/usr/lib/nagios/plugins/check_procs -w 1:1 -c 1:1 --ereg-argument-array 'orchestrator http'",
        notes_url      => 'https://wikitech.wikimedia.org/wiki/Orchestrator',
        migration_task => 'T357099',
    }

    # Check orchestrator is running via the status API. This endpoint
    # bypasses CAS.
    if $check_http_host == $facts['networking']['fqdn'] {
        prometheus::blackbox::check::http { $check_http_vhost:
            team           => 'data-persistence',
            severity       => 'critical',
            path           => '/api/status',
            force_tls      => true,
            status_matches => [200],
            probe_runbook  => 'https://wikitech.wikimedia.org/wiki/Orchestrator',
        }
    }

    nrpe::plugin { 'check_orchestrator_resolve_cache':
        ensure => $check_resolve_cache_ensure,
        source => 'puppet:///modules/profile/orchestrator/check_orchestrator_resolve_cache.sh',
    }

    nrpe::monitor_service { 'orchestrator_resolve_cache':
        ensure       => $check_resolve_cache_ensure,
        description  => 'orchestrator resolve cache non-FQDNs',
        nrpe_command => '/usr/local/lib/nagios/plugins/check_orchestrator_resolve_cache',
        sudo_user    => 'root',
        notes_url    => 'https://wikitech.wikimedia.org/wiki/Orchestrator',
        require      => Nrpe::Plugin['check_orchestrator_resolve_cache'],
    }
}