Skip to content

Latest commit

 

History

History
1267 lines (665 loc) · 19 KB

REFERENCE.md

File metadata and controls

1267 lines (665 loc) · 19 KB

Reference

Table of Contents

Classes

Defined types

Data types

Classes

nut

Installs Network UPS Tools (NUT).

  • See also
    • puppet_classes::nut::client
      • ::nut::client
    • puppet_defined_types::nut::ups
      • ::nut::ups
    • puppet_defined_types::nut::user
      • ::nut::user
    • puppet_defined_types::nut::client::ups
      • ::nut::client::ups
    • puppet_defined_types::nut::client::upssched
      • ::nut::client::upssched

Examples

Declaring the class
include ::nut
Listening on local subnet
class { '::nut':
  listen => [
    {
      'address' => $::ipaddress_eth0,
    },
    {
      'address' => $::ipaddress6_eth0,
    },
  ],
}

Parameters

The following parameters are available in the nut class.

certfile

Data type: Optional[Stdlib::Absolutepath]

Path to OpenSSL TLS certificate and key.

Default value: undef

certident

Data type: Optional[Tuple[String, String]]

Tuple of certificate name and NSS database password.

Default value: undef

certpath

Data type: Optional[Stdlib::Absolutepath]

Path to NSS certificate database.

Default value: undef

certrequest

Data type: Optional[Enum['no', 'request', 'require']]

Client certificate authentication options for NSS.

Default value: undef

client_certident

Data type: Optional[Tuple[String, String]]

Default value: undef

client_certpath

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

client_certverify

Data type: Optional[Boolean]

Default value: undef

client_cmdscript

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

client_deadtime

Data type: Optional[Integer[0]]

Default value: undef

client_finaldelay

Data type: Optional[Integer[0]]

Default value: undef

client_forcessl

Data type: Optional[Boolean]

Default value: undef

client_hostsync

Data type: Optional[Integer[0]]

Default value: undef

client_manage_package

Data type: Boolean

If the client is installed with the same package then set this to false.

Default value: $::nut::params::client_manage_package

client_manage_service

Data type: Boolean

If the client is started as part of the same service as the server then set this to false.

Default value: $::nut::params::client_manage_service

client_minsupplies

Data type: Integer[1]

Default value: 1

client_nocommwarntime

Data type: Optional[Integer[0]]

Default value: undef

client_use_upssched

Data type: Boolean

Default value: false

client_notifycmd

Data type: Optional[Stdlib::Absolutepath]

Default value: $client_use_upssched

client_notifyflag

Data type: Optional[Hash[Nut::Event, Tuple[Boolean, 3, 3]]]

Default value: undef

client_notifymsg

Data type: Optional[Hash[Nut::Event, String]]

Default value: undef

client_package_name

Data type: String

Default value: $::nut::params::client_package_name

client_pollfreq

Data type: Optional[Integer[0]]

Default value: undef

client_pollfreqalert

Data type: Optional[Integer[0]]

Default value: undef

client_rbwarntime

Data type: Optional[Integer[0]]

Default value: undef

client_service_name

Data type: String

Default value: $::nut::params::client_service_name

client_shutdowncmd

Data type: String

Default value: $::nut::params::shutdown_command

conf_dir

Data type: Stdlib::Absolutepath

Top-level configuration directory, usually /etc/nut or /etc/ups.

Default value: $::nut::params::conf_dir

driver_packages

Data type: Hash[String, String]

Hash of driver types to the package that provides it.

Default value: $::nut::params::driver_packages

group

Data type: String

The unprivileged group used to drop root privileges.

Default value: $::nut::params::group

listen

Data type: Optional[Array[Nut::Listen, 1]]

An array of hashes of interface addresses to listen on, optionally with a port.

Default value: undef

maxage

Data type: Optional[Integer[1]]

Timeout for UPS drivers.

Default value: undef

maxconn

Data type: Optional[Integer[1]]

Maximum number of connections.

Default value: undef

package_name

Data type: String

The name of the package.

Default value: $::nut::params::server_package_name

service_name

Data type: String

Name of the service.

Default value: $::nut::params::server_service_name

statepath

Data type: Stdlib::Absolutepath

Top-level state directory, usually /var/run/nut or /var/db/nut.

Default value: $::nut::params::state_dir

user

Data type: String

The unprivileged user used to drop root privileges.

Default value: $::nut::params::user

nut::cgi

Installs the Network UPS Tools (NUT) CGI scripts.

  • See also
    • puppet_classes::nut
      • ::nut
    • puppet_defined_types::nut::cgi::ups
      • ::nut::cgi::ups

Examples

Declaring the class
include ::nut::cgi
Managing the virtual host configuration elsewhere
class { '::nut::cgi':
  manage_vhost => false,
}

Parameters

The following parameters are available in the nut::cgi class.

apache_resources

Data type: Hash

Hash of Apache resources to create that configures the virtual host serving the CGI scripts.

Default value: $::nut::params::apache_resources

conf_dir

Data type: Stdlib::Absolutepath

Top-level configuration directory, usually /var/www/conf/nut or /etc/ups.

