Puppet Class: nftables::rules::node_exporter

Defined in:
manifests/rules/node_exporter.pp

Summary

manage in node exporter

Overview

Parameters:

  • prometheus_server (Optional[Variant[String,Array[String,1]]]) (defaults to: undef)

    Specify server name

  • port (Stdlib::Port) (defaults to: 9100)

    Specify port to open



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
# File 'manifests/rules/node_exporter.pp', line 4

class nftables::rules::node_exporter (
  Optional[Variant[String,Array[String,1]]] $prometheus_server = undef,
  Stdlib::Port $port = 9100,
) {
  if $prometheus_server {
    any2array($prometheus_server).each |$index,$prom| {
      nftables::rule {
        "default_in-node_exporter-${index}":
      }
      if $prom =~ /:/ {
        Nftables::Rule["default_in-node_exporter-${index}"] {
          content => "ip6 saddr ${prom} tcp dport ${port} accept",
        }
      } else {
        Nftables::Rule["default_in-node_exporter-${index}"] {
          content => "ip saddr ${prom} tcp dport ${port} accept",
        }
      }
    }
  } else {
    nftables::rule {
      'default_in-node_exporter':
        content => "tcp dport ${port} accept";
    }
  }
}