Puppet Class: raid

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

Overview

Parameters:

  • write_cache_policy (Any) (defaults to: undef)
  • check_interval (Any) (defaults to: 10)
  • retry_interval (Any) (defaults to: 10)


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

class raid (
    $write_cache_policy = undef,
    $check_interval = 10,
    $retry_interval = 10,
){

    if empty($write_cache_policy) {
        $check_raid = '/usr/bin/sudo /usr/local/lib/nagios/plugins/check_raid'
    } else {
        $check_raid = "/usr/bin/sudo /usr/local/lib/nagios/plugins/check_raid --policy ${write_cache_policy}"
    }

    if 'megaraid' in $facts['raid'] {
        require_package('megacli')
        $get_raid_status_megacli = '/usr/local/lib/nagios/plugins/get-raid-status-megacli'

        file { $get_raid_status_megacli:
            ensure => present,
            owner  => 'root',
            group  => 'root',
            mode   => '0555',
            source => 'puppet:///modules/raid/get-raid-status-megacli.py';
        }

        sudo::user { 'nagios_megaraid':
            user       => 'nagios',
            privileges => ["ALL = NOPASSWD: ${get_raid_status_megacli}"],
        }

        nrpe::check { 'get_raid_status_megacli':
            command => "/usr/bin/sudo ${get_raid_status_megacli} -c",
        }

        nrpe::monitor_service { 'raid_megaraid':
            description    => 'MegaRAID',
            nrpe_command   => "${check_raid} megacli",
            check_interval => $check_interval,
            retry_interval => $retry_interval,
            event_handler  => "raid_handler!megacli!${::site}",
        }
    }

    if 'hpsa' in $facts['raid'] {
        require_package('hpssacli', 'hpssaducli')

        file { '/usr/local/lib/nagios/plugins/check_hpssacli':
            ensure => present,
            owner  => 'root',
            group  => 'root',
            mode   => '0555',
            source => 'puppet:///modules/raid/dsa-check-hpssacli',
        }

        sudo::user { 'nagios_hpssacli':
            user       => 'nagios',
            privileges => [
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller all show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] ld all show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] ld all show detail',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] ld * show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] pd all show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] pd [0-9]\:[0-9] show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] pd [0-9][EIC]\:[0-9]\:[0-9] show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] pd [0-9][EIC]\:[0-9]\:[0-9][0-9] show',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] show status',
                'ALL = NOPASSWD: /usr/sbin/hpssacli controller slot=[0-9] show detail',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller all show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] ld all show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] ld * show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] pd all show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] pd [0-9]\:[0-9] show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] pd [0-9][EIC]\:[0-9]\:[0-9] show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] pd [0-9][EIC]\:[0-9]\:[0-9][0-9] show',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] show status',
                'ALL = NOPASSWD: /usr/sbin/hpacucli controller slot=[0-9] show detail',
            ],
        }

        nrpe::monitor_service { 'raid_hpssacli':
            description    => 'HP RAID',
            nrpe_command   => '/usr/local/lib/nagios/plugins/check_hpssacli',
            timeout        => 90, # can take > 10s on servers with lots of disks
            check_interval => $check_interval,
            retry_interval => $retry_interval,
            event_handler  => "raid_handler!hpssacli!${::site}",
        }

        $get_raid_status_hpssacli = '/usr/local/lib/nagios/plugins/get-raid-status-hpssacli'

        file { $get_raid_status_hpssacli:
            ensure => present,
            owner  => 'root',
            group  => 'root',
            mode   => '0555',
            source => 'puppet:///modules/raid/get-raid-status-hpssacli.sh';
        }

        nrpe::check { 'get_raid_status_hpssacli':
            command => "${get_raid_status_hpssacli} -c",
        }
    }

    if 'mpt' in $facts['raid'] {
        package { 'mpt-status':
            ensure => present,
        }

        file { '/etc/default/mpt-statusd':
            ensure  => present,
            owner   => 'root',
            group   => 'root',
            mode    => '0555',
            content => "RUN_DAEMON=no\n",
            before  => Package['mpt-status'],
        }

        nrpe::monitor_service { 'raid_mpt':
            description    => 'MPT RAID',
            nrpe_command   => "${check_raid} mpt",
            check_interval => $check_interval,
            retry_interval => $retry_interval,
            event_handler  => "raid_handler!mpt!${::site}",
        }

        nrpe::check { 'get_raid_status_mpt':
            command => "${check_raid} mpt",
        }
    }

    if 'md' in $facts['raid'] {
        # if there is an "md" RAID configured, mdadm is already installed

        nrpe::monitor_service { 'raid_md':
            description   => 'MD RAID',
            nrpe_command  => "${check_raid} md",
            event_handler => "raid_handler!md!${::site}",
        }

        nrpe::check { 'get_raid_status_md':
            command => 'cat /proc/mdstat',
        }
    }

    file { '/usr/local/lib/nagios/plugins/check_raid':
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
        source => 'puppet:///modules/raid/check-raid.py';
    }

    sudo::user { 'nagios_raid':
        user       => 'nagios',
        privileges => ['ALL = NOPASSWD: /usr/local/lib/nagios/plugins/check_raid'],
    }
}