Icinga(icinga_host: spicerack.remote.RemoteHosts, *, config_file: str = '/etc/icinga/icinga.cfg')¶
Class to interact with the Icinga server.
Initialize the instance.
icinga_host (spicerack.remote.RemoteHosts) -- the RemoteHosts instance for the Icinga server.
Getter for the command_file property.
downtime_hosts(hosts: Union[Sequence[str], ClusterShell.NodeSet.NodeSet], reason: spicerack.administrative.Reason, *, duration: datetime.timedelta = datetime.timedelta(0, 14400)) → None¶
Downtime hosts on the Icinga server for the given time with a message.
host_command(command: str, hosts: Union[Sequence[str], ClusterShell.NodeSet.NodeSet], *args) → None¶
Execute a host-specific Icinga command on the Icinga server for a set of hosts.
hosts_downtimed(hosts: Sequence[Union[str, ClusterShell.NodeSet.NodeSet]], reason: spicerack.administrative.Reason, *, duration: datetime.timedelta = datetime.timedelta(0, 14400), remove_on_error: bool = False) → Iterator[None]¶
Context manager to perform actions while the hosts are downtimed on Icinga.
hosts (list, cumin.NodeSet) -- an iterable with the list of hostnames to downtime.
reason (spicerack.administrative.Reason) -- the reason to set for the downtime on the Icinga server.
duration (datetime.timedelta, optional) -- the length of the downtime period.
remove_on_error -- should the downtime be removed even if an exception was raised.
None -- it just yields control to the caller once Icinga has been downtimed and deletes the downtime once getting back the control.