Default value: $::nut::params::cgi_conf_dir

group

Data type: String

The unprivileged group used to drop root privileges.

Default value: $::nut::params::group

http_server

Data type: Enum['apache', 'httpd']

Which HTTP server to configure a virtual host for.

Default value: $::nut::params::http_server

manage_vhost

Data type: Boolean

Whether to create a virtual host for the CGI scripts or not.

Default value: $::nut::params::manage_vhost

package_name

Data type: String

The name of the package.

Default value: $::nut::params::cgi_package_name

user

Data type: String

The unprivileged user used to drop root privileges.

Default value: $::nut::params::user

nut::cgi::config

The nut::cgi::config class.

nut::cgi::install

The nut::cgi::install class.

nut::client

Installs the Network UPS Tools (NUT) client.

  • See also
    • puppet_defined_types::nut::client::ups
      • ::nut::client::ups
    • puppet_defined_types::nut::client::upssched
      • ::nut::client::upssched

Examples

Declaring the class
include ::nut::client
Using upssched for notifications
class { '::nut::client':
  use_upssched => true,
}

Parameters

The following parameters are available in the nut::client class.

certident

Data type: Optional[Tuple[String, String]]

Tuple of certificate name and NSS database password.

Default value: undef

certpath

Data type: Optional[Stdlib::Absolutepath]

Path to NSS certificate database.

Default value: undef

certverify

Data type: Optional[Boolean]

Verify any TLS connections.

Default value: undef

cmdscript

Data type: Optional[Stdlib::Absolutepath]

The script invoked by upssched when a timer expires.

Default value: undef

conf_dir

Data type: Stdlib::Absolutepath

Top-level configuration directory, usually /etc/nut or /etc/ups.

Default value: $::nut::params::conf_dir

deadtime

Data type: Optional[Integer[0]]

How long a UPS can go without reporting anything before being declared dead.

Default value: undef

finaldelay

Data type: Optional[Integer[0]]

How long to wait after warning users before shutting the host down.

Default value: undef

forcessl

Data type: Optional[Boolean]

Always use TLS connections.

Default value: undef

group

Data type: String

The unprivileged group used to drop root privileges.

Default value: $::nut::params::group

hostsync

Data type: Optional[Integer[0]]

Wait this long for slave hosts to disconnect in a shutdown situation.

Default value: undef

minsupplies

Data type: Integer[1]

The number of power supplies receiving power for the host to remain powered on.

Default value: 1

nocommwarntime

Data type: Optional[Integer[0]]

How oftern to warn when no configured UPS is reachable.

Default value: undef

notifycmd

Data type: Optional[Stdlib::Absolutepath]

The command to invoke for UPS events.

Default value: $use_upssched

notifyflag

Data type: Optional[Hash[Nut::Event, Tuple[Boolean, 3, 3]]]

Hash of UPS event to tuple of three booleans representing using Syslog, wall(1) and $notifycmd for notifications.

Default value: undef

notifymsg

Data type: Optional[Hash[Nut::Event, String]]

Hash of UPS event to string for overriding the message for that event.

Default value: undef

package_name

Data type: String

The name of the package.

Default value: $::nut::params::client_package_name

pollfreq

Data type: Optional[Integer[0]]

How often to poll a UPS.

Default value: undef

pollfreqalert

Data type: Optional[Integer[0]]

How often to poll a UPS running on battery.

Default value: undef

rbwarntime

Data type: Optional[Integer[0]]

How often to warn a UPS needs a replacement battery.

Default value: undef

service_name

Data type: String

The name of the service.

Default value: $::nut::params::client_service_name

shutdowncmd

Data type: String

The command used to power the host off.

Default value: $::nut::params::shutdown_command

state_dir

Data type: Stdlib::Absolutepath

Top-level state directory, usually /var/run/nut or /var/db/nut.

Default value: $::nut::params::state_dir

use_upssched

Data type: Boolean

Whether to use upssched for notifications or not.

Default value: false

user

Data type: String

The unprivileged user used to drop root privileges.

Default value: $::nut::params::user

nut::client::config

The nut::client::config class.

nut::common

The nut::common class.

Parameters

The following parameters are available in the nut::common class.

conf_dir

Data type: Stdlib::Absolutepath

group

Data type: String

minsupplies

Data type: Integer[1]

package_name

Data type: String

service_name

Data type: String

shutdowncmd

Data type: String

state_dir

Data type: Stdlib::Absolutepath

use_upssched

Data type: Boolean

user

Data type: String

certident

Data type: Optional[Tuple[String, String]]

Default value: undef

certpath

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

certverify

Data type: Optional[Boolean]

Default value: undef

cmdscript

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

deadtime

Data type: Optional[Integer[0]]

Default value: undef

finaldelay

Data type: Optional[Integer[0]]

Default value: undef

forcessl

Data type: Optional[Boolean]

Default value: undef

hostsync

Data type: Optional[Integer[0]]

Default value: undef

manage_package

Data type: Boolean

Default value: true

manage_service

Data type: Boolean

Default value: true

nocommwarntime

Data type: Optional[Integer[0]]

