Puppet Plan: patching::monitoring_multiple

Defined in:
plans/monitoring_multiple.pp

Summary

Disable monitoring for targets in multiple services

Overview

Examples:

Remote target definition for $monitoring_target

vars:
  patching_monitoring_plan: 'patching::monitoring_multiple'
  patching_monitoring_plan_multiple:
    - plan: 'patching::monitoring_solarwinds'
      target: 'solarwinds'
    - plan: 'patching::monitoring_prometheus'
      target: 'prometheus'

groups:
  - name: solarwinds
    config:
      transport: remote
      remote:
        port: 17778
        username: 'domain\svc_bolt_sw'
        password:
          _plugin: pkcs7
          encrypted_value: >
            ENC[PKCS7,xxx]
    targets:
      - solarwinds.domain.tld

  - name: prometheus
    config:
      transport: remote
      remote:
        username: 'domain\prom_user'
        password:
          _plugin: pkcs7
          encrypted_value: >
            ENC[PKCS7,xxx]
    targets:
      - prometheus.domain.tld

Parameters:

  • targets (TargetSpec)

    Set of targets to run against.

  • action (Enum['enable', 'disable'])

    What action to perform on the monitored targets:

    - `enable` Resumes monitoring alerts
    - 'disable' Supresses monitoring alerts
    
  • noop (Boolean) (defaults to: false)

    Flag to enable noop mode.

  • monitoring_plans (Array[Hash]) (defaults to: get_targets($targets)[0].vars['patching_monitoring_plan_multiple'])


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'plans/monitoring_multiple.pp', line 50

plan patching::monitoring_multiple (
  TargetSpec                $targets,
  Enum['enable', 'disable'] $action,
  Array[Hash]               $monitoring_plans = get_targets($targets)[0].vars['patching_monitoring_plan_multiple'],
  Boolean                   $noop = false,
) {

  # Loop over and run each monitoring plan
  $monitoring_plans.each |Hash $plan_hash| {
    if $plan_hash['target'] {
      run_plan($plan_hash['plan'], $targets,
                action            => $action,
                monitoring_target => $plan_hash['target'],
                noop              => $noop)
    }
    else {
      run_plan($plan_hash['plan'], $targets,
                action => $action,
                noop   => $noop)
    }
  }
}