Defined Type: nut::client::ups

Defined in:
manifests/client/ups.pp

Overview

Add a local or remote UPS to monitor.

Examples:

Monitoring a local UPS

include ::nut
::nut::ups { 'sua1000i':
  driver => 'usbhid-ups',
  port   => 'auto',
}
::nut::user { 'test':
  password => 'password',
  upsmon   => 'master',
}
::nut::client::ups { 'sua1000i@localhost':
  user     => 'test',
  password => 'password',
  type     => 'master',
}

Monitoring a remote UPS

include ::nut::client
::nut::client::ups { 'sua1000i@remotehost':
  user     => 'test',
  password => 'password',
  type     => 'slave',
}

Parameters:

  • user (String)

    Username to use to connect to upsd.

  • password (String)

    Password to use to connect to upsd.

  • certhost (Optional[Tuple[String, Boolean, Boolean]]) (defaults to: undef)

    If using NSS and client certificate authentication specify a tuple of certificate name, whether to verify and whether to force TLS with the remote host.

  • powervalue (Integer[0]) (defaults to: 1)

    How many power supplies does this UPS feed.

  • type (Enum['master', 'slave']) (defaults to: $title)

    Is the UPS being monitored attached to the local system or not.

  • ups (Nut::Device) (defaults to: $title)

    The UPS to monitor.

See Also:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'manifests/client/ups.pp', line 38

define nut::client::ups (
  String                                    $user,
  String                                    $password,
  Optional[Tuple[String, Boolean, Boolean]] $certhost   = undef,
  Integer[0]                                $powervalue = 1,
  Enum['master', 'slave']                   $type       = $title ? {
    /@localhost(:\d+)?$/ => 'master',
    default              => 'slave',
  },
  Nut::Device                               $ups        = $title,
) {

  if ! defined(Class['nut::common']) {
    fail('You must include the nut::common base class before using any nut::client defined resources')
  }

  ::concat::fragment { "nut upsmon ${ups}":
    content => template("${module_name}/upsmon.ups.erb"),
    target  => "${::nut::common::conf_dir}/upsmon.conf",
  }
}