aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/base/metrics/collectd.pp
blob: 0f738d192cd369d5d69531d9e31060f2057b5b8d (plain)
1
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
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
82
83
84
85
86
87
88
# == Class: tripleo::profile::base::metrics::collectd
#
# Collectd configuration for TripleO
#
# === Parameters
#
# [*collectd_plugins*]
#   (Optional) List. A list of collectd plugins to configure (the
#   corresponding collectd::plugin::NAME class must exist in the
#   collectd package).
#
# [*collectd_server*]
#   (Optional) String. The name or address of a collectd server to
#   which we should send metrics.
#
# [*collectd_port*]
#   (Optional) Integer. The port to which we will connect on the
#   collectd server.
#
# [*collectd_username*]
#   (Optional) String.  Username for authenticating to the remote
#   collectd server.
#
# [*collectd_password*]
#   (Optional) String. Password for authenticating to the remote
#   collectd server.
#
# [*collectd_securitylevel*]
#   (Optional) String.
#
# [*collectd_interface*]
#   (Optional) String. Name of a network interface.
#
# [*collectd_graphite_server*]
#   (Optional) String. The name or address of a graphite server to
#   which we should send metrics.
#
# [*collectd_graphite_port*]
#   (Optional) Integer.  This is the port to which we will connect on
#   the graphite server. Defaults to 2004.
#
# [*collectd_graphite_prefix*]
#   (Optional) String. Prefix to add to metric names. Defaults to
#   'overcloud.'.
#
# [*collectd_graphite_protocol*]
#   (Optional) String. One of 'udp' or 'tcp'.
#
class tripleo::profile::base::metrics::collectd (
  $collectd_plugins = [],

  $collectd_server = undef,
  $collectd_port = 25826,
  $collectd_username = undef,
  $collectd_password = undef,
  $collectd_securitylevel = undef,

  $collectd_graphite_server = undef,
  $collectd_graphite_port = 2004,
  $collectd_graphite_prefix = undef,
  $collectd_graphite_protocol = 'udp'
) {
  include ::collectd
  ::tripleo::profile::base::metrics::collectd::plugin_helper { $collectd_plugins: }

  if ! ($collectd_graphite_protocol in ['udp', 'tcp']) {
    fail("collectd_graphite_protocol must be one of 'udp' or 'tcp'")
  }

  if $collectd_server {
    ::collectd::plugin::network::server { $collectd_server:
      username      => $collectd_username,
      password      => $collectd_password,
      port          => $collectd_port,
      securitylevel => $collectd_securitylevel,
    }
  }

  if $collectd_graphite_server {
    ::collectd::plugin::write_graphite::carbon { 'openstack_graphite':
      graphitehost   => $collectd_graphite_server,
      graphiteport   => $collectd_graphite_port,
      graphiteprefix => $collectd_graphite_prefix,
      protocol       => $collectd_graphite_protocol,
    }
  }
}