Defined Type: statsite::instance

Defined in:
modules/statsite/manifests/instance.pp

Overview

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: present)
  • port (Stdlib::Port) (defaults to: 8125)
  • graphite_host (Stdlib::Host) (defaults to: 'localhost')
  • graphite_port (Stdlib::Port) (defaults to: 2003)
  • input_counter (String) (defaults to: "statsd.${::hostname}.received")
  • extended_counters (Integer) (defaults to: 1)


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
# File 'modules/statsite/manifests/instance.pp', line 22

define statsite::instance(
    Wmflib::Ensure $ensure            = present,
    Stdlib::Port   $port              = 8125,
    Stdlib::Host   $graphite_host     = 'localhost',
    Stdlib::Port   $graphite_port     = 2003,
    String         $input_counter     = "statsd.${::hostname}.received",
    Integer        $extended_counters = 1,
) {
    $stream_cmd = "python /usr/lib/statsite/sinks/graphite.py ${graphite_host} ${graphite_port} \"\""

    file { "/etc/statsite/${port}.ini":
        ensure  => $ensure,
        content => template('statsite/statsite.ini.erb'),
        require => Package['statsite'],
        notify  => Service["statsite@${port}"],
    }

    case $ensure {
      'absent': {
        $service_enable = false
      }
      default: {
        $service_enable = true
      }
    }

    service { "statsite@${port}":
        ensure   => ensure_service($ensure),
        provider => 'systemd',
        enable   => $service_enable,
        require  => File['/lib/systemd/system/statsite@.service'],
    }
}