Puppet Class: icinga::plugins

Defined in:
modules/icinga/manifests/plugins.pp

Overview

Class: icinga::plugins

Sets up icinga check_plugins and notification commands

Parameters:



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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'modules/icinga/manifests/plugins.pp', line 4

class icinga::plugins(
    String $icinga_user,
    String $icinga_group,
){

    stdlib::ensure_packages([
        'nagios-nrpe-plugin',
        'python3-requests',
        'python3-rfc3986',
        'python3-bs4',  # for check_legal_html.py
    ])

    file { '/usr/lib/nagios':
        ensure => directory,
        owner  => $icinga_user,
        group  => $icinga_group,
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins':
        ensure => directory,
        owner  => $icinga_user,
        group  => $icinga_group,
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/eventhandlers':
        ensure => directory,
        owner  => $icinga_user,
        group  => $icinga_group,
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/eventhandlers/submit_check_result':
        source => 'puppet:///modules/icinga/submit_check_result.sh',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    file { '/var/lib/nagios/rm':
        ensure => directory,
        owner  => $icinga_user,
        group  => 'nagios',
        mode   => '0775',
    }
    file { '/etc/nagios-plugins':
        ensure => directory,
        owner  => $icinga_user,
        group  => $icinga_group,
        mode   => '0755',
    }
    # TODO: Purge this directoy instead of populating it is probably not very
    # future safe. We should be populating it instead
    file { '/etc/nagios-plugins/config':
        ensure  => directory,
        purge   => true,
        recurse => true,
        owner   => $icinga_user,
        group   => $icinga_group,
        mode    => '0755',
        notify  => Service['icinga'],
    }

    # WMF custom service checks
    file { '/usr/lib/nagios/plugins/check_legal_html.py':
        source => 'puppet:///modules/icinga/check_legal_html.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/check_wikitech_static':
        ensure => absent,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/check_mysql-replication.pl':
        source => 'puppet:///modules/icinga/check_mysql-replication.pl',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/check_MySQL.php':
        source => 'puppet:///modules/icinga/check_MySQL.php',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    class { '::nagios_common::commands':
        owner  => $icinga_user,
        group  => $icinga_group,
        notify => Service['icinga'],
    }

    include ::passwords::nagios::mysql

    $nagios_mysql_check_pass = $passwords::nagios::mysql::mysql_check_pass

    nagios_common::check_command::config { 'smtp.cfg':
        ensure     => present,
        content    => template('icinga/check_commands/smtp.cfg.erb'),
        config_dir => '/etc/icinga',
        owner      => $icinga_user,
        group      => $icinga_group,
    }

    nagios_common::check_command::config { 'mysql.cfg':
        ensure     => present,
        content    => template('icinga/check_commands/mysql.cfg.erb'),
        config_dir => '/etc/icinga',
        owner      => $icinga_user,
        group      => $icinga_group,
    }


    nagios_common::check_command::config { 'check_legal_html.cfg':
        ensure     => present,
        content    => template('icinga/check_commands/check_legal_html.cfg.erb'),
        config_dir => '/etc/icinga',
        owner      => $icinga_user,
        group      => $icinga_group,
    }

    nagios_common::check_command::config { 'check_wikitech_static.cfg':
        ensure     => absent,
        config_dir => '/etc/icinga',
        owner      => $icinga_user,
        group      => $icinga_group,
    }

    # Include elasticsearch checks
    include ::icinga::elasticsearch::base_plugin
}