icinga

Icinga module.

class spicerack.icinga.Icinga(icinga_host, *, config_file='/etc/icinga/icinga.cfg')[source]

Bases: object

Class to interact with the Icinga server.

__init__(icinga_host, *, config_file='/etc/icinga/icinga.cfg')[source]

Initialize the instance.

Parameters:icinga_host (spicerack.remote.RemoteHosts) -- the RemoteHosts instance for the Icinga server.
_get_command_string(*args)[source]

Get the Icinga command to execute given the current arguments.

Parameters:*args -- positional arguments to use to compose the Icinga command string.
Returns:the command line to execute on the Icinga host.
Return type:str
command_file

Getter for the command_file property.

Returns:the path of the Icinga command file.
Return type:str
Raises:spicerack.icinga.IcingaError -- if unable to get the command file path.
downtime_hosts(hosts, reason, *, duration=datetime.timedelta(0, 14400))[source]

Downtime hosts on the Icinga server for the given time with a message.

Parameters:
host_command(command, hosts, *args)[source]

Execute a host-specific Icinga command on the Icinga server for a set of hosts.

Parameters:
  • command (str) -- the Icinga command to execute.
  • hosts (list, cumin.NodeSet) -- an iterable with the list of hostnames to iterate the command for.
  • *args -- optional positional arguments to pass to the command.
remove_downtime(hosts)[source]

Remove a downtime from a set of hosts.

Parameters:hosts (list, cumin.NodeSet) -- an iterable with the list of hostnames to iterate the command for.
exception spicerack.icinga.IcingaError[source]

Bases: spicerack.exceptions.SpicerackError

Custom exception class for errors of this module.