Puppet Class: pmacct

Defined in:
modules/pmacct/manifests/init.pp

Overview

SPDX-License-Identifier: Apache-2.0

Class: pmacct

Install and manage pmacct, www.pmacct.net/

Parameters

[*kafka_brokers*]
  List of Kafka Brokers hostname:port combination to contact.
  Default: undef

[*librdkafka_config*]
  List of librdkafka configs settings specified in the format indicated by upstream:

  topic, settingX, valueX
  global, settingY, valueY

  Only available for pmacct >= 1.6.2, otherwise the configuration is a no-op.
  Default: undef

[*networks*]
  List of networks to use to  differentiate in/out traffic
  Default: []
  Optional

[*rcvbuf_size*]
  Size in bytes of the socket receive buffer for UDP traffic. You will see drops if too small.
  Default: 20 MiByte
  Optional

Parameters:

  • kafka_brokers (Any) (defaults to: undef)
  • librdkafka_config (Any) (defaults to: undef)
  • networks (Optional[Array[Stdlib::IP::Address]]) (defaults to: [])
  • rcvbuf_size (Integer) (defaults to: *)


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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'modules/pmacct/manifests/init.pp', line 30

class pmacct(
  $kafka_brokers     = undef,
  $librdkafka_config = undef,
  Optional[Array[Stdlib::IP::Address]] $networks = [],
  Integer $rcvbuf_size = 20*1024*1024,
) {
    package { 'pmacct':
        ensure => present,
    }

    # Valid only when librdkafka_config is not undef
    $kafka_config_file = '/etc/pmacct/librdkafka.conf'

    file { '/etc/pmacct/pretag-nfacctd.map':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0440',
        content => template('pmacct/pretag-nfacctd.map.erb'),
        before  => File['/etc/pmacct/nfacctd.conf'],
    }

    file { '/etc/pmacct/nfacctd.conf':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0440',
        content => template('pmacct/nfacctd.conf.erb'),
        require => Package['pmacct'],
        notify  => Service['nfacctd'],
    }

    file { '/etc/pmacct/pretag-sfacctd.map':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0440',
        content => template('pmacct/pretag-sfacctd.map.erb'),
        before  => File['/etc/pmacct/sfacctd.conf'],
    }

    file { '/etc/pmacct/sfacctd.conf':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0440',
        content => template('pmacct/sfacctd.conf.erb'),
        require => Package['pmacct'],
        notify  => Service['sfacctd'],
    }


    if $librdkafka_config != undef {
        file { $kafka_config_file:
            ensure  => present,
            owner   => 'root',
            group   => 'root',
            mode    => '0440',
            content => template('pmacct/librdkafka.conf.erb'),
            require => Package['pmacct'],
            before  => [Service['nfacctd'], Service['sfacctd']],
            notify  => [Service['nfacctd'], Service['sfacctd']],
        }
    }

    service { 'nfacctd':
        ensure => running,
        enable => true,
    }
    service { 'sfacctd':
        ensure => running,
        enable => true,
    }

    profile::auto_restarts::service { 'nfacctd': }
    profile::auto_restarts::service { 'sfacctd': }

}