Puppet Class: swift::stats::accounts

Defined in:
modules/swift/manifests/stats/accounts.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • swift_cluster (String)
  • accounts (Hash[String, Hash])
  • credentials (Hash[String, String])
  • ensure (Wmflib::Ensure) (defaults to: present)
  • statsd_host (Any) (defaults to: 'statsd.eqiad.wmnet')
  • statsd_port (Any) (defaults to: 8125)
  • statsd_prefix (Any) (defaults to: "swift.${swift_cluster}.stats")


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
# File 'modules/swift/manifests/stats/accounts.pp', line 2

class swift::stats::accounts(
    String $swift_cluster,
    Hash[String, Hash] $accounts,
    Hash[String, String] $credentials,
    Wmflib::Ensure $ensure = present,
    $statsd_host   = 'statsd.eqiad.wmnet',
    $statsd_port   = 8125,
    $statsd_prefix = "swift.${swift_cluster}.stats",
) {
    $required_packages = [
        Package['python3-swiftclient'],
        Package['python3-statsd'],
        Package['swift'],
        ]

    # report account stats to graphite
    file { '/usr/local/bin/swift-account-stats':
        ensure  => $ensure,
        owner   => 'root',
        group   => 'root',
        mode    => '0555',
        source  => "puppet:///modules/${module_name}/swift-account-stats.py",
        require => $required_packages,
    }

    file { '/usr/local/bin/swift-account-stats-timer.sh':
        ensure => $ensure,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
        source => 'puppet:///modules/swift/swift-account-stats-timer.sh'
    }

    # report container stats to graphite
    file { '/usr/local/bin/swift-container-stats':
        ensure  => $ensure,
        owner   => 'root',
        group   => 'root',
        mode    => '0555',
        source  => "puppet:///modules/${module_name}/swift-container-stats.py",
        require => $required_packages,
    }

    file { '/usr/local/bin/swift-container-stats-timer.sh':
        ensure => $ensure,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
        source => 'puppet:///modules/swift/swift-container-stats-timer.sh'
    }

    $account_names = sort(keys($accounts))
    swift::stats::stats_account { $account_names:
        ensure        => $ensure,
        accounts      => $accounts,
        statsd_prefix => $statsd_prefix,
        statsd_host   => $statsd_host,
        statsd_port   => $statsd_port,
        credentials   => $credentials,
    }
}