Puppet Class: profile::prometheus::snmp_exporter

Defined in:
modules/profile/manifests/prometheus/snmp_exporter.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • prometheus_all_nodes (Array[Stdlib::Host]) (defaults to: lookup('prometheus_all_nodes'))
  • datacenters (Array[String]) (defaults to: lookup('datacenters'))


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
# File 'modules/profile/manifests/prometheus/snmp_exporter.pp', line 2

class profile::prometheus::snmp_exporter (
  # As of Jan 2022 all SNMP polling happens from codfw/eqiad netmon
  # hosts, therefore allow all Prometheus hosts to talk to snmp_exporter
    Array[Stdlib::Host] $prometheus_all_nodes = lookup('prometheus_all_nodes'),
    Array[String] $datacenters = lookup('datacenters'),
) {
    include passwords::network

    class { '::prometheus::snmp_exporter': }

    $datacenters.each |$dc| {
        if $dc in ['eqiad', 'codfw'] {
            # eqiad/codfw have sentry3 (in addition to sentry4)
            prometheus::snmp_exporter::module { "pdu_${dc}":
                template  => 'servertech_sentry3',
                community => $passwords::network::snmp_ro_community,
            }
        }

        prometheus::snmp_exporter::module { "pdu_sentry4_${dc}":
            template  => 'servertech_sentry4',
            community => $passwords::network::snmp_ro_community,
        }
    }

    if $::realm == 'labs' {
        firewall::service { 'prometheus-snmp-exporter':
            proto    => 'tcp',
            port     => 9116,
            src_sets => ['LABS_NETWORKS'],
        }
    } else {
        firewall::service { 'prometheus-snmp-exporter':
            proto  => 'tcp',
            port   => 9116,
            srange => $prometheus_all_nodes,
        }
    }
}