Defined Type: prometheus::rule

Defined in:
modules/prometheus/manifests/rule.pp

Overview

Parameters:

  • instance (Any)
  • ensure (Any) (defaults to: 'present')
  • source (Any) (defaults to: undef)
  • content (Any) (defaults to: undef)
  • instance_path (Any) (defaults to: "/srv/prometheus/${instance}")


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
# File 'modules/prometheus/manifests/rule.pp', line 15

define prometheus::rule (
    $instance,
    $ensure = 'present',
    $source = undef,
    $content = undef,
    $instance_path = "/srv/prometheus/${instance}",
) {
    validate_ensure($ensure)

    $service_name = "prometheus@${instance}"
    $file_path = "${instance_path}/rules/${title}"

    validate_re($title, '.yml$')
    $validate_cmd = '/usr/bin/promtool check rules %'

    file { $file_path:
        ensure       => file,
        mode         => '0444',
        owner        => 'root',
        source       => $source,
        content      => $content,
        notify       => Exec["${service_name}-reload"],
        validate_cmd => $validate_cmd,
    }
}