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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'modules/icinga/manifests/plugins.pp', line 4

class icinga::plugins(
    String $icinga_user,
    String $icinga_group,
){
    package { 'nagios-nrpe-plugin':
        ensure => present,
    }
    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',
    }

    # WMF custom service checks
    file { '/usr/lib/nagios/plugins/check_ripe_atlas.py':
        source => 'puppet:///modules/icinga/check_ripe_atlas.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/check_librenms.py':
        source => 'puppet:///modules/icinga/check_librenms.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    $librenms_api_key_path = '/etc/icinga/librenms_api_key'
    file { $librenms_api_key_path:
        content => secret('icinga/librenms_api_key'),
        owner   => $icinga_user,
        group   => $icinga_group,
        mode    => '0440',
    }
    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':
        source => 'puppet:///modules/icinga/check_wikitech_static.sh',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }
    file { '/usr/lib/nagios/plugins/check_wikitech_static_version':
        source => 'puppet:///modules/icinga/check_wikitech_static_version.py',
        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',
    }

    # for "check_lastmod" - Check if any website has recently been updated
    # Originally added to check if Planet content updates working (T203208)
    require_package('python3-requests', 'python3-rfc3986')

    # Wikidata dispatcher monitoring
    file { '/usr/lib/nagios/plugins/check_wikidata_crit':
        source => 'puppet:///modules/icinga/check_wikidata_crit',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    class { '::nagios_common::commands':
        owner => $icinga_user,
        group => $icinga_group,
    }

    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_ripe_atlas.cfg':
        ensure     => present,
        content    => template('icinga/check_commands/check_ripe_atlas.cfg.erb'),
        config_dir => '/etc/icinga',
        owner      => $icinga_user,
        group      => $icinga_group,
    }

    nagios_common::check_command::config { 'check_librenms.cfg':
        ensure     => present,
        content    => template('icinga/check_commands/check_librenms.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     => present,
        content    => template('icinga/check_commands/check_wikitech_static.cfg.erb'),
        config_dir => '/etc/icinga',
        owner      => $icinga_user,
        group      => $icinga_group,
    }

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

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

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