Defined Type: smokeping::target

Defined in:
manifests/target.pp

Summary

SmokePing target

Overview

Parameters:

  • pagetitle (Optional[String[1]]) (defaults to: undef)

    Title. If empty, menu will be used as Title

  • menu (Optional[String[1]]) (defaults to: undef)

    Menu name.

  • hierarchy_level (Integer) (defaults to: 1)

    Level of this target on the menu hierarchy.

  • hierarchy_parent (Optional[String[1]]) (defaults to: undef)

    If hierarchy_level > 1, this specifies the parent.

  • probe (Optional[String[1]]) (defaults to: undef)

    Which probe to use.

  • host (Optional[String[1]]) (defaults to: undef)

    Target host name/IP.

  • alerts (Array) (defaults to: [])

    Array of Alerts to apply to this target

  • slaves (Array) (defaults to: [])

    Array of slaves on which to run this target

  • nomasterpoll (Boolean) (defaults to: false)

    Disable data-polling from master

  • remark (Optional[String[1]]) (defaults to: undef)

    Remark displayed on Website

  • options (Hash) (defaults to: {})


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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'manifests/target.pp', line 32

define smokeping::target (
  Optional[String[1]] $pagetitle        = undef,
  Optional[String[1]] $menu             = undef,
  Optional[String[1]] $hierarchy_parent = undef,
  Optional[String[1]] $probe            = undef,
  Optional[String[1]] $host             = undef,
  Optional[String[1]] $remark           = undef,
  Integer $hierarchy_level = 1,
  Array $alerts            = [],
  Array $slaves            = [],
  Boolean $nomasterpoll    = false,
  Hash $options            = {},
) {
  assert_type(Pattern[/^[-_0-9a-zA-Z]+$/], $name)

  $filename = "${smokeping::targets_dir}/${hierarchy_level}-${name}"
  concat { $filename:
    owner   => root,
    group   => root,
    mode    => '0644',
    require => File[$smokeping::targets_dir],
    notify  => Class['smokeping::service'],
  }
  concat::fragment { "target-definition-${hierarchy_level}-${name}":
    target  => $filename,
    order   => 10,
    content => template('smokeping/target.erb'),
  }

  # Top level
  if $hierarchy_level == 1 {
    concat::fragment { "target-${hierarchy_level}-${name}":
      target  => '/etc/smokeping/config.d/Targets',
      order   => '11',
      content => "@include ${filename}\n",
    }
  } else {
    #all other levels
    unless $hierarchy_parent {
      fail('hierarchy_parent has to be specified for levels > 1')
    }
    $parent_level = $hierarchy_level - 1
    $parent_filename = "${smokeping::targets_dir}/${parent_level}-${hierarchy_parent}"
    concat::fragment { "target-${parent_level}-${hierarchy_parent}-${name}":
      target  => $parent_filename,
      order   => '11',
      content => "@include ${filename}\n",
    }
  }
}