aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/ups.pp
blob: e9a0235b70da21c3585e4a2362a553f65f0673c6 (plain)
1
2
3
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
class nodo::subsystem::ups(
    $include        = hiera('nodo::subsystem::ups::include',        false),
    $type           = hiera('nodo::subsystem::ups::type',           'usb'),
    $cable          = hiera('nodo::subsystem::ups::cable',          'usb'),
    $dev            = hiera('nodo::subsystem::ups::dev',            '/dev/usb/hiddev0'),
    $nisip          = hiera('nodo::subsystem::ups::nisip',          '127.0.0.1'),
    $polltime       = hiera('nodo::subsystem::ups::polltime',       '60'),
    $onbatterydelay = hiera('nodo::subsystem::ups::onbatterydelay', '6'),
    $batterylevel   = hiera('nodo::subsystem::ups::batterylevel',   '5'),
    $minutes        = hiera('nodo::subsystem::ups::minutes',        '3'),
    $munin          = hiera('nodo::subsystem::ups::munin',          false)
) {
  case $include {
    true: {
      class { "apcupsd":
        upstype        => $type,
        cable          => $cable,
        device         => $dev,
        nisip          => $nisip,
        polltime       => $polltime,
        onbatterydelay => $onbatterydelay,
        batterylevel   => $batterylevel,
        minutes        => $minutes,
      }

      # Graph local UPS
      munin::plugin { 'apc_nis':
        ensure => $munin ? {
          true    => present,
          default => absent,
        }
      }
    }
  }
}