Default value: undef

notifycmd

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

notifyflag

Data type: Optional[Hash[Nut::Event, Tuple[Boolean, 3, 3]]]

Default value: undef

notifymsg

Data type: Optional[Hash[Nut::Event, String]]

Default value: undef

pollfreq

Data type: Optional[Integer[0]]

Default value: undef

pollfreqalert

Data type: Optional[Integer[0]]

Default value: undef

rbwarntime

Data type: Optional[Integer[0]]

Default value: undef

nut::common::config

The nut::common::config class.

nut::common::install

The nut::common::install class.

nut::common::service

The nut::common::service class.

nut::config

The nut::config class.

nut::install

The nut::install class.

nut::params

The nut::params class.

nut::service

The nut::service class.

Defined types

nut::cgi::ups

Add a UPS to visualise with the CGI scripts.

  • See also
    • puppet_classes::nut::cgi
      • ::nut::cgi

Examples

Visualise a UPS
include ::nut::cgi
::nut::cgi::ups { 'sua1000i@remotehost':
  description => 'A remote UPS',
}

Parameters

The following parameters are available in the nut::cgi::ups defined type.

description

Data type: String

Description of the UPS.

ups

Data type: Nut::Device

The UPS to visualise.

Default value: $title

nut::client::ups

Add a local or remote UPS to monitor.

  • See also
    • puppet_classes::nut::client
      • ::nut::client
    • puppet_defined_types::nut::client::upssched
      • ::nut::client::upssched

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

The following parameters are available in the nut::client::ups defined type.

user

Data type: String

Username to use to connect to upsd.

password

Data type: String

Password to use to connect to upsd.

certhost

Data type: Optional[Tuple[String, Boolean, Boolean]]

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.

Default value: undef

powervalue

Data type: Integer[0]

How many power supplies does this UPS feed.

Default value: 1

type

Data type: Enum['master', 'slave']

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

Default value: $title

ups

Data type: Nut::Device

The UPS to monitor.

Default value: $title

nut::client::upssched

Define actions for upssched.

  • See also
    • puppet_classes::nut::client
      • ::nut::client
    • puppet_defined_types::nut::client::ups
      • ::nut::client::ups

Examples

Configure an action when local UPS has disconnected
class { '::nut::client':
  use_upssched => true,
}
::nut::client::upssched { 'local ups has disconnected':
  args       => [
    'upsgone',
    10,
  ],
  command    => 'start-timer',
  notifytype => 'commbad',
  ups        => 'test@localhost',
}

Parameters

The following parameters are available in the nut::client::upssched defined type.

args

Data type: Array[Variant[String, Integer], 1]

Additional arguments to pass to the command.

command

Data type: Enum['start-timer', 'cancel-timer', 'execute']

The command to run.

notifytype

Data type: Nut::Event

The event notification to apply the action to.

ups

Data type: Variant[Nut::Device, Enum['*']]

The UPS to apply the action to, or "*" to apply to all.

nut::ups

Adds and configures a UPS.

  • See also
    • puppet_classes::nut
      • ::nut
    • puppet_defined_types::nut::user
      • ::nut::user

Examples

Adding a USB-connected Smart-UPS 1000i
include ::nut
::nut::ups { 'sua1000i':
  driver => 'usbhid-ups',
  port   => 'auto',
}

Parameters

The following parameters are available in the nut::ups defined type.

driver

Data type: String

The driver to use for this UPS.

port

Data type: Variant[Integer[0, 65535], String]

The port or device name where the UPS is attached.

extra

Data type: Hash[String, Any]

Any additional driver-specific options can be passed here.

Default value: {}

ups

Data type: String

The name of the UPS.

Default value: $title

nut::user

Configure a user for UPS access.

  • See also
    • puppet_classes::nut
      • ::nut
    • puppet_defined_types::nut::ups
      • ::nut::ups

Examples

Declaring a user
include ::nut
::nut::user { 'test':
  password => 'password',
}
Declaring a upsmon user
include ::nut
::nut::user { 'monmaster':
  password => 'secret',
  upsmon   => 'master',
}

Parameters

The following parameters are available in the nut::user defined type.

password

Data type: String

The password for the user.

actions

Data type: Optional[Array[String, 1]]

List of actions to permit the user to do.

Default value: undef

instcmds

Data type: Optional[Array[String, 1]]

List of instant commands the user can initiate.

Default value: undef

upsmon

Data type: Optional[Enum['master', 'slave']]

Set the user to be used by upsmon.

Default value: undef

user

Data type: String

The name of the user.

Default value: $title

Data types

Nut::Device

The Nut::Device data type.

Alias of Pattern[/\A[^@]+@[^:]+(:\d+)?\Z/]

Nut::Event

The Nut::Event data type.

Alias of Enum['online', 'onbatt', 'lowbatt', 'fsd', 'commok', 'commbad', 'shutdown', 'replbatt', 'nocomm']

Nut::Listen

The Nut::Listen data type.

Alias of Struct[{'address' => Stdlib::IP::Address::NoSubnet, Optional['port'] => Integer[0, 65535]}]