aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/ups.pp
blob: 9802d26a51168aae948cce261d9422f02e526008 (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
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')
) {
  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 => $nisip ? {
          '127.0.0.1' => present,
          default     => absent,
        }
      }
    }
  }
}