Puppet Class: fastnetmon

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

Overview

Parameters:

  • networks (Array[Stdlib::IP::Address,1]) (defaults to: [])
  • thresholds_overrides (Hash[String, Hash[String, Any]]) (defaults to: [])
  • graphite_host (Optional[Stdlib::Host]) (defaults to: undef)
  • icinga_dir (Optional[Stdlib::Unixpath]) (defaults to: undef)


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
# File 'modules/fastnetmon/manifests/init.pp', line 23

class fastnetmon(
  Array[Stdlib::IP::Address,1] $networks = [],
  Hash[String, Hash[String, Any]] $thresholds_overrides = [],
  Optional[Stdlib::Host] $graphite_host = undef,
  Optional[Stdlib::Unixpath] $icinga_dir = undef,
  ) {

    require_package('fastnetmon','python3-geoip2')

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

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

    file { '/usr/local/bin/fastnetmon_notify.py':
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
        source => 'puppet:///modules/fastnetmon/fastnetmon_notify.py',
    }

    file { '/usr/local/bin/fastnetmon_notify':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0555',
        content => template('fastnetmon/fastnetmon_notify.sh.erb'),
    }

    if $icinga_dir {
        file { $icinga_dir:
            ensure => directory,
            owner  => 'root',
            group  => 'root',
            mode   => '0755',
        }
    }

    service { 'fastnetmon':
        ensure => running,
        enable => true,
    }
    base::service_auto_restart { 'fastnetmon': }
}