Defined Type: smokeping::target

Defined in:
manifests/target.pp

Overview

Parameters

pagetitle

Title. If empty, menu will be used as Title

menu

Menu name.

hierarchy_level

Level of this target on the menu hierarchy. (Default: 1)

hierarchy_parent

If hierarchy_level > 1, this specifies the parent

probe

Which probe to use.

host

Target host name/IP.

alerts

Array of Alerts to apply to this target

slaves

Array of slaves on which to run this target

nomasterpoll

Disable data-polling from master

remark

Remark displayed on Website

Parameters:

  • pagetitle (Optional[String[1]]) (defaults to: undef)
  • menu (Optional[String[1]]) (defaults to: undef)
  • hierarchy_parent (Optional[String[1]]) (defaults to: undef)
  • probe (Optional[String[1]]) (defaults to: undef)
  • host (Optional[String[1]]) (defaults to: undef)
  • remark (Optional[String[1]]) (defaults to: undef)
  • hierarchy_level (Integer) (defaults to: 1)
  • alerts (Array) (defaults to: [])
  • slaves (Array) (defaults to: [])
  • nomasterpoll (Boolean) (defaults to: false)
  • 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",
    }
  }
}