alignak package

Subpackages

Submodules

alignak.acknowledge module

This module provides Acknowledge class that implements acknowledgment for notification. Basically used for parsing.

class alignak.acknowledge.Acknowledge(params=None, parsing=False)[source]

Bases: alignak.alignakobject.AlignakObject

Allows you to acknowledge the current problem for the specified service. By acknowledging the current problem, future notifications (for the same service state) are disabled.

If the acknowledge is “sticky”, the acknowledgement will remain until the service returns to an OK state. Otherwise the acknowledgement will automatically be removed when the service state changes.

If the acknowledge is “notify”, a notification will be sent out to contacts indicating that the current service problem has been acknowledged and when the acknowledge is cleared.

get_expire_brok(host_name, service_name='')[source]

Get an expire acknowledge brok

Returns:brok with wanted data
Return type:alignak.brok.Brok
get_raise_brok(host_name, service_name='')[source]

Get a start acknowledge brok

Parameters:
  • host_name
  • service_name
Returns:

brok with wanted data

Return type:

alignak.brok.Brok

my_type = 'acknowledge'
properties = {'author': <Property <class 'alignak.property.StringProp'>, default: u'Alignak' />, 'comment': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'comment_id': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'end_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'notify': <Property <class 'alignak.property.BoolProp'>, default: False />, 'sticky': <Property <class 'alignak.property.BoolProp'>, default: True />}
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Acknowledge
Return type:dict

alignak.action module

This module provides a system-independent Action class. Action class is used for handling check and notification execution (handle output, execute process, kill process..)

class alignak.action.Action(params=None, parsing=False)[source]

Bases: alignak.action.ActionBase

Action class for *NIX systems

properties = {'_in_timeout': <Property <class 'alignak.property.BoolProp'>, default: False />, '_is_orphan': <Property <class 'alignak.property.BoolProp'>, default: False />, 'check_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'command': <Property <class 'alignak.property.StringProp'>, default: '' />, 'creation_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'env': <Property <class 'alignak.property.DictProp'>, default: {} />, 'execution_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'exit_status': <Property <class 'alignak.property.IntegerProp'>, default: 3 />, 'internal': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_a': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'last_poll': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'long_output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'module_type': <Property <class 'alignak.property.StringProp'>, default: u'fork' />, 'my_scheduler': <Property <class 'alignak.property.StringProp'>, default: u'unassigned' />, 'my_worker': <Property <class 'alignak.property.StringProp'>, default: u'none' />, 'output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'perf_data': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'reactionner_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'ref_type': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 's_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'status': <Property <class 'alignak.property.StringProp'>, default: u'scheduled' />, 't_to_go': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'timeout': <Property <class 'alignak.property.IntegerProp'>, default: 10 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'u_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'wait_time': <Property <class 'alignak.property.FloatProp'>, default: 0.001 />}

alignak.alignakobject module

This module contains only a common class for all object created in Alignak: AlignakObject.

class alignak.alignakobject.AlignakObject(params=None, parsing=True)[source]

Bases: object

This class provides a generic way to instantiate alignak objects. Attributes are serialized dynamically, whether we un-serialize them create them at run / parsing time

fill_default()[source]

Define the object properties with a default value when the property is not yet defined

Returns:None
macros = {}
properties = {}
serialize()[source]

This function serializes into a simple dictionary object.

It is used when transferring data to other daemons over the network (http)

Here is the generic function that simply export attributes declared in the properties dictionary of the object.

Note that a SetProp property will be serialized as a list.

Returns:Dictionary containing key and value from properties
Return type:dict
alignak.alignakobject.get_a_new_object_id()[source]

Get a new Alignak object identifier. Uses the uuid version 1 generator

Rtype uuid:bytes
Returns:uuid

alignak.autoslots module

The AutoSlots Class is a MetaClass: it manages how other classes are created (Classes, not instances of theses classes). Here its role is to create the __slots__ list of the class with all properties of Class.properties and Class.running_properties so we do not have to add manually all properties to the __slots__ list when we add a new entry

class alignak.autoslots.AutoSlots[source]

Bases: type

AutoSlots inherit from type, it’s compulsory for metaclass statement

alignak.basemodule module

This python module contains the class BaseModule that alignak modules will subclass

class alignak.basemodule.BaseModule(mod_conf)[source]

Bases: object

This is the base class for the Alignak modules. Modules can be used by the different Alignak daemons for different tasks. Example of task that an Alignak module can do: - load additional configuration objects. - recurrently save hosts/services status/perfdata information in different format. - …

alias

Module name may be stored in an alias property Stay compatible with older modules interface

clear_queues(manager)[source]

Release the resources associated to the queues of this instance

Parameters:manager (None | object) – Manager() object
Returns:None
create_queues(manager=None)[source]

Create the shared queues that will be used by alignak daemon process and this module process. But clear queues if they were already set before recreating new one.

Note: If manager is None, then we are running the unit tests for the modules and we must create some queues for the external modules without a SyncManager

Parameters:manager (None | object) – Manager() object
Returns:None
do_loop_turn()[source]

For external modules only: implement in this method the body of you main loop

Returns:None
do_stop()[source]

Called just before the module will exit Put in this method all you need to cleanly release all open resources used by your module

Returns:None
get_name()[source]

Wrapper to access name attribute

Returns:module name
Return type:str
init()[source]

Handle this module “post” init ; just before it’ll be started.

This function initializes the module instance. If False is returned, the modules manager will periodically retry an to initialize the module. If an exception is raised, the module will be definitely considered as dead :/

This function must be present and return True for Alignak to consider the module as loaded and fully functional.

Returns:True / False according to initialization succeeded or not
Return type:bool
kill()[source]

Sometime terminate() is not enough, we must “help” external modules to die…

Returns:None
main()[source]

Main function of BaseModule

Returns:None
manage_brok(brok)[source]

Request the module to manage the given brok. There are a lot of different possible broks to manage. The list is defined in the Brok class.

An internal module may redefine this function or, easier, define only the function for the brok it is interested with. Hence a module interested in the service_check_result broks will only need to define a function named as manage_service_check_result_brok

Parameters:brok
Returns:
Return type:
manage_signal(sig, frame)[source]

Generic function to handle signals

Only called when the module process received SIGINT or SIGKILL.

Set interrupted attribute to True, self.process to None and returns

Parameters:
  • sig – signal sent
  • frame – frame before catching signal
Returns:

None

set_exit_handler(sigs=None)

Set the signal handler to manage_signal (defined in this class)

Only set handlers for: - signal.SIGTERM, signal.SIGINT - signal.SIGUSR1, signal.SIGUSR2 - signal.SIGHUP

Returns:None
set_loaded_into(daemon_name)[source]

Setter for loaded_into attribute Used to know what daemon has loaded this module

Parameters:daemon_name (str) – value to set
Returns:None
set_proctitle(name)[source]

Wrapper for setproctitle method

Parameters:name (str) – module alias
Returns:None
set_signal_handler(sigs=None)[source]

Set the signal handler to manage_signal (defined in this class)

Only set handlers for: - signal.SIGTERM, signal.SIGINT - signal.SIGUSR1, signal.SIGUSR2 - signal.SIGHUP

Returns:None
start(http_daemon=None)[source]

Actually restart the process if the module is external Try first to stop the process and create a new Process instance with target start_module. Finally start process.

Parameters:http_daemon (None | object) – Not used here but can be used in other modules
Returns:None
start_module()[source]

Wrapper for _main function. Catch and raise any exception occurring in the main function

Returns:None
stop_process()[source]

Request the module process to stop and release it

Returns:None
want_brok(b)[source]

Generic function to check if the module need a specific brok In this case it is always True

Parameters:b (alignak.brok.Brok) – brok to check
Returns:True if the module wants the brok, False otherwise
Return type:bool
work()

module “main” method. Only used by external modules.

Returns:None

alignak.borg module

Borg module provides Borg class. Used only for MacroSolver

class alignak.borg.Borg[source]

Bases: object

Borg class define a simple __shared_state class attribute. __dict__ points to this value when calling __init__

This is used to make a Singleton-like pattern with a python object that inherits from the Borg.

The Singleton design pattern (DP) has a catchy name, but the wrong focus – on identity rather than on state. The Borg design pattern has all instances share state instead, and Python makes it, literally, a snap.

alignak.brok module

Brok module provide Brok class which is basically event for Alignak. Brok are filled depending on their type (check_result, initial_state …)

class alignak.brok.Brok(params, parsing=True)[source]

Bases: object

A Brok is a piece of information exported by Alignak to the Broker. Broker can do whatever he wants with it.

A specific type of Brok exists when the type is monitoring_log. This Brok contains a monitoring event (alert, notification, …) information

Broks types: - log - monitoring_log

  • notification_raise
  • acknowledge_raise
  • downtime_raise
  • acknowledge_expire
  • downtime_expire
  • initial_host_status, initial_service_status, initial_contact_status
  • initial_broks_done
  • update_host_status, update_service_status, initial_contact_status
  • host_check_result, service_check_result
  • host_next_schedule, service_next_scheduler
  • host_snapshot, service_snapshot
  • unknown_host_check_result, unknown_service_check_result
  • program_status, initial program status
  • update_program_status, program status updated (raised on each scheduler loop)
  • clean_all_my_instance_id
  • new_conf
get_event()[source]

This function returns an Event from a Brok

If the type is monitoring_log then the Brok contains a monitoring event (alert, notification, …) information. This function will return a tuple with the creation time, the level and message information

Returns:tuple with date, level and message
Return type:tuple
my_type = 'brok'
prepare()[source]

Un-serialize data from data attribute and add instance_id key if necessary

Returns:None
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Brok
Return type:dict

alignak.check module

This module provides Check class which is a simple abstraction for monitoring checks

class alignak.check.Check(params=None, parsing=False)[source]

Bases: alignak.action.Action

Check class implements monitoring concepts of checks :(status, state, output) Check instance are used to store monitoring plugins data (exit status, output) and used by schedule to raise alert, reschedule check etc.

get_return_from(check)[source]

Update check data from action (notification for instance)

Parameters:check (alignak.action.Action) – action to get data from
Returns:None
is_dependent()[source]

Getter for dependency_check attribute

Returns:True if this check was created for a dependent one, False otherwise
Return type:bool
my_type = 'check'
properties = {'_in_timeout': <Property <class 'alignak.property.BoolProp'>, default: False />, '_is_orphan': <Property <class 'alignak.property.BoolProp'>, default: False />, 'check_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'command': <Property <class 'alignak.property.StringProp'>, default: '' />, 'creation_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'depend_on': <Property <class 'alignak.property.ListProp'>, default: [] />, 'depend_on_me': <Property <class 'alignak.property.ListProp'>, default: [] />, 'dependency_check': <Property <class 'alignak.property.BoolProp'>, default: False />, 'env': <Property <class 'alignak.property.DictProp'>, default: {} />, 'execution_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'exit_status': <Property <class 'alignak.property.IntegerProp'>, default: 3 />, 'freshness_expiry_check': <Property <class 'alignak.property.BoolProp'>, default: False />, 'internal': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_a': <Property <class 'alignak.property.StringProp'>, default: u'check' />, 'last_poll': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'long_output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'module_type': <Property <class 'alignak.property.StringProp'>, default: u'fork' />, 'my_scheduler': <Property <class 'alignak.property.StringProp'>, default: u'unassigned' />, 'my_worker': <Property <class 'alignak.property.StringProp'>, default: u'none' />, 'output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'passive_check': <Property <class 'alignak.property.BoolProp'>, default: False />, 'perf_data': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'poller_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'reactionner_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'ref_type': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 's_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'state': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'status': <Property <class 'alignak.property.StringProp'>, default: u'scheduled' />, 't_to_go': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'timeout': <Property <class 'alignak.property.IntegerProp'>, default: 10 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'u_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'wait_time': <Property <class 'alignak.property.FloatProp'>, default: 0.001 />}
serialize()[source]

This function serializes into a simple dict object.

The only usage is to send to poller, and it does not need to have the depend_on and depend_on_me properties.

Returns:json representation of a Check
Return type:dict
set_type_active()[source]

Set this check as an active one (indeed, not passive)

Returns:None
set_type_passive()[source]

Set this check as a passive one

Returns:None

alignak.commandcall module

This modules provide CommandCall class which is a abstraction for dealing with command line (resolve macro, parse commands etc)

class alignak.commandcall.CommandCall(params, parsing=False)[source]

Bases: alignak.alignakobject.AlignakObject

This class is use when a service, contact or host define a command with args.

args
call
command
enable_environment_macros
get_command_and_args()[source]

We want to get the command and the args with ! splitting. but don’t forget to protect against the ! to avoid splitting on them

Remember: A Nagios-like command is command_name!arg1!arg2!…

Returns:None
get_name()[source]

Getter for call attribute

Returns:call attribute
Return type:str
is_valid()[source]

Getter for valid attribute

Returns:True if object is valid, False otherwise
Return type:bool
module_type
my_type = 'CommandCall'
poller_tag
properties = {'args': <Property <class 'alignak.property.ListProp'>, default: [] />, 'call': <Property <class 'alignak.property.StringProp'>, default: <object object> />, 'command': <Property <class 'alignak.property.StringProp'>, default: <object object> />, 'enable_environment_macros': <Property <class 'alignak.property.BoolProp'>, default: False />, 'late_relink_done': <Property <class 'alignak.property.BoolProp'>, default: False />, 'module_type': <Property <class 'alignak.property.StringProp'>, default: u'fork' />, 'poller_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'reactionner_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'timeout': <Property <class 'alignak.property.IntegerProp'>, default: -1 />, 'valid': <Property <class 'alignak.property.BoolProp'>, default: False />}
reactionner_tag
serialize()[source]

This function serializes into a simple dictionary object.

It is used when transferring data to other daemons over the network (http)

Here is the generic function that simply export attributes declared in the properties dictionary of the object.

Note that a SetProp property will be serialized as a list.

Returns:Dictionary containing key and value from properties
Return type:dict
timeout
valid

alignak.comment module

This module provide Comment class, used to attach comments to hosts / services

class alignak.comment.Comment(params, parsing=False)[source]

Bases: alignak.alignakobject.AlignakObject

Comment class implements comments for monitoring purpose. It contains data like author, type etc..

get_comment_brok(host_name, service_name='')[source]

Get a comment brok

Parameters:
  • host_name
  • service_name
Returns:

brok with wanted data

Return type:

alignak.brok.Brok

my_type = 'comment'
properties = {'author': <Property <class 'alignak.property.StringProp'>, default: u'Alignak' />, 'comment': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'comment_type': <Property <class 'alignak.property.IntegerProp'>, default: <object object> />, 'entry_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'entry_type': <Property <class 'alignak.property.IntegerProp'>, default: <object object> />, 'expires': <Property <class 'alignak.property.BoolProp'>, default: False />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'ref_type': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'source': <Property <class 'alignak.property.IntegerProp'>, default: 0 />}

alignak.complexexpression module

This module provides ComplexExpressionNode and ComplexExpressionFactory used for parsing expression (business rules)

class alignak.complexexpression.ComplexExpressionFactory(ctx='hostgroups', grps=None, all_elements=None)[source]

Bases: object

ComplexExpressionFactory provides complex expression parsing functions

eval_cor_pattern(pattern)[source]

Parse and build recursively a tree of ComplexExpressionNode from pattern

Parameters:pattern (str) – pattern to parse
Returns:root node of parsed tree
Type:alignak.complexexpression.ComplexExpressionNode
find_object(pattern)[source]

Get a list of host corresponding to the pattern regarding the context

Parameters:pattern (str) – pattern to find
Returns:Host list matching pattern (hostgroup name, template, all)
Return type:list[alignak.objects.host.Host]
class alignak.complexexpression.ComplexExpressionNode[source]

Bases: object

ComplexExpressionNode is a node class for complex_expression(s)

is_valid()[source]

Check if all leaves are correct (no error)

Returns:True if correct, else False
Return type:bool

TODO: Fix this function and use it. DependencyNode should be ComplexExpressionNode Should return true on a leaf

resolve_elements()[source]

Get element of this node recursively Compute rules with OR or AND rule then NOT rules.

Returns:set of element
Return type:set

alignak.contactdowntime module

This module provides ContactDowntime class which implement downtime for contact

class alignak.contactdowntime.ContactDowntime(params, parsing=False)[source]

Bases: alignak.alignakobject.AlignakObject

ContactDowntime class allows a contact to be in downtime. During this time the contact won’t get notifications

cancel(contacts)[source]

Wrapper to call raise_cancel_downtime_log_entry for ref (host/service) set can_be_deleted to True set is_in_effect to False

Returns:None
check_activation(contacts)[source]

Enter or exit downtime if necessary

Returns:None
enter(contacts)[source]

Wrapper to call raise_enter_downtime_log_entry for ref (host/service)

Returns:None
exit(contacts)[source]

Wrapper to call raise_exit_downtime_log_entry for ref (host/service) set can_be_deleted to True

Returns:None
in_scheduled_downtime()[source]

Getter for is_in_effect attribute

Returns:True if downtime is active, False otherwise
Return type:bool
properties = {'author': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'can_be_deleted': <Property <class 'alignak.property.BoolProp'>, default: False />, 'comment': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'end_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'is_in_effect': <Property <class 'alignak.property.BoolProp'>, default: False />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'start_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />}

alignak.daemon module

This module provides abstraction for creating daemon in Alignak

class alignak.daemon.Daemon(name, **kwargs)[source]

Bases: object

Class providing daemon level call for Alignak

add(elt)[source]
Abstract method for adding brok, external commands, messages, …
It is overridden in subclasses (Satellite) of Daemon
Parameters:elt – element to add
Returns:None
change_to_user_group()[source]

Change to configured user/group for the running program. If user/group are not valid, we exit with code 1 If change failed we exit with code 2

Returns:None
change_to_workdir()[source]

Change working directory to working attribute

Returns:None
check_and_del_zombie_modules()[source]

Check alive instance and try to restart the dead ones

Returns:None
check_dir(dirname)[source]

Check and create directory

Parameters:dirname – file name

:type dirname; str

Returns:None
check_for_system_time_change()[source]

Check if our system time change. If so, change our

Returns:0 if the difference < 900, difference else
Return type:int
check_parallel_run()[source]

Check (in pid file) if there isn’t already a daemon running. If yes and do_replace: kill it. Keep in self.fpid the File object to the pid file. Will be used by writepid.

Returns:None
static check_shm()[source]

Check /dev/shm right permissions

Returns:None
close_fds(skip_close_fds)[source]

Close all the process file descriptors. Skip the descriptors present in the skip_close_fds list

Parameters:skip_close_fds (list) – list of file descriptor to preserve from closing
Returns:None
compensate_system_time_change(difference)[source]

Default action for system time change. Actually a log is done

Parameters:difference (int) – in seconds
Returns:None
daemon_connection_init(s_link, set_wait_new_conf=False)[source]

Initialize a connection with the daemon for the provided satellite link

Initialize the connection (HTTP client) to the daemon and get its running identifier. Returns True if it succeeds else if any error occur or the daemon is inactive it returns False.

Assume the daemon should be reachable because we are initializing the connection… as such, force set the link reachable property

If set_wait_new_conf is set, the daemon is requested to wait a new configuration if
we get a running identifier. This is used by the arbiter when a new configuration must be dispatched

NB: if the daemon is configured as passive, or if it is a daemon link that is inactive then it returns False without trying a connection.

Parameters:
  • s_link (SatelliteLink) – link of the daemon to connect to
  • set_wait_new_conf (bool) – if the daemon must got the wait new configuration state
Returns:

True if the connection is established, else False

daemonize()[source]

Go in “daemon” mode: close unused fds, redirect stdout/err, chdir, umask, fork-setsid-fork-writepid Do the double fork to properly go daemon

This is ‘almost’ as recommended by PEP3143 but it would be better to rewrite this daemonization thanks to the python-daemon library!

Returns:None
do_before_loop()[source]

Called before the main daemon loop.

Returns:None
do_daemon_init_and_start(set_proc_title=True)[source]

Main daemon function. Clean, allocates, initializes and starts all necessary resources to go in daemon mode.

The set_proc_title parameter is mainly useful for the Alignak unit tests. This to avoid changing the test process name!

Parameters:set_proc_title (bool) – if set (default), the process title is changed to the daemon name
Returns:False if the HTTP daemon can not be initialized, else True
do_load_modules(modules)[source]

Wrapper for calling load_and_init method of modules_manager attribute

Parameters:modules – list of modules that should be loaded by the daemon
Returns:None
do_loop_turn()[source]

Abstract method for daemon loop turn. It must be overridden by all classes inheriting from Daemon

Returns:None
do_main_loop()[source]

Main loop for an Alignak daemon

Returns:None
do_stop()[source]
Execute the stop of this daemon:
  • request the daemon to stop
  • request the http thread to stop, else force stop the thread
  • Close the http socket
  • Shutdown the manager
  • Stop and join all started “modules”
Returns:None
dump_environment()[source]

Try to dump memory

Not currently implemented feature

Returns:None
exit_ok(message, exit_code=None)[source]

Log a message and exit

Parameters:
  • exit_code (int) – if not None, exit with the provided value as exit code
  • message (str) – message for the exit reason
Returns:

None

exit_on_error(message, exit_code=1)[source]

Log generic message when getting an error and exit

Parameters:
  • exit_code (int) – if not None, exit with the provided value as exit code
  • message (str) – message for the exit reason
Returns:

None

exit_on_exception(raised_exception, message='', exit_code=99)[source]

Log generic message when getting an unrecoverable error

Parameters:
  • raised_exception (Exception) – raised Exception
  • message (str) – message for the exit reason
  • exit_code (int) – exit with the provided value as exit code
Returns:

None

get_daemon_stats(details=False)[source]

Get state of modules and create a scheme for stats data of daemon This may be overridden in subclasses (and it is…)

Returns:A dict with the following structure
::
{
‘modules’: {
‘internal’: {‘name’: “MYMODULE1”, ‘state’: ‘ok’}, ‘external’: {‘name’: “MYMODULE2”, ‘state’: ‘stopped’},

}, And some extra information, see the source code below…

}

These information are completed with the data provided by the get_id function which provides the daemon identification

Return type:dict
get_header(configuration=False)[source]

Get the log file header

If configuration is True, this returns the daemon configuration

Returns:A string list containing project name, daemon name, version, licence etc.
Return type:list
get_id(details=False)[source]

Get daemon identification information

Returns:A dict with the following structure
::
{
“alignak”: selfAlignak instance name “type”: daemon type “name”: daemon name “version”: Alignak version

}

Return type:dict

Return the s_type satellite list (eg. schedulers)

If s_type is None, returns a dictionary of all satellites, else returns the dictionary of the s_type satellites

The returned dict is indexed with the satellites uuid.

Parameters:s_type (str) – satellite type
Returns:dictionary of satellites
Return type:dict
get_objects_from_from_queues()[source]

Get objects from “from” queues and add them.

Returns:True if we got something in the queue, False otherwise.
Return type:bool
get_retention_data()[source]

Basic function to get retention data, Maybe be overridden by subclasses to implement real get

TODO: only the scheduler is retention capable. To be removed!

Returns:A list of Alignak object (scheduling items)
Return type:list
hook_point(hook_name, handle=None)[source]

Used to call module function that may define a hook function for hook_name

Available hook points: - tick, called on each daemon loop turn - save_retention; called by the scheduler when live state

saving is to be done
  • load_retention; called by the scheduler when live state
    restoring is necessary (on restart)
  • get_new_actions; called by the scheduler before adding the actions to be executed
  • early_configuration; called by the arbiter when it begins parsing the configuration
  • read_configuration; called by the arbiter when it read the configuration
  • late_configuration; called by the arbiter when it finishes parsing the configuration

As a default, the handle parameter provided to the hooked function is the caller Daemon object. The scheduler will provide its own instance when it call this function.

Parameters:
  • hook_name (str) – function name we may hook in module
  • handle – parameter to provide to the hook function
Type:

handle: alignak.Satellite

Returns:

None

http_daemon_thread()[source]

Main function of the http daemon thread will loop forever unless we stop the root daemon

The main thing is to have a pool of X concurrent requests for the http_daemon, so “no_lock” calls can always be directly answer without having a “locked” version to finish. This is achieved thanks to the CherryPy thread pool.

This function is threaded to be detached from the main process as such it will not block the process main loop.. :return: None

load_modules_manager()[source]

Instantiate the daemon ModulesManager and load the SyncManager (multiprocessing)

Note that this function is used by the Alignak modules. No self-use…

Parameters:daemon_name – daemon name
Returns:None
make_a_pause(timeout=0.0001, check_time_change=True)[source]

Wait up to timeout and check for system time change.

This function checks if the system time changed since the last call. If so, the difference is returned to the caller. The duration of this call is removed from the timeout. If this duration is greater than the required timeout, no sleep is executed and the extra time is returned to the caller

If the required timeout was overlapped, then the first return value will be greater than the required timeout.

If the required timeout is null, then the timeout value is set as a very short time to keep a nice behavior to the system CPU ;)

Parameters:
  • timeout (float) – timeout to wait for activity
  • check_time_change (bool) – True (default) to check if the system time changed

:return:Returns a 2-tuple: * first value is the time spent for the time change check * second value is the time change difference :rtype: tuple

manage_signal(sig, frame)[source]

Manage signals caught by the daemon signal.SIGUSR1 : dump_environment signal.SIGUSR2 : dump_object (nothing) signal.SIGTERM, signal.SIGINT : terminate process

Parameters:
  • sig (str) – signal caught by daemon
  • frame – current stack frame
Returns:

None

pidfile

Return the pid file name - make it compatible with old implementation

Returns:pid_filename property
Return type:str
properties = {'active': <Property <class 'alignak.property.BoolProp'>, default: True />, 'address': <Property <class 'alignak.property.StringProp'>, default: u'127.0.0.1' />, 'alignak_monitor': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'alignak_monitor_password': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'alignak_monitor_period': <Property <class 'alignak.property.IntegerProp'>, default: 60 />, 'alignak_monitor_username': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'bindir': <Property <class 'alignak.property.PathProp'>, default: '' />, 'ca_cert': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'daemon': <Property <class 'alignak.property.StringProp'>, default: u'unknown' />, 'debug': <Property <class 'alignak.property.BoolProp'>, default: False />, 'do_replace': <Property <class 'alignak.property.BoolProp'>, default: False />, 'env_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'etcdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'favicon': <Property <class 'alignak.property.PathProp'>, default: '' />, 'graphite_enabled': <Property <class 'alignak.property.BoolProp'>, default: False />, 'group': <Property <class 'alignak.property.StringProp'>, default: 'docs' />, 'hard_ssl_name_check': <Property <class 'alignak.property.BoolProp'>, default: False />, 'host': <Property <class 'alignak.property.StringProp'>, default: u'127.0.0.1' />, 'host_name': <Property <class 'alignak.property.StringProp'>, default: u'localhost' />, 'idontcareaboutsecurity': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_daemon': <Property <class 'alignak.property.BoolProp'>, default: False />, 'log_cherrypy': <Property <class 'alignak.property.BoolProp'>, default: False />, 'log_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'log_level': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'log_loop': <Property <class 'alignak.property.BoolProp'>, default: False />, 'logdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'logger_configuration': <Property <class 'alignak.property.StringProp'>, default: u'./alignak-logger.json' />, 'max_queue_size': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'maximum_loop_duration': <Property <class 'alignak.property.FloatProp'>, default: 1.0 />, 'modules': <Property <class 'alignak.property.ListProp'>, default: [] />, 'name': <Property <class 'alignak.property.StringProp'>, default: <object object> />, 'pause_duration': <Property <class 'alignak.property.FloatProp'>, default: 0.5 />, 'pid_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'server_cert': <Property <class 'alignak.property.StringProp'>, default: u'etc/certs/server.cert' />, 'server_dh': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'server_key': <Property <class 'alignak.property.StringProp'>, default: u'etc/certs/server.key' />, 'spare': <Property <class 'alignak.property.BoolProp'>, default: False />, 'start_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'statsd_enabled': <Property <class 'alignak.property.BoolProp'>, default: False />, 'statsd_host': <Property <class 'alignak.property.StringProp'>, default: u'localhost' />, 'statsd_port': <Property <class 'alignak.property.IntegerProp'>, default: 8125 />, 'statsd_prefix': <Property <class 'alignak.property.StringProp'>, default: u'alignak' />, 'thread_pool_size': <Property <class 'alignak.property.IntegerProp'>, default: 32 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'unknown' />, 'use_ssl': <Property <class 'alignak.property.BoolProp'>, default: False />, 'user': <Property <class 'alignak.property.StringProp'>, default: 'docs' />, 'vardir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'verbose': <Property <class 'alignak.property.BoolProp'>, default: False />, 'workdir': <Property <class 'alignak.property.PathProp'>, default: '/' />}
request_stop(message='', exit_code=0)[source]

Remove pid and stop daemon

Returns:None
restore_retention_data(data)[source]

Basic function to save retention data, Maybe be overridden by subclasses to implement real save

TODO: only the scheduler is retention capable. To be removed!

Returns:None
scheme

Daemon interface scheme

Returns:http or https if the daemon uses SSL
Return type:str
set_exit_handler(sigs=None)

Set the signal handler to manage_signal (defined in this class)

Only set handlers for: - signal.SIGTERM, signal.SIGINT - signal.SIGUSR1, signal.SIGUSR2 - signal.SIGHUP

Returns:None
set_proctitle(daemon_name=None)[source]

Set the proctitle of the daemon

Parameters:daemon_name – daemon instance name (eg. arbiter-master). If not provided, only the

daemon type (eg. arbiter) will be used for the process title :type daemon_name: str :return: None

set_signal_handler(sigs=None)[source]

Set the signal handler to manage_signal (defined in this class)

Only set handlers for: - signal.SIGTERM, signal.SIGINT - signal.SIGUSR1, signal.SIGUSR2 - signal.SIGHUP

Returns:None
setup_alignak_logger()[source]

Setup alignak logger: - with the daemon log configuration properties - configure the global daemon handler (root logger) - log the daemon Alignak header

  • configure the global Alignak monitoring log

This function is called very early on daemon start. The daemon is not yet forked and may still run with a high privileged user account. This is why, the log file ownership may be set accordingly to the running user account.

Returns:None
setup_communication_daemon()[source]

Setup HTTP server daemon to listen for incoming HTTP requests from other Alignak daemons

Returns:True if initialization is ok, else False
setup_new_conf()[source]

Setup the new configuration received from Arbiter :return: None

Remove the daemon’s pid file

Returns:None
wait_for_initial_conf(timeout=1.0)[source]

Wait initial configuration from the arbiter. Basically sleep 1.0 and check if new_conf is here

Parameters:timeout (int) – timeout to wait
Returns:None
wait_for_new_conf(timeout=1.0)[source]

Wait for a new configuration from the arbiter. Basically the same as waiting for an initial configuration (wait_for_initial_conf)

Parameters:timeout (int) – timeout to wait
Returns:None
watch_for_new_conf(timeout=0)[source]

Check if a new configuration was sent to the daemon

This function is called on each daemon loop turn. Basically it is a sleep…

If a new configuration was posted, this function returns True

Parameters:timeout (float) – timeout to wait. Default is no wait time.
Returns:None
write_pid(pid)[source]

Write pid to the pid file

Parameters:pid (None | int) – pid of the process
Returns:None
exception alignak.daemon.EnvironmentFile(msg)[source]

Bases: exceptions.Exception

Exception raised when the Alignak environment file is missing or corrupted

alignak.daemon.get_all_groups()[source]

Wrapper for getgrall

Returns:all groups
Return type:list
alignak.daemon.get_cur_group()[source]

Wrapper for getgrgid

Returns:group name
Return type:str
alignak.daemon.get_cur_user()[source]

Wrapper for getpwuid

Returns:user name
Return type:str

alignak.daterange module

This module provide Daterange and Timerange classes used to create Timeperiod in Alignak

class alignak.daterange.AbstractDaterange(params=None, parsing=True)[source]

Bases: alignak.alignakobject.AlignakObject

AbstractDaterange class provides functions to deal with a range of dates It is subclassed for more granularity (weekday, month …)

get_min_from_t(timestamp)[source]

Get next time from t where a timerange is valid (withing range)

Parameters:timestamp – base time to look for the next one
Returns:time where a timerange is valid
Return type:int
get_min_sec_from_morning()[source]

Get the first second from midnight where a timerange is effective

Returns:smallest amount of second from midnight of all timerange
Return type:int
get_min_sec_out_from_morning()[source]

Get the first second (from midnight) where we are out of a timerange

Returns:smallest seconds from midnight of all timerange where it is not effective
Return type:int
classmethod get_month_by_id(month_id)[source]

Get month name from month id

Parameters:month_id (int) – month id
Returns:month name
Return type:str
>>> Daterange.get_month_by_id(7)
'july'
classmethod get_month_id(month)[source]

Get month id from month name

Parameters:month (str) – month name
Returns:month id
Return type:int
>>> Daterange.get_month_id("july")
7
get_next_future_timerange_invalid(timestamp)[source]

Get next invalid time for timeranges

Parameters:timestamp (int) – time to check
Returns:next time when a timerange is not valid
Return type:None | int
get_next_future_timerange_valid(timestamp)[source]

Get the next valid timerange (next timerange start in timeranges attribute)

Parameters:timestamp (int) – base time
Returns:next time when a timerange is valid
Return type:None | int
get_next_invalid_day(timestamp)[source]

Get next day where timerange is not active

Parameters:timestamp (int) – time we compute from
Returns:timestamp of the next invalid day (midnight) in LOCAL time.
Return type:int | None
get_next_invalid_time_from_t(timestamp)[source]

Get next invalid time for time range

Parameters:timestamp (int) – time we compute from
Returns:timestamp of the next invalid time (LOCAL TIME)
Return type:int
get_next_valid_day(timestamp)[source]

Get next valid day for timerange

Parameters:timestamp (int) – time we compute from
Returns:timestamp of the next valid day (midnight) in LOCAL time.
Return type:int | None
get_next_valid_time_from_t(timestamp)[source]

Get next valid time for time range

Parameters:timestamp (int) – time we compute from
Returns:timestamp of the next valid time (LOCAL TIME)
Return type:int | None
get_start_and_end_time(ref=None)[source]

Generic function to get start time and end time

Parameters:ref (int) – time in seconds
Returns:None
classmethod get_weekday_by_id(weekday_id)[source]

Get weekday name from weekday id

Parameters:weekday_id (int) – weekday id
Returns:weekday name
Return type:int
>>> Daterange.get_weekday_by_id(5)
'saturday'
classmethod get_weekday_id(weekday)[source]

Get weekday id from weekday name

Parameters:weekday (str) – weekday name
Returns:weekday id
Return type:int
>>> Daterange.get_weekday_id("monday")
0
is_correct()[source]

Check if each timerange of this datarange is correct

Returns:True if timerange are correct, False otherwise
Return type:bool
is_time_day_invalid(timestamp)[source]

Check if t is out of start time and end time of the DateRange

Parameters:timestamp (int) – time to check
Returns:False if t in range, True otherwise
Return type:bool
is_time_day_valid(timestamp)[source]

Check if it is within start time and end time of the DateRange

Parameters:timestamp (int) – time to check
Returns:True if t in range, False otherwise
Return type:bool
is_time_valid(timestamp)[source]

Check if time is valid for one of the timerange.

Parameters:timestamp (int) – time to check
Returns:True if one of the timerange is valid for t, False otherwise
Return type:bool
timeranges = []
class alignak.daterange.CalendarDaterange(params, parsing=True)[source]

Bases: alignak.daterange.Daterange

CalendarDaterange is for calendar entry (YYYY-MM-DD - YYYY-MM-DD)

get_start_and_end_time(ref=None)[source]

Specific function to get start time and end time for CalendarDaterange

Parameters:ref (int) – time in seconds
Returns:tuple with start and end time
Return type:tuple (int, int)
class alignak.daterange.Daterange(params, parsing=True)[source]

Bases: alignak.daterange.AbstractDaterange

Daterange subclasses AbstractDaterange and instantiates Timerange objects

get_start_and_end_time(ref=None)[source]

Generic function to get start time and end time

Parameters:ref (int) – time in seconds
Returns:None
months = {'april': 4, 'august': 8, 'december': 12, 'february': 2, 'january': 1, 'july': 7, 'june': 6, 'march': 3, 'may': 5, 'november': 11, 'october': 10, 'september': 9}
rev_months = {1: 'january', 2: 'february', 3: 'march', 4: 'april', 5: 'may', 6: 'june', 7: 'july', 8: 'august', 9: 'september', 10: 'october', 11: 'november', 12: 'december'}
rev_weekdays = {0: 'monday', 1: 'tuesday', 2: 'wednesday', 3: 'thursday', 4: 'friday', 5: 'saturday', 6: 'sunday'}
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Daterange
Return type:dict
weekdays = {'friday': 4, 'monday': 0, 'saturday': 5, 'sunday': 6, 'thursday': 3, 'tuesday': 1, 'wednesday': 2}
class alignak.daterange.MonthDateDaterange(params, parsing=True)[source]

Bases: alignak.daterange.Daterange

MonthDateDaterange is for month and day entry (month DD - month DD)

get_start_and_end_time(ref=None)[source]

Specific function to get start time and end time for MonthDateDaterange

Parameters:ref (int) – time in seconds
Returns:tuple with start and end time
Return type:tuple (int, int)
class alignak.daterange.MonthDayDaterange(params, parsing=True)[source]

Bases: alignak.daterange.Daterange

MonthDayDaterange is for month week day entry (day DD - DD)

get_start_and_end_time(ref=None)[source]

Specific function to get start time and end time for MonthDayDaterange

Parameters:ref (int) – time in seconds
Returns:tuple with start and end time
Return type:tuple (int, int)
class alignak.daterange.MonthWeekDayDaterange(params, parsing=True)[source]

Bases: alignak.daterange.Daterange

MonthWeekDayDaterange is for month week day entry (weekday DD month - weekday DD month)

get_start_and_end_time(ref=None)[source]

Specific function to get start time and end time for MonthWeekDayDaterange

Parameters:ref (int | None) – time in seconds
Returns:tuple with start and end time
Return type:tuple
is_correct()[source]

Check if the Daterange is correct : weekdays are valid

Returns:True if weekdays are valid, False otherwise
Return type:bool
class alignak.daterange.StandardDaterange(params, parsing=True)[source]

Bases: alignak.daterange.AbstractDaterange

StandardDaterange is for standard entry (weekday - weekday)

get_start_and_end_time(ref=None)[source]

Specific function to get start time and end time for StandardDaterange

Parameters:ref (int) – time in seconds
Returns:tuple with start and end time
Return type:tuple (int, int)
is_correct()[source]

Check if the Daterange is correct : weekdays are valid

Returns:True if weekdays are valid, False otherwise
Return type:bool
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Daterange
Return type:dict
class alignak.daterange.Timerange(entry=None, params=None, parsing=True)[source]

Bases: alignak.alignakobject.AlignakObject

Timerange class provides parsing facilities for time range declaration

get_first_sec_out_from_morning()[source]

Get the first second (from midnight) where we are out of the timerange

Returns:seconds from midnight where timerange is not effective
Return type:int
get_sec_from_morning()[source]

Get Timerange start time in seconds (from midnight)

Returns:amount of seconds from midnight
Return type:int
is_correct()[source]

Getter for is_valid attribute

Returns:True if Timerange is valid, False otherwise
Return type:bool
is_time_valid(timestamp)[source]

Check if time is valid for this Timerange

If sec_from_morning is not provided, get the value.

Parameters:timestamp (int) – time to check
Returns:True if time is valid (in interval), False otherwise
Return type:bool
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Timerange
Return type:dict
class alignak.daterange.WeekDayDaterange(params, parsing=True)[source]

Bases: alignak.daterange.Daterange

WeekDayDaterange is for month week day entry (weekday offset - weekday offset)

get_start_and_end_time(ref=None)[source]

Specific function to get start time and end time for WeekDayDaterange

Parameters:ref (int) – time in seconds
Returns:tuple with start and end time
Return type:tuple (int, int)
alignak.daterange.find_day_by_offset(year, month, offset)[source]

Get the month day based on date and offset

Parameters:
  • year (int) – date year
  • month (int) – date month
  • offset (int) – offset in day to compute (usually negative)
Returns:

day number in the month

Return type:

int

>>> find_day_by_offset(2015, 7, -1)
31
alignak.daterange.find_day_by_weekday_offset(year, month, weekday, offset)[source]

Get the day number based on a date and offset

Parameters:
  • year (int) – date year
  • month (int) – date month
  • weekday (int) – date week day
  • offset (int) – offset (-1 is last, 1 is first etc)
Returns:

day number in the month

Return type:

int

>>> find_day_by_weekday_offset(2010, 7, 1, -1)
27
alignak.daterange.get_day(timestamp)[source]

Get timestamp of the beginning of the day (local) given by timestamp

Parameters:timestamp (int) – time to get day from
Returns:timestamp
Return type:int
alignak.daterange.get_end_of_day(year, month, day)[source]

Get the timestamp associated to the last second of a specific day

Parameters:
  • year (int) – date year
  • month (int) – date month (int)
  • day (int) – date day
Returns:

timestamp

Return type:

int

alignak.daterange.get_sec_from_morning(timestamp)[source]

Get the number of seconds elapsed since the beginning of the day deducted from the provided timestamp

Parameters:timestamp (int) – time to use for computation
Returns:timestamp
Return type:int
alignak.daterange.get_start_of_day(year, month, day)[source]

Get the timestamp associated to the first second of a specific day

Parameters:
  • year (int) – date year
  • month (int) – date month
  • day (int) – date day
Returns:

timestamp

Return type:

int

alignak.daterange.get_wday(timestamp)[source]

Get week day from date

Parameters:timestamp (int) – timestamp date
Returns:weekday (0-6)
Return type:int

TODO: Not timezone aware

alignak.dependencynode module

This module provides DependencyNode and DependencyNodeFactory used for parsing expression (business rules)

class alignak.dependencynode.DependencyNode(params=None, parsing=False)[source]

Bases: object

DependencyNode is a node class for business_rule expression(s)

get_complex_and_node_state(hosts, services)[source]

Get state , handle AND aggregation

* Get the worst state. 2 or max of sons (3 <=> UNKNOWN < CRITICAL <=> 2)
* Revert if it's a not node
Parameters:
  • hosts – host objects
  • services – service objects
Returns:

0, 1 or 2

Return type:

int

get_complex_or_node_state(hosts, services)[source]

Get state , handle OR aggregation

* Get the best state (min of sons)
* Revert if it's a not node
Parameters:
  • hosts – host objects
  • services – service objects
Returns:

0, 1 or 2

Return type:

int

get_complex_xof_node_state(hosts, services)[source]

Get state , handle X of aggregation

* Count the number of OK, WARNING, CRITICAL
* Try too apply, in this order, Critical, Warning, OK rule
* Return the code for first match (2, 1, 0)
* If no rule apply, return OK for simple X of and worst state for multiple X of
Parameters:
  • hosts – host objects
  • services – service objects
Returns:

0, 1 or 2

Return type:

int

TODO: Looks like the last if does the opposite of what the comment says

get_host_node_state(state, problem_has_been_acknowledged, in_scheduled_downtime)[source]

Get host node state, simplest case

* Handle not value (revert) for host and consider 1 as 2
Returns:0, 1 or 2
Return type:int
static get_reverse_state(state)[source]

Do a symmetry around 1 of the state

* 0 -> 2
* 1 -> 1
* 2 -> 0
* else -> else
Parameters:state (int) – state to reverse
Returns:Integer from 0 to 2 (usually)
Return type:int
get_service_node_state(state, problem_has_been_acknowledged, in_scheduled_downtime)[source]

Get service node state, simplest case

* Handle not value (revert) for service
Returns:0, 1 or 2
Return type:int
get_state(hosts, services)[source]

Get node state by looking recursively over sons and applying operand

Parameters:
  • hosts – list of available hosts to search for
  • services – list of available services to search for
Returns:

Node state

Return type:

int

is_valid()[source]

Check if all leaves are correct (no error)

Returns:True if correct, otherwise False
Return type:bool
list_all_elements()[source]

Get all host/service uuid in our node and below

Returns:list of hosts/services uuids
Return type:list
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a DependencyNode
Return type:dict
switch_zeros_of_values()[source]
If we are a of: rule, we can get some 0 in of_values,
if so, change them with NB sons instead
Returns:None
class alignak.dependencynode.DependencyNodeFactory(bound_item)[source]

Bases: object

DependencyNodeFactory provides dependency node parsing functions

eval_complex_cor_pattern(pattern, hosts, services, hostgroups, servicegroups, running=False)[source]

Parse and build recursively a tree of DependencyNode from a complex pattern

Parameters:
Returns:

root node of parsed tree

Return type:

alignak.dependencynode.DependencyNode

eval_cor_pattern(pattern, hosts, services, hostgroups, servicegroups, running=False)[source]

Parse and build recursively a tree of DependencyNode from pattern

Parameters:
Returns:

root node of parsed tree

Return type:

alignak.dependencynode.DependencyNode

eval_simple_cor_pattern(pattern, hosts, services, hostgroups, servicegroups, running=False)[source]

Parse and build recursively a tree of DependencyNode from a simple pattern

Parameters:
Returns:

root node of parsed tree

Return type:

alignak.dependencynode.DependencyNode

static eval_xof_pattern(node, pattern)[source]

Parse a X of pattern * Set is_of_mul attribute * Set of_values attribute

Parameters:
  • node – node to edit
  • pattern (str) – line to match
Returns:

end of the line (without X of :)

Return type:

str

expand_expression(pattern, hosts, services, hostgroups, servicegroups, running=False)[source]

Expand a host or service expression into a dependency node tree using (host|service)group membership, regex, or labels as item selector.

Parameters:
Returns:

root node of parsed tree

Return type:

alignak.dependencynode.DependencyNode

find_object(pattern, hosts, services)[source]

Find object from pattern

Parameters:
Returns:

tuple with Host or Service object and error

Return type:

tuple

get_host_filters(expr)[source]

Generates host filter list corresponding to the expression

* '*' => any
* 'g' => group filter
* 'r' => regex name filter
* 'l' => bp rule label filter
* 't' => tag  filter
* '' => none filter
* No flag match => host name filter
Parameters:expr (str) – expression to parse
Returns:filter list
Return type:list
get_srv_host_filters(expr)[source]

Generates service filter list corresponding to the expression

* '*' => any
* 'g' => hostgroup filter
* 'r' => host regex name filter
* 'l' => host bp rule label filter
* 't' => tag  filter
* '' => none filter
* No flag match => host name filter
Parameters:expr (str) – expression to parse
Returns:filter list
Return type:list
get_srv_service_filters(expr)[source]

Generates service filter list corresponding to the expression

* '*' => any
* 'g' => servicegroup filter
* 'r' => service regex name filter
* 'l' => service bp rule label filter
* 't' => tag  filter
* '' => none filter
* No flag match => service name filter
Parameters:expr (str) – expression to parse
Returns:filter list
Return type:list
host_flags = 'grlt'
service_flags = 'grl'

alignak.dispatcher module

This is the Dispatcher class. Its role is to prepare the Alignak configuration to get dispatched to the Alignak satellites like schedulers, reactionners, pollers, receivers and brokers. It is responsible for high availability part. If an element dies and the element type has a spare, it sends the config of the dead one to the spare one.

class alignak.dispatcher.Dispatcher(conf, arbiter_link)[source]

Bases: object

Dispatcher is in charge of sending configuration to other daemon. It has to handle spare, realms, poller tags etc.

check_dispatch()[source]

Check that all active satellites have a configuration dispatched

A DispatcherError exception is raised if no configuration is dispatched!

Returns:None
check_reachable(forced=False, test=False)[source]

Check all daemons state (reachable or not)

If test parameter is True, do not really send but simulate only for testing purpose…

The update_infos function returns None when no ping has been executed (too early…), or True / False according to the real ping and get managed configuration result. So, if the result is None, consider as not valid, else compute the global result…

Returns:True if all daemons are reachable
check_status_and_get_events()[source]

Get all the daemons status

Returns:Dictionary with all the daemons returned information
Return type:dict
dispatch(test=False)[source]

Send configuration to satellites

Returns:None
get_satellites_list(sat_type)[source]

Get a sorted satellite list: master then spare

Parameters:sat_type (str) – type of the required satellites (arbiters, schedulers, …)
Returns:sorted satellites list
Return type:list[alignak.objects.satellitelink.SatelliteLink]
get_scheduler_ordered_list(realm)[source]

Get sorted scheduler list for a specific realm

List is ordered as: alive first, then spare (if any), then dead scheduler links

Parameters:realm (alignak.objects.realm.Realm) – realm we want scheduler from
Returns:sorted scheduler list
Return type:list[alignak.objects.schedulerlink.SchedulerLink]
prepare_dispatch()[source]

Prepare dispatch, so prepare for each daemon (schedulers, brokers, receivers, reactionners, pollers)

This function will only prepare something if self.new_to_dispatch is False It will reset the first_dispatch_done flag

A DispatcherError exception is raised if a configuration is already prepared! Unset the new_to_dispatch flag before calling!

Returns:None
stop_request(stop_now=False)[source]

Send a stop request to all the daemons

Parameters:stop_now (bool) – stop now or go to stop wait mode
Returns:True if all daemons are reachable
exception alignak.dispatcher.DispatcherError(msg)[source]

Bases: exceptions.Exception

Exception raised for errors in the configuration dispatching.

Attributes:
msg – explanation of the error

alignak.downtime module

This modules provides Downtime class, used to implements downtime monitoring concept. See detailed concepts below

class alignak.downtime.Downtime(params, parsing=False)[source]

Bases: alignak.alignakobject.AlignakObject

Schedules downtime for a specified service. If the “fixed” argument is set to one (1), downtime will start and end at the times specified by the “start” and “end” arguments. Otherwise, downtime will begin between the “start” and “end” times and last for “duration” seconds. The “start” and “end” arguments are specified in time_t format (seconds since the UNIX epoch). The specified service downtime can be triggered by another downtime entry if the “trigger_id” is set to the ID of another scheduled downtime entry. Set the “trigger_id” argument to zero (0) if the downtime for the specified service should not be triggered by another downtime entry.

add_automatic_comment(ref)[source]

Add comment on ref for downtime

Parameters:ref (alignak.objects.schedulingitem.SchedulingItem) – the host/service we want to link a comment to
Returns:None
cancel(timeperiods, hosts, services)[source]

Remove ref in scheduled downtime and raise downtime log entry (cancel)

Parameters:
Returns:

[], always

Return type:

list

del_automatic_comment(item)[source]

Remove automatic comment on ref previously created

Parameters:item (object) – item service or host
Returns:None
enter(timeperiods, hosts, services)[source]

Set ref in scheduled downtime and raise downtime log entry (start)

Parameters:
Returns:

broks

Return type:

list of broks

exit(timeperiods, hosts, services)[source]

Remove ref in scheduled downtime and raise downtime log entry (exit)

Parameters:
Returns:

[], always | None

Return type:

list

fill_data_brok_from(data, brok_type)[source]

Fill data with info of item by looking at brok_type in props of properties or running_properties

Parameters:
  • data – data to fill
  • brok_type (str) – type of brok
Returns:

None

TODO: Duplicate from Notification.fill_data_brok_from

get_expire_brok(host_name, service_name='')[source]

Get an expire downtime brok

Parameters:host_name – host concerned by the downtime

:type host_name :param service_name: service concerned by the downtime :type service_name :return: brok with wanted data :rtype: alignak.brok.Brok

get_raise_brok(host_name, service_name='')[source]

Get a start downtime brok

Parameters:host_name – host concerned by the downtime

:type host_name :param service_name: service concerned by the downtime :type service_name :return: brok with wanted data :rtype: alignak.brok.Brok

in_scheduled_downtime()[source]

Getter for is_in_effect attribute

Returns:True if downtime is in effect, False otherwise
Return type:bool
my_type = 'downtime'
properties = {'activate_me': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'author': <Property <class 'alignak.property.StringProp'>, default: u'Alignak' />, 'can_be_deleted': <Property <class 'alignak.property.BoolProp'>, default: False />, 'comment': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'comment_id': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'duration': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'end_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'entry_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'fixed': <Property <class 'alignak.property.BoolProp'>, default: True />, 'has_been_triggered': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_in_effect': <Property <class 'alignak.property.BoolProp'>, default: False />, 'real_end_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'ref_type': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'start_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'trigger_id': <Property <class 'alignak.property.StringProp'>, default: u'' />}
trigger_me(other_downtime)[source]

Wrapper to activate_me.append function Used to add another downtime to activate

Parameters:other_downtime – other downtime to activate/cancel
Returns:None

alignak.eventhandler module

This module provides EventHandler class, used when hosts or services reach a bad state.

class alignak.eventhandler.EventHandler(params=None, parsing=False)[source]

Bases: alignak.action.Action

Notification class, inherits from action class. Used to execute action when a host or a service is in a bad state

check_time
command
creation_time
env
execution_time
exit_status
get_outputs(out, max_plugins_output_length)[source]

Setter of output attribute

Parameters:
  • out (str) – new output
  • max_plugins_output_length (int) – not used
Returns:

None

get_return_from(e_handler)[source]

Setter of the following attributes:

* exit_status
* output
* long_output
* check_time
* execution_time
* perf_data
Parameters:e_handler (alignak.eventhandler.EventHandler) – event handler to get data from
Returns:None
internal
is_a
is_snapshot
last_poll
long_output
module_type
my_scheduler
my_type = 'eventhandler'
my_worker
output
perf_data
properties = {'_in_timeout': <Property <class 'alignak.property.BoolProp'>, default: False />, '_is_orphan': <Property <class 'alignak.property.BoolProp'>, default: False />, 'check_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'command': <Property <class 'alignak.property.StringProp'>, default: '' />, 'creation_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'env': <Property <class 'alignak.property.DictProp'>, default: {} />, 'execution_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'exit_status': <Property <class 'alignak.property.IntegerProp'>, default: 3 />, 'internal': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_a': <Property <class 'alignak.property.StringProp'>, default: u'eventhandler' />, 'is_snapshot': <Property <class 'alignak.property.BoolProp'>, default: False />, 'last_poll': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'long_output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'module_type': <Property <class 'alignak.property.StringProp'>, default: u'fork' />, 'my_scheduler': <Property <class 'alignak.property.StringProp'>, default: u'unassigned' />, 'my_worker': <Property <class 'alignak.property.StringProp'>, default: u'none' />, 'output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'perf_data': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'reactionner_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'ref_type': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 's_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'status': <Property <class 'alignak.property.StringProp'>, default: u'scheduled' />, 't_to_go': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'timeout': <Property <class 'alignak.property.IntegerProp'>, default: 10 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'u_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'wait_time': <Property <class 'alignak.property.FloatProp'>, default: 0.001 />}
reactionner_tag
ref
ref_type
s_time
status
t_to_go
timeout
type
u_time
wait_time

alignak.external_command module

This module provides ExternalCommand and ExternalCommandManager classes Used to process command sent by users

class alignak.external_command.ExternalCommand(cmd_line, timestamp=None)[source]

Bases: object

ExternalCommand class is only an object with a cmd_line attribute. All parsing and execution is done in manager

my_type = 'externalcommand'
serialize()[source]

This function serializes into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Brok
Return type:dict
class alignak.external_command.ExternalCommandManager(conf, mode, daemon, accept_unknown=False, log_external_commands=False)[source]

Bases: object

ExternalCommandManager manages all external commands sent to Alignak.

It basically parses arguments and executes the right function

acknowledge_host_problem(host, sticky, notify, author, comment)[source]

Acknowledge a host problem Format of the line that triggers function call:

ACKNOWLEDGE_HOST_PROBLEM;<host_name>;<sticky>;<notify>;<persistent:obsolete>;<author>; <comment>

Parameters:
  • host (alignak.objects.host.Host) – host to acknowledge the problem
  • sticky – if sticky == 2, the acknowledge will remain until the host returns to an

UP state else the acknowledge will be removed as soon as the host state changes :type sticky: integer :param notify: if to 1, send a notification :type notify: integer :param author: name of the author or the acknowledge :type author: str :param comment: comment (description) of the acknowledge :type comment: str :return: None TODO: add a better ACK management

acknowledge_host_problem_expire(host, sticky, notify, end_time, author, comment)[source]

Acknowledge a host problem with expire time for this acknowledgement Format of the line that triggers function call:

ACKNOWLEDGE_HOST_PROBLEM_EXPIRE;<host_name>;<sticky>;<notify>;<persistent:obsolete>; <end_time>;<author>;<comment>

Parameters:
  • host (alignak.objects.host.Host) – host to acknowledge the problem
  • sticky (integer) – acknowledge will be always present is host return in UP state
  • notify (integer) – if to 1, send a notification
  • end_time (int) – end (timeout) of this acknowledge in seconds(timestamp) (0 to never end)
  • author (str) – name of the author or the acknowledge
  • comment (str) – comment (description) of the acknowledge
Returns:

None

TODO: add a better ACK management

acknowledge_svc_problem(service, sticky, notify, author, comment)[source]

Acknowledge a service problem Format of the line that triggers function call:

ACKNOWLEDGE_SVC_PROBLEM;<host_name>;<service_description>;<sticky>;<notify>; <persistent:obsolete>;<author>;<comment>

Parameters:
  • service (alignak.objects.service.Service) – service to acknowledge the problem
  • sticky – if sticky == 2, the acknowledge will remain until the service returns to an

OK state else the acknowledge will be removed as soon as the service state changes :param notify: if to 1, send a notification :type notify: integer :param author: name of the author or the acknowledge :type author: str :param comment: comment (description) of the acknowledge :type comment: str :return: None

acknowledge_svc_problem_expire(service, sticky, notify, end_time, author, comment)[source]

Acknowledge a service problem with expire time for this acknowledgement Format of the line that triggers function call:

ACKNOWLEDGE_SVC_PROBLEM_EXPIRE;<host_name>;<service_description>;<sticky>;<notify>; <persistent:obsolete>;<end_time>;<author>;<comment>

Parameters:
  • service (alignak.objects.service.Service) – service to acknowledge the problem
  • sticky (integer) – acknowledge will be always present is host return in UP state
  • notify (integer) – if to 1, send a notification
  • end_time (int) – end (timeout) of this acknowledge in seconds(timestamp) (0 to never end)
  • author (str) – name of the author or the acknowledge
  • comment (str) – comment (description) of the acknowledge
Returns:

None

add_host_comment(host, author, comment)[source]

Add a host comment Format of the line that triggers function call:

ADD_HOST_COMMENT;<host_name>;<persistent:obsolete>;<author>;<comment>

Parameters:
Returns:

None

add_svc_comment(service, author, comment)[source]

Add a service comment Format of the line that triggers function call:

ADD_SVC_COMMENT;<host_name>;<service_description>;<persistent:obsolete>;<author>;<comment>

Parameters:
Returns:

None

change_contact_host_notification_timeperiod(contact, notification_timeperiod)[source]

Change contact host notification timeperiod value Format of the line that triggers function call:

CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD;<contact_name>;<notification_timeperiod>

Parameters:
Returns:

None

static change_contact_modattr(contact, value)[source]

Change contact modified attribute value Format of the line that triggers function call:

CHANGE_CONTACT_MODATTR;<contact_name>;<value>

Parameters:
Returns:

None

static change_contact_modhattr(contact, value)[source]

Change contact modified host attribute value Format of the line that triggers function call:

CHANGE_CONTACT_MODHATTR;<contact_name>;<value>

Parameters:

:type value:str :return: None

static change_contact_modsattr(contact, value)[source]

Change contact modified service attribute value Format of the line that triggers function call:

CHANGE_CONTACT_MODSATTR;<contact_name>;<value>

Parameters:
Returns:

None

change_contact_svc_notification_timeperiod(contact, notification_timeperiod)[source]

Change contact service notification timeperiod value Format of the line that triggers function call:

CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD;<contact_name>;<notification_timeperiod>

Parameters:
Returns:

None

change_custom_contact_var(contact, varname, varvalue)[source]

Change custom contact variable Format of the line that triggers function call:

CHANGE_CUSTOM_CONTACT_VAR;<contact_name>;<varname>;<varvalue>

Parameters:
Returns:

None

change_custom_host_var(host, varname, varvalue)[source]

Change custom host variable Format of the line that triggers function call:

CHANGE_CUSTOM_HOST_VAR;<host_name>;<varname>;<varvalue>

Parameters:
Returns:

None

change_custom_svc_var(service, varname, varvalue)[source]

Change custom service variable Format of the line that triggers function call:

CHANGE_CUSTOM_SVC_VAR;<host_name>;<service_description>;<varname>;<varvalue>

Parameters:
Returns:

None

change_global_host_event_handler(event_handler_command)[source]

DOES NOTHING (should change global host event handler) Format of the line that triggers function call:

CHANGE_GLOBAL_HOST_EVENT_HANDLER;<event_handler_command>

Parameters:event_handler_command – new event handler
Returns:None

TODO: DICT_MODATTR[“MODATTR_EVENT_HANDLER_COMMAND”].value

change_global_svc_event_handler(event_handler_command)[source]

DOES NOTHING (should change global service event handler) Format of the line that triggers function call:

CHANGE_GLOBAL_SVC_EVENT_HANDLER;<event_handler_command>

Parameters:event_handler_command – new event handler
Returns:None

TODO: DICT_MODATTR[“MODATTR_EVENT_HANDLER_COMMAND”].value

change_host_check_command(host, check_command)[source]

Modify host check command Format of the line that triggers function call:

CHANGE_HOST_CHECK_COMMAND;<host_name>;<check_command>

Parameters:
Returns:

None

change_host_check_timeperiod(host, timeperiod)[source]

Modify host check timeperiod Format of the line that triggers function call:

CHANGE_HOST_CHECK_TIMEPERIOD;<host_name>;<timeperiod>

Parameters:
Returns:

None

change_host_event_handler(host, event_handler_command)[source]

Modify host event handler Format of the line that triggers function call:

CHANGE_HOST_EVENT_HANDLER;<host_name>;<event_handler_command>

Parameters:
Returns:

None

change_host_modattr(host, value)[source]

Change host modified attributes Format of the line that triggers function call:

CHANGE_HOST_MODATTR;<host_name>;<value>

For boolean attributes, toggles the service attribute state (enable/disable) For non boolean attribute, only indicates that the corresponding attribute is to be saved in the retention.

Value can be: MODATTR_NONE 0 MODATTR_NOTIFICATIONS_ENABLED 1 MODATTR_ACTIVE_CHECKS_ENABLED 2 MODATTR_PASSIVE_CHECKS_ENABLED 4 MODATTR_EVENT_HANDLER_ENABLED 8 MODATTR_FLAP_DETECTION_ENABLED 16 MODATTR_PERFORMANCE_DATA_ENABLED 64 MODATTR_EVENT_HANDLER_COMMAND 256 MODATTR_CHECK_COMMAND 512 MODATTR_NORMAL_CHECK_INTERVAL 1024 MODATTR_RETRY_CHECK_INTERVAL 2048 MODATTR_MAX_CHECK_ATTEMPTS 4096 MODATTR_FRESHNESS_CHECKS_ENABLED 8192 MODATTR_CHECK_TIMEPERIOD 16384 MODATTR_CUSTOM_VARIABLE 32768 MODATTR_NOTIFICATION_TIMEPERIOD 65536

Parameters:
Returns:

None

change_host_snapshot_command(host, snapshot_command)[source]

Modify host snapshot command Format of the line that triggers function call:

CHANGE_HOST_SNAPSHOT_COMMAND;<host_name>;<event_handler_command>

Parameters:
Returns:

None

change_max_host_check_attempts(host, check_attempts)[source]

Modify max host check attempt Format of the line that triggers function call:

CHANGE_MAX_HOST_CHECK_ATTEMPTS;<host_name>;<check_attempts>

Parameters:
Returns:

None

change_max_svc_check_attempts(service, check_attempts)[source]

Modify max service check attempt Format of the line that triggers function call:

CHANGE_MAX_SVC_CHECK_ATTEMPTS;<host_name>;<service_description>;<check_attempts>

Parameters:
Returns:

None

change_normal_host_check_interval(host, check_interval)[source]

Modify host check interval Format of the line that triggers function call:

CHANGE_NORMAL_HOST_CHECK_INTERVAL;<host_name>;<check_interval>

Parameters:
Returns:

None

change_normal_svc_check_interval(service, check_interval)[source]

Modify service check interval Format of the line that triggers function call:

CHANGE_NORMAL_SVC_CHECK_INTERVAL;<host_name>;<service_description>;<check_interval>

Parameters:
Returns:

None

change_retry_host_check_interval(host, check_interval)[source]

Modify host retry interval Format of the line that triggers function call:

CHANGE_RETRY_HOST_CHECK_INTERVAL;<host_name>;<check_interval>

Parameters:
Returns:

None

change_retry_svc_check_interval(service, check_interval)[source]

Modify service retry interval Format of the line that triggers function call:

CHANGE_RETRY_SVC_CHECK_INTERVAL;<host_name>;<service_description>;<check_interval>

Parameters:
Returns:

None

change_svc_check_command(service, check_command)[source]

Modify service check command Format of the line that triggers function call:

CHANGE_SVC_CHECK_COMMAND;<host_name>;<service_description>;<check_command>

Parameters:
Returns:

None

change_svc_check_timeperiod(service, check_timeperiod)[source]

Modify service check timeperiod Format of the line that triggers function call:

CHANGE_SVC_CHECK_TIMEPERIOD;<host_name>;<service_description>;<check_timeperiod>

Parameters:
Returns:

None

change_svc_event_handler(service, event_handler_command)[source]

Modify service event handler Format of the line that triggers function call:

CHANGE_SVC_EVENT_HANDLER;<host_name>;<service_description>;<event_handler_command>

Parameters:
Returns:

None

change_svc_modattr(service, value)[source]

Change service modified attributes Format of the line that triggers function call:

CHANGE_SVC_MODATTR;<host_name>;<service_description>;<value>

For boolean attributes, toggles the service attribute state (enable/disable) For non boolean attribute, only indicates that the corresponding attribute is to be saved in the retention.

Value can be: MODATTR_NONE 0 MODATTR_NOTIFICATIONS_ENABLED 1 MODATTR_ACTIVE_CHECKS_ENABLED 2 MODATTR_PASSIVE_CHECKS_ENABLED 4 MODATTR_EVENT_HANDLER_ENABLED 8 MODATTR_FLAP_DETECTION_ENABLED 16 MODATTR_PERFORMANCE_DATA_ENABLED 64 MODATTR_EVENT_HANDLER_COMMAND 256 MODATTR_CHECK_COMMAND 512 MODATTR_NORMAL_CHECK_INTERVAL 1024 MODATTR_RETRY_CHECK_INTERVAL 2048 MODATTR_MAX_CHECK_ATTEMPTS 4096 MODATTR_FRESHNESS_CHECKS_ENABLED 8192 MODATTR_CHECK_TIMEPERIOD 16384 MODATTR_CUSTOM_VARIABLE 32768 MODATTR_NOTIFICATION_TIMEPERIOD 65536

Parameters:
Returns:

None

change_svc_notification_timeperiod(service, notification_timeperiod)[source]

Change service notification timeperiod Format of the line that triggers function call:

CHANGE_SVC_NOTIFICATION_TIMEPERIOD;<host_name>;<service_description>; <notification_timeperiod>

Parameters:
Returns:

None

change_svc_snapshot_command(service, snapshot_command)[source]

Modify host snapshot command Format of the line that triggers function call:

CHANGE_HOST_SNAPSHOT_COMMAND;<host_name>;<event_handler_command>

Parameters:
Returns:

None

commands = {'acknowledge_host_problem': {'args': ['host', 'to_int', 'to_bool', 'obsolete', 'author', None], 'global': False}, 'acknowledge_host_problem_expire': {'args': ['host', 'to_int', 'to_bool', 'obsolete', 'to_int', 'author', None], 'global': False}, 'acknowledge_svc_problem': {'args': ['service', 'to_int', 'to_bool', 'obsolete', 'author', None], 'global': False}, 'acknowledge_svc_problem_expire': {'args': ['service', 'to_int', 'to_bool', 'obsolete', 'to_int', 'author', None], 'global': False}, 'add_host_comment': {'args': ['host', 'obsolete', 'author', None], 'global': False}, 'add_simple_host_dependency': {'args': ['host', 'host'], 'global': False}, 'add_simple_poller': {'args': [None, None, None, None], 'global': True, 'internal': True}, 'add_svc_comment': {'args': ['service', 'obsolete', 'author', None], 'global': False}, 'change_contact_host_notification_timeperiod': {'args': ['contact', 'time_period'], 'global': True}, 'change_contact_modattr': {'args': ['contact', None], 'global': True}, 'change_contact_modhattr': {'args': ['contact', None], 'global': True}, 'change_contact_modsattr': {'args': ['contact', None], 'global': True}, 'change_contact_svc_notification_timeperiod': {'args': ['contact', 'time_period'], 'global': True}, 'change_custom_contact_var': {'args': ['contact', None, None], 'global': True}, 'change_custom_host_var': {'args': ['host', None, None], 'global': False}, 'change_custom_svc_var': {'args': ['service', None, None], 'global': False}, 'change_global_host_event_handler': {'args': ['command'], 'global': True}, 'change_global_svc_event_handler': {'args': ['command'], 'global': True}, 'change_host_check_command': {'args': ['host', 'command'], 'global': False}, 'change_host_check_timeperiod': {'args': ['host', 'time_period'], 'global': False}, 'change_host_event_handler': {'args': ['host', 'command'], 'global': False}, 'change_host_modattr': {'args': ['host', 'to_int'], 'global': False}, 'change_host_snapshot_command': {'args': ['host', 'command'], 'global': False}, 'change_max_host_check_attempts': {'args': ['host', 'to_int'], 'global': False}, 'change_max_svc_check_attempts': {'args': ['service', 'to_int'], 'global': False}, 'change_normal_host_check_interval': {'args': ['host', 'to_int'], 'global': False}, 'change_normal_svc_check_interval': {'args': ['service', 'to_int'], 'global': False}, 'change_retry_host_check_interval': {'args': ['host', 'to_int'], 'global': False}, 'change_retry_svc_check_interval': {'args': ['service', 'to_int'], 'global': False}, 'change_svc_check_command': {'args': ['service', 'command'], 'global': False}, 'change_svc_check_timeperiod': {'args': ['service', 'time_period'], 'global': False}, 'change_svc_event_handler': {'args': ['service', 'command'], 'global': False}, 'change_svc_modattr': {'args': ['service', 'to_int'], 'global': False}, 'change_svc_notification_timeperiod': {'args': ['service', 'time_period'], 'global': False}, 'change_svc_snapshot_command': {'args': ['service', 'command'], 'global': False}, 'del_all_contact_downtimes': {'args': ['contact'], 'global': False}, 'del_all_host_comments': {'args': ['host'], 'global': False}, 'del_all_host_downtimes': {'args': ['host'], 'global': False}, 'del_all_svc_comments': {'args': ['service'], 'global': False}, 'del_all_svc_downtimes': {'args': ['service'], 'global': False}, 'del_contact_downtime': {'args': [None], 'global': True}, 'del_host_comment': {'args': [None], 'global': True}, 'del_host_dependency': {'args': ['host', 'host'], 'global': False}, 'del_host_downtime': {'args': [None], 'global': True}, 'del_svc_comment': {'args': [None], 'global': True}, 'del_svc_downtime': {'args': [None], 'global': True}, 'delay_host_notification': {'args': ['host', 'to_int'], 'global': False}, 'delay_svc_notification': {'args': ['service', 'to_int'], 'global': False}, 'disable_all_notifications_beyond_host': {'args': ['host'], 'global': False}, 'disable_contact_host_notifications': {'args': ['contact'], 'global': True}, 'disable_contact_svc_notifications': {'args': ['contact'], 'global': True}, 'disable_contactgroup_host_notifications': {'args': ['contact_group'], 'global': True}, 'disable_contactgroup_svc_notifications': {'args': ['contact_group'], 'global': True}, 'disable_event_handlers': {'args': [], 'global': True}, 'disable_failure_prediction': {'args': [], 'global': True}, 'disable_flap_detection': {'args': [], 'global': True}, 'disable_host_and_child_notifications': {'args': ['host'], 'global': False}, 'disable_host_check': {'args': ['host'], 'global': False}, 'disable_host_event_handler': {'args': ['host'], 'global': False}, 'disable_host_flap_detection': {'args': ['host'], 'global': False}, 'disable_host_freshness_check': {'args': ['host'], 'global': False}, 'disable_host_freshness_checks': {'args': [], 'global': True}, 'disable_host_notifications': {'args': ['host'], 'global': False}, 'disable_host_svc_checks': {'args': ['host'], 'global': False}, 'disable_host_svc_notifications': {'args': ['host'], 'global': False}, 'disable_hostgroup_host_checks': {'args': ['host_group'], 'global': True}, 'disable_hostgroup_host_notifications': {'args': ['host_group'], 'global': True}, 'disable_hostgroup_passive_host_checks': {'args': ['host_group'], 'global': True}, 'disable_hostgroup_passive_svc_checks': {'args': ['host_group'], 'global': True}, 'disable_hostgroup_svc_checks': {'args': ['host_group'], 'global': True}, 'disable_hostgroup_svc_notifications': {'args': ['host_group'], 'global': True}, 'disable_notifications': {'args': [], 'global': True}, 'disable_passive_host_checks': {'args': ['host'], 'global': False}, 'disable_passive_svc_checks': {'args': ['service'], 'global': False}, 'disable_performance_data': {'args': [], 'global': True}, 'disable_service_flap_detection': {'args': ['service'], 'global': False}, 'disable_service_freshness_checks': {'args': [], 'global': True}, 'disable_servicegroup_host_checks': {'args': ['service_group'], 'global': True}, 'disable_servicegroup_host_notifications': {'args': ['service_group'], 'global': True}, 'disable_servicegroup_passive_host_checks': {'args': ['service_group'], 'global': True}, 'disable_servicegroup_passive_svc_checks': {'args': ['service_group'], 'global': True}, 'disable_servicegroup_svc_checks': {'args': ['service_group'], 'global': True}, 'disable_servicegroup_svc_notifications': {'args': ['service_group'], 'global': True}, 'disable_svc_check': {'args': ['service'], 'global': False}, 'disable_svc_event_handler': {'args': ['service'], 'global': False}, 'disable_svc_flap_detection': {'args': ['service'], 'global': False}, 'disable_svc_freshness_check': {'args': ['service'], 'global': False}, 'disable_svc_notifications': {'args': ['service'], 'global': False}, 'enable_all_notifications_beyond_host': {'args': ['host'], 'global': False}, 'enable_contact_host_notifications': {'args': ['contact'], 'global': True}, 'enable_contact_svc_notifications': {'args': ['contact'], 'global': True}, 'enable_contactgroup_host_notifications': {'args': ['contact_group'], 'global': True}, 'enable_contactgroup_svc_notifications': {'args': ['contact_group'], 'global': True}, 'enable_event_handlers': {'args': [], 'global': True}, 'enable_failure_prediction': {'args': [], 'global': True}, 'enable_flap_detection': {'args': [], 'global': True}, 'enable_host_and_child_notifications': {'args': ['host'], 'global': False}, 'enable_host_check': {'args': ['host'], 'global': False}, 'enable_host_event_handler': {'args': ['host'], 'global': False}, 'enable_host_flap_detection': {'args': ['host'], 'global': False}, 'enable_host_freshness_check': {'args': ['host'], 'global': False}, 'enable_host_freshness_checks': {'args': [], 'global': True}, 'enable_host_notifications': {'args': ['host'], 'global': False}, 'enable_host_svc_checks': {'args': ['host'], 'global': False}, 'enable_host_svc_notifications': {'args': ['host'], 'global': False}, 'enable_hostgroup_host_checks': {'args': ['host_group'], 'global': True}, 'enable_hostgroup_host_notifications': {'args': ['host_group'], 'global': True}, 'enable_hostgroup_passive_host_checks': {'args': ['host_group'], 'global': True}, 'enable_hostgroup_passive_svc_checks': {'args': ['host_group'], 'global': True}, 'enable_hostgroup_svc_checks': {'args': ['host_group'], 'global': True}, 'enable_hostgroup_svc_notifications': {'args': ['host_group'], 'global': True}, 'enable_notifications': {'args': [], 'global': True}, 'enable_passive_host_checks': {'args': ['host'], 'global': False}, 'enable_passive_svc_checks': {'args': ['service'], 'global': False}, 'enable_performance_data': {'args': [], 'global': True}, 'enable_service_freshness_checks': {'args': [], 'global': True}, 'enable_servicegroup_host_checks': {'args': ['service_group'], 'global': True}, 'enable_servicegroup_host_notifications': {'args': ['service_group'], 'global': True}, 'enable_servicegroup_passive_host_checks': {'args': ['service_group'], 'global': True}, 'enable_servicegroup_passive_svc_checks': {'args': ['service_group'], 'global': True}, 'enable_servicegroup_svc_checks': {'args': ['service_group'], 'global': True}, 'enable_servicegroup_svc_notifications': {'args': ['service_group'], 'global': True}, 'enable_svc_check': {'args': ['service'], 'global': False}, 'enable_svc_event_handler': {'args': ['service'], 'global': False}, 'enable_svc_flap_detection': {'args': ['service'], 'global': False}, 'enable_svc_freshness_check': {'args': ['service'], 'global': False}, 'enable_svc_notifications': {'args': ['service'], 'global': False}, 'launch_host_event_handler': {'args': ['host'], 'global': False}, 'launch_svc_event_handler': {'args': ['service'], 'global': False}, 'process_file': {'args': [None, 'to_bool'], 'global': True}, 'process_host_check_result': {'args': ['host', 'to_int', None], 'global': False}, 'process_host_output': {'args': ['host', None], 'global': False}, 'process_service_check_result': {'args': ['service', 'to_int', None], 'global': False}, 'process_service_output': {'args': ['service', None], 'global': False}, 'read_state_information': {'args': [], 'global': True}, 'reload_config': {'args': [], 'global': True, 'internal': True}, 'remove_host_acknowledgement': {'args': ['host'], 'global': False}, 'remove_svc_acknowledgement': {'args': ['service'], 'global': False}, 'restart_program': {'args': [], 'global': True, 'internal': True}, 'save_state_information': {'args': [], 'global': True}, 'schedule_and_propagate_host_downtime': {'args': ['host', 'to_int', 'to_int', 'to_bool', 'to_int', 'to_int', 'author', None], 'global': False}, 'schedule_and_propagate_triggered_host_downtime': {'args': ['host', 'to_int', 'to_int', 'to_bool', 'to_int', 'to_int', 'author', None], 'global': False}, 'schedule_contact_downtime': {'args': ['contact', 'to_int', 'to_int', 'author', None], 'global': True}, 'schedule_forced_host_check': {'args': ['host', 'to_int'], 'global': False}, 'schedule_forced_host_svc_checks': {'args': ['host', 'to_int'], 'global': False}, 'schedule_forced_svc_check': {'args': ['service', 'to_int'], 'global': False}, 'schedule_host_check': {'args': ['host', 'to_int'], 'global': False}, 'schedule_host_downtime': {'args': ['host', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': False}, 'schedule_host_svc_checks': {'args': ['host', 'to_int'], 'global': False}, 'schedule_host_svc_downtime': {'args': ['host', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': False}, 'schedule_hostgroup_host_downtime': {'args': ['host_group', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': True}, 'schedule_hostgroup_svc_downtime': {'args': ['host_group', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': True}, 'schedule_servicegroup_host_downtime': {'args': ['service_group', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': True}, 'schedule_servicegroup_svc_downtime': {'args': ['service_group', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': True}, 'schedule_svc_check': {'args': ['service', 'to_int'], 'global': False}, 'schedule_svc_downtime': {'args': ['service', 'to_int', 'to_int', 'to_bool', None, 'to_int', 'author', None], 'global': False}, 'send_custom_host_notification': {'args': ['host', 'to_int', 'author', None], 'global': False}, 'send_custom_svc_notification': {'args': ['service', 'to_int', 'author', None], 'global': False}, 'set_host_notification_number': {'args': ['host', 'to_int'], 'global': False}, 'set_svc_notification_number': {'args': ['service', 'to_int'], 'global': False}, 'shutdown_program': {'args': [], 'global': True}, 'start_accepting_passive_host_checks': {'args': [], 'global': True}, 'start_accepting_passive_svc_checks': {'args': [], 'global': True}, 'start_executing_host_checks': {'args': [], 'global': True}, 'start_executing_svc_checks': {'args': [], 'global': True}, 'stop_accepting_passive_host_checks': {'args': [], 'global': True}, 'stop_accepting_passive_svc_checks': {'args': [], 'global': True}, 'stop_executing_host_checks': {'args': [], 'global': True}, 'stop_executing_svc_checks': {'args': [], 'global': True}}
del_all_contact_downtimes(contact)[source]

Delete all contact downtimes Format of the line that triggers function call:

DEL_ALL_CONTACT_DOWNTIMES;<contact_name>

Parameters:contact (alignak.objects.contact.Contact) – contact to edit
Returns:None
del_all_host_comments(host)[source]

Delete all host comments Format of the line that triggers function call:

DEL_ALL_HOST_COMMENTS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
del_all_host_downtimes(host)[source]

Delete all host downtimes Format of the line that triggers function call:

DEL_ALL_HOST_DOWNTIMES;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
del_all_svc_comments(service)[source]

Delete all service comments Format of the line that triggers function call:

DEL_ALL_SVC_COMMENTS;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
del_all_svc_downtimes(service)[source]

Delete all service downtime Format of the line that triggers function call:

DEL_ALL_SVC_DOWNTIMES;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
del_contact_downtime(downtime_id)[source]

Delete a contact downtime Format of the line that triggers function call:

DEL_CONTACT_DOWNTIME;<downtime_id>

Parameters:downtime_id (int) – downtime id to delete
Returns:None
del_host_comment(comment_id)[source]

Delete a host comment Format of the line that triggers function call:

DEL_HOST_COMMENT;<comment_id>

Parameters:comment_id (int) – comment id to delete
Returns:None
del_host_downtime(downtime_id)[source]

Delete a host downtime Format of the line that triggers function call:

DEL_HOST_DOWNTIME;<downtime_id>

Parameters:downtime_id (int) – downtime id to delete
Returns:None
del_svc_comment(comment_id)[source]

Delete a service comment Format of the line that triggers function call:

DEL_SVC_COMMENT;<comment_id>

Parameters:comment_id (int) – comment id to delete
Returns:None
del_svc_downtime(downtime_id)[source]

Delete a service downtime Format of the line that triggers function call:

DEL_SVC_DOWNTIME;<downtime_id>

Parameters:downtime_id (int) – downtime id to delete
Returns:None
delay_host_notification(host, notification_time)[source]

Modify host first notification delay Format of the line that triggers function call:

DELAY_HOST_NOTIFICATION;<host_name>;<notification_time>

Parameters:
Returns:

None

delay_svc_notification(service, notification_time)[source]

Modify service first notification delay Format of the line that triggers function call:

DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time>

Parameters:
Returns:

None

disable_all_notifications_beyond_host(host)[source]

DOES NOTHING (should disable notification beyond a host) Format of the line that triggers function call:

DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None

TODO: Implement it

disable_contact_host_notifications(contact)[source]

Disable host notifications for a contact Format of the line that triggers function call:

DISABLE_CONTACT_HOST_NOTIFICATIONS;<contact_name>

Parameters:contact (alignak.objects.contact.Contact) – contact to disable
Returns:None
disable_contact_svc_notifications(contact)[source]

Disable service notifications for a contact Format of the line that triggers function call:

DISABLE_CONTACT_SVC_NOTIFICATIONS;<contact_name>

Parameters:contact (alignak.objects.contact.Contact) – contact to disable
Returns:None
disable_contactgroup_host_notifications(contactgroup)[source]

Disable host notifications for a contactgroup Format of the line that triggers function call:

DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS;<contactgroup_name>

Parameters:contactgroup (alignak.objects.contactgroup.Contactgroup) – contactgroup to disable
Returns:None
disable_contactgroup_svc_notifications(contactgroup)[source]

Disable service notifications for a contactgroup Format of the line that triggers function call:

DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS;<contactgroup_name>

Parameters:contactgroup (alignak.objects.contactgroup.Contactgroup) – contactgroup to disable
Returns:None
disable_event_handlers()[source]

Disable event handlers (globally) Format of the line that triggers function call:

DISABLE_EVENT_HANDLERS

Returns:None
disable_flap_detection()[source]

Disable flap detection (globally) Format of the line that triggers function call:

DISABLE_FLAP_DETECTION

Returns:None
disable_host_and_child_notifications(host)[source]

DOES NOTHING (Should disable host notifications and its child) Format of the line that triggers function call:

DISABLE_HOST_AND_CHILD_NOTIFICATIONS;<host_name

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_check(host)[source]

Disable checks for a host Format of the line that triggers function call:

DISABLE_HOST_CHECK;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_event_handler(host)[source]

Disable event handlers for a host Format of the line that triggers function call:

DISABLE_HOST_EVENT_HANDLER;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_flap_detection(host)[source]

Disable flap detection for a host Format of the line that triggers function call:

DISABLE_HOST_FLAP_DETECTION;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_freshness_check(host)[source]

Disable freshness check for a host Format of the line that triggers function call:

DISABLE_HOST_FRESHNESS_CHECK;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_freshness_checks()[source]

Disable freshness checks (globally) Format of the line that triggers function call:

DISABLE_HOST_FRESHNESS_CHECKS

Returns:None
disable_host_notifications(host)[source]

Disable notifications for a host Format of the line that triggers function call:

DISABLE_HOST_NOTIFICATIONS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_svc_checks(host)[source]

Disable service checks for a host Format of the line that triggers function call:

DISABLE_HOST_SVC_CHECKS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_host_svc_notifications(host)[source]

Disable services notifications for a host Format of the line that triggers function call:

DISABLE_HOST_SVC_NOTIFICATIONS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_hostgroup_host_checks(hostgroup)[source]

Disable host checks for a hostgroup Format of the line that triggers function call:

DISABLE_HOSTGROUP_HOST_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to disable
Returns:None
disable_hostgroup_host_notifications(hostgroup)[source]

Disable host notifications for a hostgroup Format of the line that triggers function call:

DISABLE_HOSTGROUP_HOST_NOTIFICATIONS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to disable
Returns:None
disable_hostgroup_passive_host_checks(hostgroup)[source]

Disable host passive checks for a hostgroup Format of the line that triggers function call:

DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to disable
Returns:None
disable_hostgroup_passive_svc_checks(hostgroup)[source]

Disable service passive checks for a hostgroup Format of the line that triggers function call:

DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to disable
Returns:None
disable_hostgroup_svc_checks(hostgroup)[source]

Disable service checks for a hostgroup Format of the line that triggers function call:

DISABLE_HOSTGROUP_SVC_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to disable
Returns:None
disable_hostgroup_svc_notifications(hostgroup)[source]

Disable service notifications for a hostgroup Format of the line that triggers function call:

DISABLE_HOSTGROUP_SVC_NOTIFICATIONS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to disable
Returns:None
disable_notifications()[source]

Disable notifications (globally) Format of the line that triggers function call:

DISABLE_NOTIFICATIONS

Returns:None
disable_passive_host_checks(host)[source]

Disable passive checks for a host Format of the line that triggers function call:

DISABLE_PASSIVE_HOST_CHECKS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
disable_passive_svc_checks(service)[source]

Disable passive checks for a service Format of the line that triggers function call:

DISABLE_PASSIVE_SVC_CHECKS;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
disable_performance_data()[source]

Disable performance data processing (globally) Format of the line that triggers function call:

DISABLE_PERFORMANCE_DATA

Returns:None
disable_service_flap_detection(service)[source]

Disable flap detection for a service Format of the line that triggers function call:

DISABLE_SERVICE_FLAP_DETECTION;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
disable_service_freshness_checks()[source]

Disable service freshness checks (globally) Format of the line that triggers function call:

DISABLE_SERVICE_FRESHNESS_CHECKS

Returns:None
disable_servicegroup_host_checks(servicegroup)[source]

Disable host checks for a servicegroup Format of the line that triggers function call:

DISABLE_SERVICEGROUP_HOST_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to disable
Returns:None
disable_servicegroup_host_notifications(servicegroup)[source]

Disable host notifications for a servicegroup Format of the line that triggers function call:

DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to disable
Returns:None
disable_servicegroup_passive_host_checks(servicegroup)[source]

Disable passive host checks for a servicegroup Format of the line that triggers function call:

DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to disable
Returns:None
disable_servicegroup_passive_svc_checks(servicegroup)[source]

Disable passive service checks for a servicegroup Format of the line that triggers function call:

DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to disable
Returns:None
disable_servicegroup_svc_checks(servicegroup)[source]

Disable service checks for a servicegroup Format of the line that triggers function call:

DISABLE_SERVICEGROUP_SVC_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to disable
Returns:None
disable_servicegroup_svc_notifications(servicegroup)[source]

Disable service notifications for a servicegroup Format of the line that triggers function call:

DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to disable
Returns:None
disable_svc_check(service)[source]

Disable checks for a service Format of the line that triggers function call:

DISABLE_SVC_CHECK;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
disable_svc_event_handler(service)[source]

Disable event handlers for a service Format of the line that triggers function call:

DISABLE_SVC_EVENT_HANDLER;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
disable_svc_flap_detection(service)[source]

Disable flap detection for a service Format of the line that triggers function call:

DISABLE_SVC_FLAP_DETECTION;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
disable_svc_freshness_check(service)[source]

Disable freshness check for a service Format of the line that triggers function call:

DISABLE_SERVICE_FRESHNESS_CHECK;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
disable_svc_notifications(service)[source]

Disable notifications for a service Format of the line that triggers function call:

DISABLE_SVC_NOTIFICATIONS;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
enable_all_notifications_beyond_host(host)[source]

DOES NOTHING (should enable notification beyond a host) Format of the line that triggers function call:

ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None

TODO: Implement it

enable_contact_host_notifications(contact)[source]

Enable host notifications for a contact Format of the line that triggers function call:

ENABLE_CONTACT_HOST_NOTIFICATIONS;<contact_name>

Parameters:contact (alignak.objects.contact.Contact) – contact to enable
Returns:None
enable_contact_svc_notifications(contact)[source]

Enable service notifications for a contact Format of the line that triggers function call:

DISABLE_CONTACT_SVC_NOTIFICATIONS;<contact_name>

Parameters:contact (alignak.objects.contact.Contact) – contact to enable
Returns:None
enable_contactgroup_host_notifications(contactgroup)[source]

Enable host notifications for a contactgroup Format of the line that triggers function call:

ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS;<contactgroup_name>

Parameters:contactgroup (alignak.objects.contactgroup.Contactgroup) – contactgroup to enable
Returns:None
enable_contactgroup_svc_notifications(contactgroup)[source]

Enable service notifications for a contactgroup Format of the line that triggers function call:

ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS;<contactgroup_name>

Parameters:contactgroup (alignak.objects.contactgroup.Contactgroup) – contactgroup to enable
Returns:None
enable_event_handlers()[source]

Enable event handlers (globally) Format of the line that triggers function call:

ENABLE_EVENT_HANDLERS

Returns:None
enable_flap_detection()[source]

Enable flap detection (globally) Format of the line that triggers function call:

ENABLE_FLAP_DETECTION

Returns:None
enable_host_and_child_notifications(host)[source]

DOES NOTHING (Should enable host notifications and its child) Format of the line that triggers function call:

ENABLE_HOST_AND_CHILD_NOTIFICATIONS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_check(host)[source]

Enable checks for a host Format of the line that triggers function call:

ENABLE_HOST_CHECK;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_event_handler(host)[source]

Enable event handlers for a host Format of the line that triggers function call:

ENABLE_HOST_EVENT_HANDLER;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_flap_detection(host)[source]

Enable flap detection for a host Format of the line that triggers function call:

ENABLE_HOST_FLAP_DETECTION;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_freshness_check(host)[source]

Enable freshness check for a host Format of the line that triggers function call:

ENABLE_HOST_FRESHNESS_CHECK;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_freshness_checks()[source]

Enable freshness checks (globally) Format of the line that triggers function call:

ENABLE_HOST_FRESHNESS_CHECKS

Returns:None
enable_host_notifications(host)[source]

Enable notifications for a host Format of the line that triggers function call:

ENABLE_HOST_NOTIFICATIONS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_svc_checks(host)[source]

Enable service checks for a host Format of the line that triggers function call:

ENABLE_HOST_SVC_CHECKS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_host_svc_notifications(host)[source]

Enable services notifications for a host Format of the line that triggers function call:

ENABLE_HOST_SVC_NOTIFICATIONS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_hostgroup_host_checks(hostgroup)[source]

Enable host checks for a hostgroup Format of the line that triggers function call:

ENABLE_HOSTGROUP_HOST_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to enable
Returns:None
enable_hostgroup_host_notifications(hostgroup)[source]

Enable host notifications for a hostgroup Format of the line that triggers function call:

ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to enable
Returns:None
enable_hostgroup_passive_host_checks(hostgroup)[source]

Enable host passive checks for a hostgroup Format of the line that triggers function call:

ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to enable
Returns:None
enable_hostgroup_passive_svc_checks(hostgroup)[source]

Enable service passive checks for a hostgroup Format of the line that triggers function call:

ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to enable
Returns:None
enable_hostgroup_svc_checks(hostgroup)[source]

Enable service checks for a hostgroup Format of the line that triggers function call:

ENABLE_HOSTGROUP_SVC_CHECKS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to enable
Returns:None
enable_hostgroup_svc_notifications(hostgroup)[source]

Enable service notifications for a hostgroup Format of the line that triggers function call:

ENABLE_HOSTGROUP_SVC_NOTIFICATIONS;<hostgroup_name>

Parameters:hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to enable
Returns:None
enable_notifications()[source]

Enable notifications (globally) Format of the line that triggers function call:

ENABLE_NOTIFICATIONS

Returns:None
enable_passive_host_checks(host)[source]

Enable passive checks for a host Format of the line that triggers function call:

ENABLE_PASSIVE_HOST_CHECKS;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
enable_passive_svc_checks(service)[source]

Enable passive checks for a service Format of the line that triggers function call:

ENABLE_PASSIVE_SVC_CHECKS;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
enable_performance_data()[source]

Enable performance data processing (globally) Format of the line that triggers function call:

ENABLE_PERFORMANCE_DATA

Returns:None
enable_service_freshness_checks()[source]

Enable service freshness checks (globally) Format of the line that triggers function call:

ENABLE_SERVICE_FRESHNESS_CHECKS

Returns:None
enable_servicegroup_host_checks(servicegroup)[source]

Enable host checks for a servicegroup Format of the line that triggers function call:

ENABLE_SERVICEGROUP_HOST_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to enable
Returns:None
enable_servicegroup_host_notifications(servicegroup)[source]

Enable host notifications for a servicegroup Format of the line that triggers function call:

ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to enable
Returns:None
enable_servicegroup_passive_host_checks(servicegroup)[source]

Enable passive host checks for a servicegroup Format of the line that triggers function call:

ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to enable
Returns:None
enable_servicegroup_passive_svc_checks(servicegroup)[source]

Enable passive service checks for a servicegroup Format of the line that triggers function call:

ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to enable
Returns:None
enable_servicegroup_svc_checks(servicegroup)[source]

Enable service checks for a servicegroup Format of the line that triggers function call:

ENABLE_SERVICEGROUP_SVC_CHECKS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to enable
Returns:None
enable_servicegroup_svc_notifications(servicegroup)[source]

Enable service notifications for a servicegroup Format of the line that triggers function call:

ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS;<servicegroup_name>

Parameters:servicegroup (alignak.objects.servicegroup.Servicegroup) – servicegroup to enable
Returns:None
enable_svc_check(service)[source]

Enable checks for a service Format of the line that triggers function call:

ENABLE_SVC_CHECK;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
enable_svc_event_handler(service)[source]

Enable event handlers for a service Format of the line that triggers function call:

ENABLE_SVC_EVENT_HANDLER;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
enable_svc_flap_detection(service)[source]

Enable flap detection for a service Format of the line that triggers function call:

ENABLE_SVC_FLAP_DETECTION;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
enable_svc_freshness_check(service)[source]

Enable freshness check for a service Format of the line that triggers function call:

ENABLE_SERVICE_FRESHNESS_CHECK;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
enable_svc_notifications(service)[source]

Enable notifications for a service Format of the line that triggers function call:

ENABLE_SVC_NOTIFICATIONS;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
get_command_and_args(command, extcmd=None)[source]

Parse command and get args

Parameters:
  • command (str) – command line to parse
  • extcmd (None | object) – external command object (used to dispatch)
Returns:

Dict containing command and arg

{‘global’: False, ‘c_name’: c_name, ‘args’: args}

Return type:dict | None
static get_unknown_check_result_brok(cmd_line)[source]

Create unknown check result brok and fill it with command data

Parameters:cmd_line (str) – command line to extract data
Returns:unknown check result brok
Return type:alignak.objects.brok.Brok
launch_host_event_handler(host)[source]

Launch event handler for a service Format of the line that triggers function call:

LAUNCH_HOST_EVENT_HANDLER;<host_name>

Parameters:host (alignak.objects.host.Host) – host to execute the event handler
Returns:None
launch_svc_event_handler(service)[source]

Launch event handler for a service Format of the line that triggers function call:

LAUNCH_SVC_EVENT_HANDLER;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to execute the event handler
Returns:None
process_file(file_name, delete)[source]

DOES NOTHING (should process a file) Format of the line that triggers function call:

PROCESS_FILE;<file_name>;<delete>

Parameters:
  • file_name (str) – file to process
  • delete – delete after processing
Returns:

None

process_host_check_result(host, status_code, plugin_output)[source]

Process host check result Format of the line that triggers function call:

PROCESS_HOST_CHECK_RESULT;<host_name>;<status_code>;<plugin_output>

Parameters:
Returns:

None

TODO: say that check is PASSIVE

process_host_output(host, plugin_output)[source]

Process host output Format of the line that triggers function call:

PROCESS_HOST_OUTPUT;<host_name>;<plugin_output>

Parameters:
Returns:

None

process_service_check_result(service, return_code, plugin_output)[source]

Process service check result Format of the line that triggers function call:

PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<return_code>;<plugin_output>

Parameters:
Returns:

None

process_service_output(service, plugin_output)[source]

Process service output Format of the line that triggers function call:

PROCESS_SERVICE_OUTPUT;<host_name>;<service_description>;<plugin_output>

Parameters:
Returns:

None

read_state_information()[source]

Request to load the live state from the retention storage Format of the line that triggers function call:

READ_STATE_INFORMATION

Returns:None
reload_config()[source]

Reload Alignak configuration Format of the line that triggers function call:

RELOAD_CONFIG

Returns:None
static remove_host_acknowledgement(host)[source]

Remove an acknowledgment on a host Format of the line that triggers function call:

REMOVE_HOST_ACKNOWLEDGEMENT;<host_name>

Parameters:host (alignak.objects.host.Host) – host to edit
Returns:None
static remove_svc_acknowledgement(service)[source]

Remove an acknowledgment on a service Format of the line that triggers function call:

REMOVE_SVC_ACKNOWLEDGEMENT;<host_name>;<service_description>

Parameters:service (alignak.objects.service.Service) – service to edit
Returns:None
resolve_command(excmd)[source]

Parse command and dispatch it (to schedulers for example) if necessary If the command is not global it will be executed.

Parameters:excmd (alignak.external_command.ExternalCommand) – external command to handle
Returns:result of command parsing. None for an invalid command.
restart_program()[source]

Restart Alignak Format of the line that triggers function call:

RESTART_PROGRAM

Returns:None
save_state_information()[source]

Request to save the live state to the retention Format of the line that triggers function call:

SAVE_STATE_INFORMATION

Returns:None
schedule_and_propagate_host_downtime(host, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

DOES NOTHING (Should create host downtime and start it?) Format of the line that triggers function call:

SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME;<host_name>;<start_time>;<end_time>; <fixed>;<trigger_id>;<duration>;<author>;<comment>

Returns:None
schedule_and_propagate_triggered_host_downtime(host, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

DOES NOTHING (Should create triggered host downtime and start it?) Format of the line that triggers function call:

SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME;<host_name>;<start_time>;<end_time>;<fixed>; <trigger_id>;<duration>;<author>;<comment>

Returns:None
schedule_contact_downtime(contact, start_time, end_time, author, comment)[source]

Schedule contact downtime Format of the line that triggers function call:

SCHEDULE_CONTACT_DOWNTIME;<contact_name>;<start_time>;<end_time>;<author>;<comment>

Parameters:
  • contact (alignak.objects.contact.Contact) – contact to put in downtime
  • start_time (int) – downtime start time
  • end_time (int) – downtime end time
  • author (str) – downtime author
  • comment (str) – text comment
Returns:

None

schedule_forced_host_check(host, check_time)[source]

Schedule a forced check on a host Format of the line that triggers function call:

SCHEDULE_FORCED_HOST_CHECK;<host_name>;<check_time>

Parameters:
  • host (alignak.object.host.Host) – host to check
  • check_time (int) – time to check
Returns:

None

schedule_forced_host_svc_checks(host, check_time)[source]

Schedule a forced check on all services of a host Format of the line that triggers function call:

SCHEDULE_FORCED_HOST_SVC_CHECKS;<host_name>;<check_time>

Parameters:
  • host (alignak.object.host.Host) – host to check
  • check_time (int) – time to check
Returns:

None

schedule_forced_svc_check(service, check_time)[source]

Schedule a forced check on a service Format of the line that triggers function call:

SCHEDULE_FORCED_SVC_CHECK;<host_name>;<service_description>;<check_time>

Parameters:
  • service (alignak.object.service.Service) – service to check
  • check_time (int) – time to check
Returns:

None

schedule_host_check(host, check_time)[source]

Schedule a check on a host Format of the line that triggers function call:

SCHEDULE_HOST_CHECK;<host_name>;<check_time>

Parameters:
  • host (alignak.object.host.Host) – host to check
  • check_time – time to check
Returns:

None

schedule_host_downtime(host, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a host downtime Format of the line that triggers function call:

SCHEDULE_HOST_DOWNTIME;<host_name>;<start_time>;<end_time>;<fixed>; <trigger_id>;<duration>;<author>;<comment>

Parameters:
  • host (alignak.object.host.Host) – host to schedule downtime
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed (bool) – is downtime fixed
  • trigger_id (str) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

schedule_host_svc_checks(host, check_time)[source]

Schedule a check on all services of a host Format of the line that triggers function call:

SCHEDULE_HOST_SVC_CHECKS;<host_name>;<check_time>

Parameters:
  • host (alignak.object.host.Host) – host to check
  • check_time – time to check
Returns:

None

schedule_host_svc_downtime(host, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a service downtime for each service of an host Format of the line that triggers function call:

SCHEDULE_HOST_SVC_DOWNTIME;<host_name>;<start_time>;<end_time>; <fixed>;<trigger_id>;<duration>;<author>;<comment>

Parameters:
  • host (alignak.object.host.Host) – host to schedule downtime
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed (bool) – is downtime fixed
  • trigger_id (str) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

schedule_hostgroup_host_downtime(hostgroup, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a downtime for each host of a hostgroup Format of the line that triggers function call:

SCHEDULE_HOSTGROUP_HOST_DOWNTIME;<hostgroup_name>;<start_time>;<end_time>; <fixed>;<trigger_id>;<duration>;<author>;<comment>

Parameters:
  • hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to schedule
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed – is downtime fixed
  • trigger_id (str) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

schedule_hostgroup_svc_downtime(hostgroup, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a downtime for each service of each host of a hostgroup Format of the line that triggers function call:

SCHEDULE_HOSTGROUP_SVC_DOWNTIME;;<hostgroup_name>;<start_time>;<end_time>;<fixed>; <trigger_id>;<duration>;<author>;<comment>

Parameters:
  • hostgroup (alignak.objects.hostgroup.Hostgroup) – hostgroup to schedule
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed – is downtime fixed
  • trigger_id (str) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

schedule_servicegroup_host_downtime(servicegroup, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a host downtime for each host of services in a servicegroup Format of the line that triggers function call:

SCHEDULE_SERVICEGROUP_HOST_DOWNTIME;<servicegroup_name>;<start_time>;<end_time>;<fixed>; <trigger_id>;<duration>;<author>;<comment>

Parameters:
  • servicegroup (alignak.object.servicegroup.Servicegroup) – servicegroup to schedule downtime
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed (bool) – is downtime fixed
  • trigger_id (str) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

schedule_servicegroup_svc_downtime(servicegroup, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a service downtime for each service of a servicegroup Format of the line that triggers function call:

SCHEDULE_SERVICEGROUP_SVC_DOWNTIME;<servicegroup_name>;<start_time>;<end_time>; <fixed>;<trigger_id>;<duration>;<author>;<comment>

Parameters:
  • servicegroup (alignak.object.servicegroup.Servicegroup) – servicegroup to schedule downtime
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed (bool) – is downtime fixed
  • trigger_id (str) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

schedule_svc_check(service, check_time)[source]

Schedule a check on a service Format of the line that triggers function call:

SCHEDULE_SVC_CHECK;<host_name>;<service_description>;<check_time>

Parameters:
  • service (alignak.object.service.Service) – service to check
  • check_time – time to check
Returns:

None

schedule_svc_downtime(service, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]

Schedule a service downtime Format of the line that triggers function call:

SCHEDULE_SVC_DOWNTIME;<host_name>;<service_description><start_time>;<end_time>; <fixed>;<trigger_id>;<duration>;<author>;<comment>

Parameters:
  • service (alignak.object.service.Service) – service to check
  • start_time – downtime start time
  • end_time – downtime end time
  • fixed (bool) – is downtime fixed
  • trigger_id (int) – downtime id that triggered this one
  • duration (int) – downtime duration
  • author (str) – downtime author
  • comment (str) – downtime comment
Returns:

None

search_host_and_dispatch(host_name, command, extcmd)[source]

Try to dispatch a command for a specific host (so specific scheduler) because this command is related to a host (change notification interval for example)

Parameters:
Returns:

None

send_an_element(element)[source]

Send an element (Brok, Comment,…) to our daemon

Use the daemon add function if it exists, else raise an error log

Parameters:element – elementto be sent
Type:alignak.Brok, or Comment, or Downtime, ..
Returns:
send_custom_host_notification(host, options, author, comment)[source]

DOES NOTHING (Should send a custom notification) Format of the line that triggers function call:

SEND_CUSTOM_HOST_NOTIFICATION;<host_name>;<options>;<author>;<comment>

Parameters:
  • host (alignak.object.host.Host) – host to send notif for
  • options – notification options
  • author (str) – notification author
  • comment (str) – notification text
Returns:

None

send_custom_svc_notification(service, options, author, comment)[source]

DOES NOTHING (Should send a custom notification) Format of the line that triggers function call:

SEND_CUSTOM_SVC_NOTIFICATION;<host_name>;<service_description>;<options>;<author>;<comment>>

Parameters:
  • service (alignak.object.service.Service) – service to send notif for
  • options – notification options
  • author (str) – notification author
  • comment (str) – notification text
Returns:

None

set_host_notification_number(host, notification_number)[source]

DOES NOTHING (Should set host notification number) Format of the line that triggers function call:

SET_HOST_NOTIFICATION_NUMBER;<host_name>;<notification_number>

Parameters:
  • host (alignak.object.host.Host) – host to edit
  • notification_number – new value to set
Returns:

None

set_svc_notification_number(service, notification_number)[source]

DOES NOTHING (Should set host notification number) Format of the line that triggers function call:

SET_SVC_NOTIFICATION_NUMBER;<host_name>;<service_description>;<notification_number>

Parameters:
  • service (alignak.object.service.Service) – service to edit
  • notification_number – new value to set
Returns:

None

shutdown_program()[source]

DOES NOTHING (Should shutdown Alignak) Format of the line that triggers function call:

SHUTDOWN_PROGRAM

Returns:None
start_accepting_passive_host_checks()[source]

Enable passive host check submission (globally) Format of the line that triggers function call:

START_ACCEPTING_PASSIVE_HOST_CHECKS

Returns:None
start_accepting_passive_svc_checks()[source]

Enable passive service check submission (globally) Format of the line that triggers function call:

START_ACCEPTING_PASSIVE_SVC_CHECKS

Returns:None
start_executing_host_checks()[source]

Enable host check execution (globally) Format of the line that triggers function call:

START_EXECUTING_HOST_CHECKS

Returns:None
start_executing_svc_checks()[source]

Enable service check execution (globally) Format of the line that triggers function call:

START_EXECUTING_SVC_CHECKS

Returns:None
stop_accepting_passive_host_checks()[source]

Disable passive host check submission (globally) Format of the line that triggers function call:

STOP_ACCEPTING_PASSIVE_HOST_CHECKS

Returns:None
stop_accepting_passive_svc_checks()[source]

Disable passive service check submission (globally) Format of the line that triggers function call:

STOP_ACCEPTING_PASSIVE_SVC_CHECKS

Returns:None
stop_executing_host_checks()[source]

Disable host check execution (globally) Format of the line that triggers function call:

STOP_EXECUTING_HOST_CHECKS

Returns:None
stop_executing_svc_checks()[source]

Disable service check execution (globally) Format of the line that triggers function call:

STOP_EXECUTING_SVC_CHECKS

Returns:None

alignak.graph module

This modules provide Graph class. Used to check for loop into dependencies

class alignak.graph.Graph[source]

Bases: object

Graph is a class to make graph things like DFS checks or accessibility Why use an atomic bomb when a little hammer is enough? Graph are oriented.

add_edge(from_node, to_node)[source]

Add edge between two node The edge is oriented

Parameters:
  • from_node (object) – node where edge starts
  • to_node (object) – node where edge ends
Returns:

None

add_node(node)[source]

Create the node key into the mode dict with [] value

Parameters:node (object) – node to add
Returns:None
add_nodes(nodes)[source]

Add several nodes into the nodes dict

Parameters:nodes (object) – nodes to add
Returns:None
dfs_get_all_childs(root)[source]

Recursively get all sons of this node

Parameters:root – node to get sons
Returns:sons
Return type:list

Main algorithm to look for loop. It tags nodes and find ones stuck in loop.

  • Init all nodes with DFS_UNCHECKED value
  • DFS_TEMPORARY_CHECKED means we found it once
  • DFS_OK : this node (and all sons) are fine
  • DFS_NEAR_LOOP : One problem was found in of of the son
  • DFS_LOOP_INSIDE : This node is part of a loop
Parameters:root – Root of the dependency tree
Returns:None
get_accessibility_packs()[source]

Get accessibility packs of the graph: in one pack element are related in a way. Between packs, there is no relation at all. TODO: Make it work for directional graph too Because for now, edge must be father->son AND son->father

Returns:packs of nodes
Return type:list
loop_check()[source]

Check if we have a loop in the graph

Returns:Nodes in loop
Return type:list

alignak.load module

alignak.log module

This module provides logging facilities for Alignak: - a main root logger for the running daemon - a monitoring log logger

It defines a colored stream handler class to allow using colored log. Using this class is as follows: alignak.log.ColorStreamHandler

It defines a CollectorHandler class that is used to easily capture the log events for the unit tests.

It also defines a UTC time formatter usable as alignak.log.UTCFormatter

The setup_logger function initializes the daemon logger with the JSON provided configuration file.

The make_monitoring_log function emits a log to the monitoring log logger and returns a brok for the Alignak broker.

class alignak.log.CollectorHandler[source]

Bases: logging.Handler

This logging handler collects all the emitted logs in an inner list.

Note: This s only used for unit tests purpose

emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class alignak.log.ColorStreamHandler(stream=None)[source]

Bases: logging.StreamHandler

This logging handler provides colored logs when logs are emitted to a tty.

emit(record)[source]

Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

class alignak.log.UTCFormatter(fmt=None, datefmt=None)[source]

Bases: logging.Formatter

This logging formatter converts the log date/time to UTC

converter()
gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
tm_sec, tm_wday, tm_yday, tm_isdst)

Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a. GMT). When ‘seconds’ is not passed in, convert the current time instead.

alignak.log.get_log_level()[source]

Get the Alignak logger log level. This is used when getting the daemon log level thanks to the WS interface

Returns:n/a
alignak.log.make_monitoring_log(level, message, timestamp=None, to_logger=False)[source]

Function used to build the monitoring log.

Emit a log message with the provided level to the monitoring log logger. Build a Brok typed as monitoring_log with the provided message

When to_logger is True, the information is sent to the python logger, else a monitoring_log Brok is returned. The Brok is managed by the daemons to build an Event that will br logged by the Arbiter when it collects all the events.

TODO: replace with dedicated brok for each event to log - really useful?

Parameters:
  • level (str) – log level as defined in logging
  • message (str) – message to send to the monitoring log logger
  • to_logger (bool) – when set, send to the logger, else raise a brok
  • timestamp – if set, force the log event timestamp
Returns:

a monitoring_log Brok

Return type:

alignak.brok.Brok

alignak.log.set_log_console(log_level=20)[source]

Set the Alignak daemons logger have a console log handler.

This is only used for the arbiter verify mode to add a console log handler.

Parameters:log_level – log level
Returns:n/a
alignak.log.set_log_level(log_level=20, handlers=None)[source]

Set the Alignak logger log level. This is mainly used for the arbiter verify code to set the log level at INFO level whatever the configured log level is set.

This is also used when changing the daemon log level thanks to the WS interface

If an handlers name list is provided, all the handlers which name is in this list are concerned else only the daemons handler log level is changed.

Parameters:
  • handlers – list of concerned handlers
  • log_level – log level
Type:

list

Returns:

n/a

alignak.log.setup_logger(logger_configuration_file, log_dir=None, process_name='', log_file='')[source]

Configure the provided logger - get and update the content of the Json configuration file - configure the logger with this file

If a log_dir and process_name are provided, the format and filename in the configuration file are updated with the provided values if they contain the patterns %(logdir)s and %(daemon)s

If no log_dir and process_name are provided, this function will truncate the log file defined in the configuration file.

If a log file name is provided, it will override the default defined log file name.

At first, this function checks if the logger is still existing and initialized to update the handlers and formatters. This mainly happens during the unit tests.

Parameters:
  • logger_configuration_file – Python Json logger configuration file
  • log_dir – default log directory to update the defined logging handlers
  • process_name – process name to update the defined logging formatters
  • log_file – log file name to update the defined log file
Rtype logger_configuration_file:
 

str

Rtype log_dir:

str

Rtype process_name:
 

str

Rtype log_file:

str

Returns:

None

alignak.macroresolver module

This class resolve Macro in commands by looking at the macros list in Class of elements. It gives a property that may be a callable or not.

It not callable, it’s a simple property and we replace the macro with the property value.

If callable, it’s a method that is called to get the value. For example, to get the number of service in a host, you call a method to get the len(host.services)

class alignak.macroresolver.MacroResolver[source]

Bases: alignak.borg.Borg

MacroResolver class is used to resolve macros (in command call). See above for details

get_env_macros(data)[source]

Get all environment macros from data For each object in data

* Fetch all macros in object.__class__.macros
* Fetch all customs macros in o.custom
Parameters:data – data to get macro
Returns:dict with macro name as key and macro value as value
Return type:dict
init(conf)[source]

Initialize MacroResolver instance with conf. Must be called at least once.

Parameters:conf (alignak.objects.Config) – configuration to load
Returns:None
macros = {'DATE': '_get_date', 'EVENTSTARTTIME': '_get_events_start_time', 'LONGDATETIME': '_get_long_date_time', 'PROCESSSTARTTIME': '_get_process_start_time', 'SHORTDATETIME': '_get_short_date_time', 'TIME': '_get_time', 'TIMET': '_get_timet', 'TOTALHOSTPROBLEMS': '_get_total_hosts_problems', 'TOTALHOSTPROBLEMSUNHANDLED': '_get_total_hosts_problems_unhandled', 'TOTALHOSTS': '_get_total_hosts', 'TOTALHOSTSDOWN': '_get_total_hosts_down', 'TOTALHOSTSDOWNUNHANDLED': '_get_total_hosts_down_unhandled', 'TOTALHOSTSUNREACHABLE': '_get_total_hosts_unreachable', 'TOTALHOSTSUNREACHABLEUNHANDLED': '_get_total_hosts_unreachable_unhandled', 'TOTALHOSTSUP': '_get_total_hosts_up', 'TOTALSERVICEPROBLEMS': '_get_total_services_problems', 'TOTALSERVICEPROBLEMSUNHANDLED': '_get_total_services_problems_unhandled', 'TOTALSERVICES': '_get_total_services', 'TOTALSERVICESCRITICAL': '_get_total_services_critical', 'TOTALSERVICESCRITICALUNHANDLED': '_get_total_services_critical_unhandled', 'TOTALSERVICESOK': '_get_total_services_ok', 'TOTALSERVICESUNKNOWN': '_get_total_services_unknown', 'TOTALSERVICESUNKNOWNUNHANDLED': '_get_total_services_unknown_unhandled', 'TOTALSERVICESUNREACHABLE': '_get_total_services_unreachable', 'TOTALSERVICESWARNING': '_get_total_services_warning', 'TOTALSERVICESWARNINGUNHANDLED': '_get_total_services_warning_unhandled'}
my_type = 'macroresolver'
output_macros = ['HOSTOUTPUT', 'HOSTPERFDATA', 'HOSTACKAUTHOR', 'HOSTACKCOMMENT', 'SERVICEOUTPUT', 'SERVICEPERFDATA', 'SERVICEACKAUTHOR', 'SERVICEACKCOMMENT']
resolve_command(com, data, macromodulations, timeperiods)[source]

Resolve command macros with data

Parameters:
  • com (object) – check / event handler or command call object
  • data – objects list, used to search for a specific macro (custom or object related)
  • macromodulations (dict) – the available macro modulations
  • timeperiods (dict) – the available timeperiods
Returns:

command line with ‘$MACRO$’ replaced with values

Return type:

str

resolve_simple_macros_in_string(c_line, data, macromodulations, timeperiods, args=None)[source]

Replace macro in the command line with the real value

Parameters:
  • c_line (str) – command line to modify
  • data – objects list, use to look for a specific macro
  • macromodulations (dict) – the available macro modulations
  • timeperiods (dict) – the available timeperiods
  • args – args given to the command line, used to get “ARGN” macros.
Returns:

command line with ‘$MACRO$’ replaced with values

Return type:

str

alignak.message module

This module provides Message class. Used for communication between daemon process (with queues)

class alignak.message.Message(_type, data=None, source=None)[source]

Bases: object

This is a simple message class for communications between actionners and workers

get_data()[source]

Getter of _data attribute

Returns:Message data
Return type:str
get_source()[source]

Getter of _source attribute

Returns:Message from (actionner/worker name)
Return type:str
get_type()[source]

Getter of _type attribute

Returns:Message type
Return type:str
my_type = 'message'

alignak.modulesmanager module

This module provides ModulesManager class. Used to load modules in Alignak

class alignak.modulesmanager.ModulesManager(daemon)[source]

Bases: object

This class is used to manage modules and call callback

check_alive_instances()[source]

Check alive instances. If not, log error and try to restart it

Returns:None
clear_instances(instances=None)[source]

Request to “remove” the given instances list or all if not provided

Parameters:instances – instances to remove (all instances are removed if None)
Returns:None
get_external_instances(phase=None)[source]

Get a list of external instances (in a specific phase)

If phase is None, return all external instances whtever the phase

Parameters:phase – phase to filter (never used)
Returns:external instances list
Return type:list
get_instances()[source]

Create, init and then returns the list of module instances that the caller needs.

This method is called once the Python modules are loaded to initialize the modules.

If an instance can’t be created or initialized then only log is doneand that instance is skipped. The previous modules instance(s), if any, are all cleaned.

Returns:module instances list
Return type:list
get_internal_instances(phase=None)[source]

Get a list of internal instances (in a specific phase)

If phase is None, return all internal instances whtever the phase

Parameters:phase – phase to filter (never used)
Returns:internal instances list
Return type:list
load(modules)[source]

Load Python modules and check their usability

Parameters:modules – list of the modules that must be loaded
Returns:
load_and_init(modules)[source]

Import, instantiate & “init” the modules we manage

Parameters:modules – list of the managed modules
Returns:True if no errors
remove_instance(instance)[source]

Request to cleanly remove the given instance. If instance is external also shutdown it cleanly

Parameters:instance (object) – instance to remove
Returns:None
set_daemon_name(daemon_name)[source]

Set the daemon name of the daemon which this manager is attached to and propagate this daemon name to our managed modules

Parameters:daemon_name
Returns:
set_to_restart(instance)[source]

Put an instance to the restart queue

Parameters:instance (object) – instance to restart
Returns:None
start_external_instances(late_start=False)[source]

Launch external instances that are load correctly

Parameters:late_start (bool) – If late_start, don’t look for last_init_try
Returns:None
stop_all()[source]

Stop all module instances

Returns:None
try_instance_init(instance, late_start=False)[source]

Try to “initialize” the given module instance.

Parameters:
  • instance (object) – instance to init
  • late_start (bool) – If late_start, don’t look for last_init_try
Returns:

True on successful init. False if instance init method raised any Exception.

Return type:

bool

try_to_restart_deads()[source]

Try to reinit and restart dead instances

Returns:None

alignak.monitor module

This module group the Alignak self monitoring features.

Currently, it contains an Alignak Web Service client used to report Alignak status to an external monitoring application

class alignak.monitor.MonitorConnection(endpoint='http://127.0.0.1:7773/ws')[source]

Bases: object

Base class for Alignak Web Services client connection

static decode(response)[source]

Decodes and returns the response as JSON (dict) or raise BackendException :param response: requests.response object :return: dict

get(endpoint, params=None)[source]

Get items or item in alignak backend

If an error occurs, a BackendException is raised.

This method builds a response as a dictionary that always contains: _items and _status:

{
    u'_items': [
        ...
    ],
    u'_status': u'OK'
}
Parameters:
  • endpoint (str) – endpoint (API URL) relative from root endpoint
  • params (dict) – parameters for the backend API
Returns:

dictionary as specified upper

Return type:

dict

get_response(method, endpoint, headers=None, json=None, params=None, data=None)[source]

Returns the response from the requested endpoint with the requested method :param method: str. one of the methods accepted by Requests (‘POST’, ‘GET’, …) :param endpoint: str. the relative endpoint to access :param params: (optional) Dictionary or bytes to be sent in the query string for the Request. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the Request. :param json: (optional) json to send in the body of the Request. :param headers: (optional) Dictionary of HTTP Headers to send with the Request. :return: Requests.response

get_token()[source]

Get the stored backend token

get_url(endpoint)[source]

Returns the formated full URL endpoint :param endpoint: str. the relative endpoint to access :return: str

login(username, password)[source]

Log into the WS interface and get the authentication token

if login is: - accepted, returns True - refused, returns False

In case of any error, raises a BackendException

Parameters:
  • username (str) – login name
  • password (str) – password
  • generate (str) – Can have these values: enabled | force | disabled
Returns:

return True if authentication is successfull, otherwise False

Return type:

bool

logout()[source]

Logout from the backend

Returns:return True if logout is successfull, otherwise False
Return type:bool
patch(endpoint, data)[source]

Method to update an item

The headers must include an If-Match containing the object _etag.
headers = {‘If-Match’: contact_etag}

The data dictionary contain the fields that must be modified.

If the patching fails because the _etag object do not match with the provided one, a BackendException is raised with code = 412.

If inception is True, this method makes e new get request on the endpoint to refresh the _etag and then a new patch is called.

If an HTTP 412 error occurs, a BackendException is raised. This exception is: - code: 412 - message: response content - response: backend response

All other HTTP error raises a BackendException. If some _issues are provided by the backend, this exception is: - code: HTTP error code - message: response content - response: JSON encoded backend response (including ‘_issues’ dictionary …)

If no _issues are provided and an _error is signaled by the backend, this exception is: - code: backend error code - message: backend error message - response: JSON encoded backend response

Parameters:
  • endpoint (str) – endpoint (API URL)
  • data (dict) – properties of item to update
  • headers (dict) – headers (example: Content-Type). ‘If-Match’ required
  • inception (bool) – if True tries to get the last _etag
Returns:

dictionary containing patch response from the backend

Return type:

dict

post(endpoint, data, files=None, headers=None)[source]

Create a new item

Parameters:
  • endpoint (str) – endpoint (API URL)
  • data (dict) – properties of item to create
  • files (None) – Not used. To be implemented
  • headers (dict) – headers (example: Content-Type)
Returns:

response (creation information)

Return type:

dict

set_token(token)[source]

Set token in authentification for next requests :param token: str. token to set in auth. If None, reinit auth

token

Get the stored backend token

alignak.notification module

This module provides Notification class. Used to define monitoring notifications (email, contacts..)

class alignak.notification.Notification(params=None, parsing=False)[source]

Bases: alignak.action.Action

Notification class, inherits from action class. Used to notify contacts and execute notification command defined in configuration

ack_author
ack_data
already_start_escalations
author
author_alias
author_comment
author_name
check_time
command
command_call
contact
contact_name
creation_time
enable_environment_macros
end_time
env
escalated
execution_time
exit_status
fill_data_brok_from(data, brok_type)[source]

Fill data with info of item by looking at brok_type in props of properties or running_properties

Parameters:
  • data – data to fill
  • brok_type – type of brok
Returns:

brok with wanted data

Return type:

alignak.brok.Brok

get_initial_status_brok()[source]

Get a initial status brok

Returns:brok with wanted data
Return type:alignak.brok.Brok
get_return_from(notif)[source]

Setter of exit_status and execution_time attributes

Parameters:notif (alignak.notification.Notification) – notification to get data from
Returns:None
host_name
internal
is_a
is_administrative()[source]

Check if this notification is “administrative”

Returns:True in type not in (‘PROBLEM’, ‘RECOVERY’), False otherwise
Return type:bool
last_poll
long_output
macros = {'HOSTNOTIFICATIONID': 'uuid', 'HOSTNOTIFICATIONNUMBER': 'notif_nb', 'NOTIFICATIONAUTHOR': 'author', 'NOTIFICATIONAUTHORALIAS': 'author_alias', 'NOTIFICATIONAUTHORNAME': 'author_name', 'NOTIFICATIONCOMMENT': 'author_comment', 'NOTIFICATIONID': 'uuid', 'NOTIFICATIONISESCALATED': 'escalated', 'NOTIFICATIONNUMBER': 'notif_nb', 'NOTIFICATIONRECIPIENTS': 'recipients', 'NOTIFICATIONTYPE': 'type', 'SERVICENOTIFICATIONID': 'uuid', 'SERVICENOTIFICATIONNUMBER': 'notif_nb'}
module_type
my_scheduler
my_type = 'notification'
my_worker
notif_nb
output
perf_data
properties = {'_in_timeout': <Property <class 'alignak.property.BoolProp'>, default: False />, '_is_orphan': <Property <class 'alignak.property.BoolProp'>, default: False />, 'ack_author': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'ack_data': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'already_start_escalations': <Property <class 'alignak.property.SetProp'>, default: set([]) />, 'author': <Property <class 'alignak.property.StringProp'>, default: u'n/a' />, 'author_alias': <Property <class 'alignak.property.StringProp'>, default: u'n/a' />, 'author_comment': <Property <class 'alignak.property.StringProp'>, default: u'n/a' />, 'author_name': <Property <class 'alignak.property.StringProp'>, default: u'n/a' />, 'check_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'command': <Property <class 'alignak.property.StringProp'>, default: u'UNSET' />, 'command_call': <Property <class 'alignak.property.StringProp'>, default: None />, 'contact': <Property <class 'alignak.property.StringProp'>, default: None />, 'contact_name': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'creation_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'enable_environment_macros': <Property <class 'alignak.property.BoolProp'>, default: False />, 'end_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'env': <Property <class 'alignak.property.DictProp'>, default: {} />, 'escalated': <Property <class 'alignak.property.BoolProp'>, default: False />, 'execution_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'exit_status': <Property <class 'alignak.property.IntegerProp'>, default: 3 />, 'host_name': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'internal': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_a': <Property <class 'alignak.property.StringProp'>, default: u'notification' />, 'last_poll': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'long_output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'module_type': <Property <class 'alignak.property.StringProp'>, default: u'fork' />, 'my_scheduler': <Property <class 'alignak.property.StringProp'>, default: u'unassigned' />, 'my_worker': <Property <class 'alignak.property.StringProp'>, default: u'none' />, 'notif_nb': <Property <class 'alignak.property.IntegerProp'>, default: 1 />, 'output': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'perf_data': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'reactionner_tag': <Property <class 'alignak.property.StringProp'>, default: u'None' />, 'reason_type': <Property <class 'alignak.property.IntegerProp'>, default: 1 />, 'recipients': <Property <class 'alignak.property.ListProp'>, default: [] />, 'ref': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 'ref_type': <Property <class 'alignak.property.StringProp'>, default: u'unset' />, 's_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'service_description': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'start_time': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'state': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'status': <Property <class 'alignak.property.StringProp'>, default: u'scheduled' />, 't_to_go': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'timeout': <Property <class 'alignak.property.IntegerProp'>, default: 10 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'PROBLEM' />, 'u_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'wait_time': <Property <class 'alignak.property.FloatProp'>, default: 0.001 />}
reactionner_tag
reason_type
recipients
ref
ref_type
s_time
serialize()[source]

This function serialize into a simple dict object. It is used when transferring data to other daemons over the network (http)

Here we directly return all attributes

Returns:json representation of a Timeperiod
Return type:dict
service_description
start_time
state
status
t_to_go
timeout
type
u_time
wait_time

alignak.property module

This module provides property classes. It is used during configuration parsing to ensure attribute type in objects. Each class implements a pythonize method that cast data into the wanted type.

class alignak.property.UnusedProp(text=None)[source]

Bases: alignak.property.Property

A unused Property. These are typically used by Nagios but no longer useful/used by Alignak.

This is just to warn the user that the option he uses is no more used in Alignak.

class alignak.property.BoolProp(default=<object object>, class_inherit=None, unmanaged=False, _help='', no_slots=False, fill_brok=None, brok_transformation=None, retention=False, retention_preparation=None, retention_restoration=None, to_send=False, override=False, managed=True, split_on_comma=True, keep_empty=False, merging='uniq', special=False)[source]

Bases: alignak.property.Property

A Boolean Property.

Boolean values are currently case insensitively defined as 0, false, no, off for False, and 1, true, yes, on for True).

pythonize(val)[source]

Convert value into a boolean

Parameters:val (bool, int, str) – value to convert
Returns:boolean corresponding to value
{‘1’: True, ‘yes’: True, ‘true’: True, ‘on’: True,
‘0’: False, ‘no’: False, ‘false’: False, ‘off’: False}
Return type:bool
class alignak.property.IntegerProp(default=<object object>, class_inherit=None, unmanaged=False, _help='', no_slots=False, fill_brok=None, brok_transformation=None, retention=False, retention_preparation=None, retention_restoration=None, to_send=False, override=False, managed=True, split_on_comma=True, keep_empty=False, merging='uniq', special=False)[source]

Bases: alignak.property.Property

Integer property

pythonize(val)[source]

Convert value into an integer:

* If value is a list, try to take the last element
* Then call float(int(val))
Parameters:val – value to convert
Returns:integer corresponding to value
Return type:int
class alignak.property.FloatProp(default=<object object>, class_inherit=None, unmanaged=False, _help='', no_slots=False, fill_brok=None, brok_transformation=None, retention=False, retention_preparation=None, retention_restoration=None, to_send=False, override=False, managed=True, split_on_comma=True, keep_empty=False, merging='uniq', special=False)[source]

Bases: alignak.property.Property

Float property

pythonize(val)[source]

Convert value into a float:

* If value is a list, try to take the last element
* Then call float(val)
Parameters:val – value to convert
Returns:float corresponding to value
Return type:float
class alignak.property.CharProp(default=<object object>, class_inherit=None, unmanaged=False, _help='', no_slots=False, fill_brok=None, brok_transformation=None, retention=False, retention_preparation=None, retention_restoration=None, to_send=False, override=False, managed=True, split_on_comma=True, keep_empty=False, merging='uniq', special=False)[source]

Bases: alignak.property.Property

One character string property

pythonize(val)[source]

Convert value into a char

* If value is a list try, to take the last element
* Then take the first char of val (first elem)
Parameters:val – value to convert
Returns:char corresponding to value
Return type:str
class alignak.property.StringProp(default=<object object>, class_inherit=None, unmanaged=False, _help='', no_slots=False, fill_brok=None, brok_transformation=None, retention=False, retention_preparation=None, retention_restoration=None, to_send=False, override=False, managed=True, split_on_comma=True, keep_empty=False, merging='uniq', special=False)[source]

Bases: alignak.property.Property

String property

pythonize(val)[source]

Convert value into a string:

* If value is a list, try to take the last element
Parameters:val – value to convert
Returns:str corresponding to value
Return type:str
class alignak.property.ListProp(default=<object object>, class_inherit=None, unmanaged=False, _help='', no_slots=False, fill_brok=None, brok_transformation=None, retention=False, retention_preparation=None, retention_restoration=None, to_send=False, override=False, managed=True, split_on_comma=True, keep_empty=False, merging='uniq', special=False)[source]

Bases: alignak.property.Property

List property

pythonize(val)[source]

Convert value into a list:

* split value (or each element if value is a list) on coma char
* strip split values
Parameters:val (str) – value to convert
Returns:list corresponding to value
Return type:list
class alignak.property.DictProp(elts_prop=None, *args, **kwargs)[source]

Bases: alignak.property.Property

Dict property

pythonize(val)[source]

Convert value into a dict:

* If value is a list, try to take the last element
* split "key=value" string and convert to { key:value }
Parameters:val – value to convert
Returns:log level corresponding to value
Return type:str

alignak.satellite module

This class is an interface for Reactionner and Poller daemons A Reactionner listens to a port for the configuration from the Arbiter The conf contains the schedulers where actionners will gather actions.

The Reactionner keeps on listening to the Arbiter

If Arbiter wants it to have a new conf, the satellite forgets the previous
Schedulers (and actions into) and takes the new ones.
class alignak.satellite.BaseSatellite(name, **kwargs)[source]

Bases: alignak.daemon.Daemon

Base Satellite class. Sub-classed by Alignak (scheduler), Broker and Satellite

clean_previous_run()[source]

Clean variables from previous configuration, such as schedulers, broks and external commands

Returns:None
do_loop_turn()[source]

Satellite main loop - not implemented for a BaseSatellite

get_daemon_stats(details=False)[source]

Increase the stats provided by the Daemon base class

Returns:stats dictionary
Return type:dict
get_events()[source]

Get event list from satellite

Returns:A copy of the events list
Return type:list
get_external_commands()[source]

Get the external commands

Returns:External commands list
Return type:list
get_managed_configurations()[source]

Get the configurations managed by this satellite

The configurations managed by a satellite is a list of the configuration attached to the schedulers related to the satellites. A broker linked to several schedulers will return the list of the configuration parts of its scheduler links.

Returns:a dict of scheduler links with instance_id as key and

hash, push_flavor and configuration identifier as values :rtype: dict

get_results_from_passive(scheduler_instance_id)[source]

Get executed actions results from a passive satellite for a specific scheduler

Parameters:scheduler_instance_id (int) – scheduler id
Returns:Results list
Return type:list
get_scheduler_from_hostname(host_name)[source]

Get scheduler linked to the given host_name

Parameters:host_name (str) – host_name we want the scheduler from
Returns:scheduler with id corresponding to the mapping table
Return type:dict
properties = {'active': <Property <class 'alignak.property.BoolProp'>, default: True />, 'address': <Property <class 'alignak.property.StringProp'>, default: u'127.0.0.1' />, 'alignak_monitor': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'alignak_monitor_password': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'alignak_monitor_period': <Property <class 'alignak.property.IntegerProp'>, default: 60 />, 'alignak_monitor_username': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'bindir': <Property <class 'alignak.property.PathProp'>, default: '' />, 'ca_cert': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'daemon': <Property <class 'alignak.property.StringProp'>, default: u'unknown' />, 'debug': <Property <class 'alignak.property.BoolProp'>, default: False />, 'do_replace': <Property <class 'alignak.property.BoolProp'>, default: False />, 'env_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'etcdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'favicon': <Property <class 'alignak.property.PathProp'>, default: '' />, 'graphite_enabled': <Property <class 'alignak.property.BoolProp'>, default: False />, 'group': <Property <class 'alignak.property.StringProp'>, default: 'docs' />, 'hard_ssl_name_check': <Property <class 'alignak.property.BoolProp'>, default: False />, 'host': <Property <class 'alignak.property.StringProp'>, default: u'127.0.0.1' />, 'host_name': <Property <class 'alignak.property.StringProp'>, default: u'localhost' />, 'idontcareaboutsecurity': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_daemon': <Property <class 'alignak.property.BoolProp'>, default: False />, 'log_cherrypy': <Property <class 'alignak.property.BoolProp'>, default: False />, 'log_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'log_level': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'log_loop': <Property <class 'alignak.property.BoolProp'>, default: False />, 'logdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'logger_configuration': <Property <class 'alignak.property.StringProp'>, default: u'./alignak-logger.json' />, 'max_queue_size': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'maximum_loop_duration': <Property <class 'alignak.property.FloatProp'>, default: 1.0 />, 'modules': <Property <class 'alignak.property.ListProp'>, default: [] />, 'name': <Property <class 'alignak.property.StringProp'>, default: <object object> />, 'pause_duration': <Property <class 'alignak.property.FloatProp'>, default: 0.5 />, 'pid_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'server_cert': <Property <class 'alignak.property.StringProp'>, default: u'etc/certs/server.cert' />, 'server_dh': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'server_key': <Property <class 'alignak.property.StringProp'>, default: u'etc/certs/server.key' />, 'spare': <Property <class 'alignak.property.BoolProp'>, default: False />, 'start_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'statsd_enabled': <Property <class 'alignak.property.BoolProp'>, default: False />, 'statsd_host': <Property <class 'alignak.property.StringProp'>, default: u'localhost' />, 'statsd_port': <Property <class 'alignak.property.IntegerProp'>, default: 8125 />, 'statsd_prefix': <Property <class 'alignak.property.StringProp'>, default: u'alignak' />, 'thread_pool_size': <Property <class 'alignak.property.IntegerProp'>, default: 32 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'unknown' />, 'use_ssl': <Property <class 'alignak.property.BoolProp'>, default: False />, 'user': <Property <class 'alignak.property.StringProp'>, default: 'docs' />, 'vardir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'verbose': <Property <class 'alignak.property.BoolProp'>, default: False />, 'workdir': <Property <class 'alignak.property.PathProp'>, default: '/' />}
setup_new_conf()[source]

Setup the new configuration received from Arbiter

This function is the generic treatment needed for every Alignak daemon when it receivss a new configuration from the Arbiter: - save the new configuration - dump the main configuration elements - get its own configuration (self_conf) - get its name and update the process title - set the timezone if needed - register its statistics manager - get and configure its arbiters and schedulers relation

Setting the self.new_conf as None is to indicate that the new configuration has been managed.

Note: it is important to protect the configuration management thanks to a lock!

Returns:None
exception alignak.satellite.NotWorkerMod[source]

Bases: exceptions.Exception

Class to tell that we are facing a non worker module but a standard one

class alignak.satellite.Satellite(name, **kwargs)[source]

Bases: alignak.satellite.BaseSatellite

Satellite class. Sub-classed by Receiver, Reactionner and Poller

add(elt)[source]

Generic function to add objects to the daemon internal lists. Manage Broks, External commands

Parameters:elt (alignak.AlignakObject) – object to add
Returns:None
add_actions(actions_list, scheduler_instance_id)[source]

Add a list of actions to the satellite queues

Parameters:
  • actions_list (list) – Actions list to add
  • scheduler_instance_id (SchedulerLink) – sheduler link to assign the actions to
Returns:

None

adjust_worker_number_by_load()[source]

Try to create the minimum workers specified in the configuration

Returns:None
assign_to_a_queue(action)[source]

Take an action and put it to a worker actions queue

Parameters:action (alignak.action.Action) – action to put
Returns:None
check_and_del_zombie_workers()[source]

Check if worker are fine and kill them if not. Dispatch the actions in the worker to another one

TODO: see if unit tests would allow to check this code?

Returns:None
clean_previous_run()[source]

Clean variables from previous configuration, such as schedulers, broks and external commands

Returns:None
create_and_launch_worker(module_name='fork')[source]
Create and launch a new worker, and put it into self.workers
It can be mortal or not
Parameters:module_name (str) – the module name related to the worker default is “fork” for no module Indeed, it is actually the module ‘python_name’
Returns:None
do_actions = False
do_checks = False
do_get_new_actions()[source]

Get new actions from schedulers Create a Message and put into the module queue REF: doc/alignak-action-queues.png (1)

Returns:None
do_loop_turn()[source]

Satellite main loop:

* Check and delete zombies actions / modules
* Get returns from queues
* Adjust worker number
* Get new actions
Returns:None
do_post_daemon_init()[source]

Do this satellite (poller or reactionner) post “daemonize” init

Returns:None
do_stop()[source]

Stop my workers and stop

Returns:None
do_stop_workers()[source]

Stop all workers

Returns:None
get_broks()[source]

Get brok list from satellite

Returns:A copy of the broks list
Return type:list
get_daemon_stats(details=False)[source]

Increase the stats provided by the Daemon base class

Returns:stats dictionary
Return type:dict
get_new_actions()[source]

Wrapper function for do_get_new_actions For stats purpose

Returns:None

TODO: Use a decorator for timing this function

main()[source]

Main satellite function. Do init and then mainloop

Returns:None
manage_action_return(action)[source]

Manage action return from Workers We just put them into the corresponding sched and we clean unused properties like my_scheduler

Parameters:action (alignak.action.Action) – the action to manage
Returns:None
my_type = ''
properties = {'active': <Property <class 'alignak.property.BoolProp'>, default: True />, 'address': <Property <class 'alignak.property.StringProp'>, default: u'127.0.0.1' />, 'alignak_monitor': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'alignak_monitor_password': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'alignak_monitor_period': <Property <class 'alignak.property.IntegerProp'>, default: 60 />, 'alignak_monitor_username': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'bindir': <Property <class 'alignak.property.PathProp'>, default: '' />, 'ca_cert': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'daemon': <Property <class 'alignak.property.StringProp'>, default: u'unknown' />, 'debug': <Property <class 'alignak.property.BoolProp'>, default: False />, 'do_replace': <Property <class 'alignak.property.BoolProp'>, default: False />, 'env_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'etcdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'favicon': <Property <class 'alignak.property.PathProp'>, default: '' />, 'graphite_enabled': <Property <class 'alignak.property.BoolProp'>, default: False />, 'group': <Property <class 'alignak.property.StringProp'>, default: 'docs' />, 'hard_ssl_name_check': <Property <class 'alignak.property.BoolProp'>, default: False />, 'host': <Property <class 'alignak.property.StringProp'>, default: u'127.0.0.1' />, 'host_name': <Property <class 'alignak.property.StringProp'>, default: u'localhost' />, 'idontcareaboutsecurity': <Property <class 'alignak.property.BoolProp'>, default: False />, 'is_daemon': <Property <class 'alignak.property.BoolProp'>, default: False />, 'log_cherrypy': <Property <class 'alignak.property.BoolProp'>, default: False />, 'log_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'log_level': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'log_loop': <Property <class 'alignak.property.BoolProp'>, default: False />, 'logdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'logger_configuration': <Property <class 'alignak.property.StringProp'>, default: u'./alignak-logger.json' />, 'max_plugins_output_length': <Property <class 'alignak.property.IntegerProp'>, default: 8192 />, 'max_queue_size': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'max_workers': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'maximum_loop_duration': <Property <class 'alignak.property.FloatProp'>, default: 1.0 />, 'min_workers': <Property <class 'alignak.property.IntegerProp'>, default: 0 />, 'modules': <Property <class 'alignak.property.ListProp'>, default: [] />, 'name': <Property <class 'alignak.property.StringProp'>, default: <object object> />, 'passive': <Property <class 'alignak.property.BoolProp'>, default: False />, 'pause_duration': <Property <class 'alignak.property.FloatProp'>, default: 0.5 />, 'pid_filename': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'poller_tags': <Property <class 'alignak.property.ListProp'>, default: ['None'] />, 'processes_by_worker': <Property <class 'alignak.property.IntegerProp'>, default: 256 />, 'reactionner_tags': <Property <class 'alignak.property.ListProp'>, default: ['None'] />, 'server_cert': <Property <class 'alignak.property.StringProp'>, default: u'etc/certs/server.cert' />, 'server_dh': <Property <class 'alignak.property.StringProp'>, default: u'' />, 'server_key': <Property <class 'alignak.property.StringProp'>, default: u'etc/certs/server.key' />, 'spare': <Property <class 'alignak.property.BoolProp'>, default: False />, 'start_time': <Property <class 'alignak.property.FloatProp'>, default: 0.0 />, 'statsd_enabled': <Property <class 'alignak.property.BoolProp'>, default: False />, 'statsd_host': <Property <class 'alignak.property.StringProp'>, default: u'localhost' />, 'statsd_port': <Property <class 'alignak.property.IntegerProp'>, default: 8125 />, 'statsd_prefix': <Property <class 'alignak.property.StringProp'>, default: u'alignak' />, 'thread_pool_size': <Property <class 'alignak.property.IntegerProp'>, default: 32 />, 'type': <Property <class 'alignak.property.StringProp'>, default: u'unknown' />, 'use_ssl': <Property <class 'alignak.property.BoolProp'>, default: False />, 'user': <Property <class 'alignak.property.StringProp'>, default: 'docs' />, 'vardir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'verbose': <Property <class 'alignak.property.BoolProp'>, default: False />, 'workdir': <Property <class 'alignak.property.PathProp'>, default: '/' />, 'worker_polling_interval': <Property <class 'alignak.property.IntegerProp'>, default: 1 />}
push_results()[source]

Push the checks/actions results to our schedulers

Returns:None
setup_new_conf()[source]

Setup the new configuration received from Arbiter

This function calls the base satellite treatment and manages the configuration needed for a simple satellite daemon that executes some actions (eg. poller or reactionner): - configure the passive mode - configure the workers - configure the tags - configure the modules

Returns:None

alignak.scheduler module

This module provides Scheduler class. It is used to schedule checks, create broks for monitoring event, handle downtime, problems / acknowledgment etc. The major part of monitoring “intelligence” is in this module.

class alignak.scheduler.Scheduler(scheduler_daemon)[source]

Bases: object

Scheduler class. Mostly handle scheduling items (host service) to schedule checks raise alerts, manage downtimes, etc.

add(elt)[source]

Generic function to add objects into the scheduler daemon internal lists:: Brok -> self.broks Check -> self.checks Notification -> self.actions EventHandler -> self.actions

For an ExternalCommand, tries to resolve the command

Parameters:elt – element to add
Returns:None
add_brok(brok, broker_uuid=None)[source]

Add a brok into brokers list It can be for a specific one, all brokers or none (startup)

Parameters:
Returns:

None

add_check(check)[source]

Add a check into the scheduler checks list

Parameters:check (alignak.check.Check) – check to add
Returns:None
add_event_handler(action)[source]

Add a event handler into actions list

Parameters:action (alignak.eventhandler.EventHandler) – event handler to add
Returns:None
add_external_command(ext_cmd)[source]

Resolve external command

Parameters:ext_cmd (alignak.external_command.ExternalCommand) – extermal command to run
Returns:None
add_notification(notification)[source]

Add a notification into actions list

Parameters:notification (alignak.notification.Notification) – notification to add
Returns:None
after_run()[source]

After the scheduling process

all_my_hosts_and_services()[source]

Create an iterator for all my known hosts and services

Returns:None
before_run()[source]

Initialize the scheduling process

check_for_expire_acknowledge()[source]

Iter over host and service and check if any acknowledgement has expired

Returns:None
check_freshness()[source]

Iter over all hosts and services to check freshness if check_freshness enabled and passive_checks_enabled are set

For the host items, the list of hosts to check contains hosts that: - have freshness check enabled - are not yet freshness expired - are only passively checked

For the service items, the list of services to check contains services that: - do not depend upon an host that is freshness expired - have freshness check enabled - are not yet freshness expired - are only passively checked

Returns:None
check_orphaned()[source]

Check for orphaned checks/actions:

* status == 'in_poller' and t_to_go < now - time_to_orphanage (300 by default)

if so raise a warning log.

Returns:None
clean_caches()[source]

Clean timperiods caches

Returns:None
clean_queues()[source]

Reduces internal list size to max allowed

  • checks and broks : 5 * length of hosts + services
  • actions : 5 * length of hosts + services + contacts
Returns:None
consume_results()[source]

Handle results waiting in waiting_results list. Check ref will call consume result and update their status

Returns:None
delete_zombie_actions()[source]

Remove actions that have a zombie status (usually timeouts)

Returns:None
delete_zombie_checks()[source]

Remove checks that have a zombie status (usually timeouts)

Returns:None
dump_config()[source]

Dump scheduler configuration into a temporary file

The dumped content is JSON formatted

Returns:None
dump_objects()[source]

Dump scheduler objects into a dump (temp) file

Returns:None
fill_initial_broks(broker_name)[source]

Create initial broks for a specific broker

Parameters:broker_name (str) – broker name
Returns:number of created broks
find_item_by_id(object_id)[source]

Get item based on its id or uuid

Parameters:object_id (int | str) –
Returns:
Return type:alignak.objects.item.Item | None
get_and_register_check_result_brok(item)[source]

Get a check result brok for item and add it

Parameters:item (alignak.objects.schedulingitem.SchedulingItem) – item to get brok from
Returns:None
get_and_register_status_brok(item)[source]

Get a update status brok for item and add it

Parameters:item (alignak.objects.item.Item) – item to get brok from
Returns:None
get_checks_status_counts(checks=None)[source]

Compute the counts of the different checks status and return it as a defaultdict(int) with the keys being the different status and the values being the count of the checks in that status.

Checks:None or the checks you want to count their statuses. If None then self.checks is used.
Parameters:checks (None | dict) – NoneType | dict
Returns:
Return type:defaultdict(int)
get_latency_average_percentile()[source]

Get a overview of the latencies with just a 95 percentile + min/max values

Returns:None
get_new_actions()[source]

Call ‘get_new_actions’ hook point Iter over all hosts and services to add new actions in internal lists

Returns:None
get_new_broks()[source]

Iter over all hosts and services to add new broks in internal lists

Returns:None
get_objects_from_from_queues()[source]

Same behavior than Daemon.get_objects_from_from_queues().

Returns:
Return type:
get_program_status_brok(brok_type='program_status')[source]

Create a program status brok

Initially builds the running properties and then, if initial status brok, get the properties from the Config class where an entry exist for the brok ‘full_status’

Returns:Brok with program status data
Return type:alignak.brok.Brok
get_results_from_passive_satellites()[source]

Get actions/checks results from passive poller/reactionners

Returns:None
get_retention_data()[source]

Get all hosts and services data to be sent to the retention storage.

This function only prepares the data because a module is in charge of making the data survive to the scheduler restart.

todo: Alignak scheduler creates two separate dictionaries: hosts and services It would be better to merge the services into the host dictionary!

Returns:dict containing host and service data
Return type:dict
get_scheduler_stats(details=False)[source]

Get the scheduler statistics

Returns:A dict with the following structure
{ 'modules': [
              {'internal': {'name': "MYMODULE1", 'state': 'ok'},
              {'external': {'name': "MYMODULE2", 'state': 'stopped'},
             ]
  'latency':  {'avg': lat_avg, 'min': lat_min, 'max': lat_max}
  'hosts': len(self.hosts),
  'services': len(self.services),
  'commands': [{'cmd': c, 'u_time': u_time, 's_time': s_time}, ...] (10 first)
  'livesynthesis': {...}
}
Return type:dict
get_to_run_checks(do_checks=False, do_actions=False, poller_tags=None, reactionner_tags=None, worker_name='none', module_types=None)[source]

Get actions/checks for reactionner/poller

Called by the poller to get checks (do_checks=True) and by the reactionner (do_actions=True) to get actions

Parameters:
  • do_checks (bool) – do we get checks ?
  • do_actions (bool) – do we get actions ?
  • poller_tags (list) – poller tags to filter
  • reactionner_tags (list) – reactionner tags to filter
  • worker_name (str) – worker name to fill check/action (to remember it)
  • module_types (list) – module type to filter
Returns:

Check/Action list with poller/reactionner tags matching and module type matching

Return type:

list

hook_point(hook_name)[source]

Generic function to call modules methods if such method is avalaible

Parameters:hook_name (str) – function name to call

:return:None

initial_program_status()[source]

Create and add a program_status brok

Returns:None
load_conf(instance_id, instance_name, conf)[source]

Load configuration received from Arbiter and pushed by our Scheduler daemon

Parameters:
Returns:

None

log_initial_states()[source]

Raise hosts and services initial status logs

First, raise hosts status and then services. This to allow the events log to be a little sorted.

Returns:None
manage_internal_checks()[source]

Run internal checks

Returns:None
manage_results(action)[source]

Get result from pollers/reactionners (actives ones)

Parameters:action – check / action / event handler to handle
Returns:None
name

Get the scheduler name

Indeed, we return our suffixed daemon name

Returns:
Return type:
push_actions_to_passive_satellites()[source]

Send actions/checks to passive poller/reactionners

Returns:None
reset()[source]

Reset scheduler:

* Remove waiting results
* Clear checks and actions lists
Returns:None
reset_topology_change_flag()[source]

Set topology_change attribute to False in all hosts and services

Returns:None
restore_retention_data(data)[source]

Restore retention data

Data coming from retention will override data coming from configuration It is kinda confusing when you modify an attribute (external command) and it get saved by retention

Parameters:data (dict) – data from retention
Returns:None
restore_retention_data_item(data, item)[source]

Restore data in item

Parameters:
  • data (dict) – retention data of the item
  • item (alignak.objects.host.Host | alignak.objects.service.Service) – host or service item
Returns:

None

retention_load(forced=False)[source]

Call hook point ‘load_retention’. Retention modules will read retention (from file, db etc)

Parameters:forced (bool) – is load forced?
Returns:None
run()[source]

Main scheduler function:

* Load retention
* Call 'pre_scheduler_mod_start' hook point
* Start modules
* Schedule first checks
* Init connection with pollers/reactionners
* Run main loop
  • Do recurrent works
  • Push/Get actions to passive satellites
  • Update stats
  • Call ‘scheduler_tick’ hook point
  • Save retention (on quit)
Returns:None
run_external_commands(cmds)[source]

Run external commands Arbiter/Receiver sent

Parameters:cmds (list) – commands to run
Returns:None
scatter_master_notifications()[source]

Generate children notifications from a master notification Also update notification number

Master notification are raised when a notification must be sent out. They are not launched by reactionners (only children are) but they are used to build the children notifications.

From one master notification, several children notifications may be built, indeed one per each contact…

Returns:None
schedule(elements=None)[source]

Iterate over all hosts and services and call schedule method (schedule next check)

If elements is None all our hosts and services are scheduled for a check.

Parameters:elements (None | list) – None or list of host / services to schedule
Returns:None
send_broks_to_modules()[source]

Put broks into module queues Only broks without sent_to_externals to True are sent Only modules that ask for broks will get some

Returns:None
start_scheduling()[source]

Set must_schedule attribute to True - enable the scheduling loop

Returns:None
stop_scheduling()[source]

Set must_schedule attribute to False - disable the scheduling loop

Returns:None
update_business_values()[source]

Iter over host and service and update business_impact

Returns:None
update_downtimes_and_comments()[source]

Iter over all hosts and services:

TODO: add some unit tests for the maintenance period feature.

  • Update downtime status (start / stop) regarding maintenance period
  • Register new comments in comments list
Returns:None
update_program_status()[source]

Create and add a update_program_status brok

Returns:None
update_recurrent_works_tick(conf)[source]

Modify the tick value for the scheduler recurrent work

A tick is an amount of loop of the scheduler before executing the recurrent work

The provided configuration may contain some tick-function_name keys that contain a tick value to be updated. Those parameters are defined in the alignak environment file.

Indeed this function is called with the Scheduler daemon object. Note that the conf parameter may also be a dictionary.

Parameters:conf (alignak.daemons.schedulerdaemon.Alignak) – the daemon link configuration to search in
Returns:None
update_retention()[source]

Call hook point ‘save_retention’. Retention modules will write back retention (to file, db etc)

Parameters:forced (bool) – is update forced?
Returns:None

alignak.stats module

This module allows to export Alignak internal metrics to a statsd server.

The register function allows an Alignak daemon to register some metrics and the expected behavior (sends to StatsD server and/or build an internal brok).

The connect function allows an Alignak daemon to connectto a Carbon/Graphite server.

As such it:

  • registers the StatsD or Carbon) connexion parameters
  • tries to establish a connection if the StatsD sending is enabled
  • creates an inner dictionary for the registered metrics
If some environment variables exist the metrics will be logged to a file in append mode:
‘ALIGNAK_STATS_FILE’
the file name
‘ALIGNAK_STATS_FILE_LINE_FMT’
defaults to [#date#] #counter# #value# #uom#
‘ALIGNAK_STATS_FILE_DATE_FMT’
defaults to ‘%Y-%m-%d %H:%M:%S’ date is UTC if configured as an empty string, the date will be output as a UTC timestamp

Every time a metric is updated thanks to the provided functions, the inner dictionary is updated according to keep the last value, the minimum/maximum values, to update an internal count of each update and to sum the collected values. Todo: Interest of this feature is to be proven ;)

The timer function sends a timer value to the StatsD registered server and creates an internal brok.

The counter function sends a counter value to the StatsD registered server and creates an internal brok.

The gauge function sends a gauge value to the StatsD registered server and creates an internal brok.

class alignak.stats.Stats[source]

Bases: object

Stats class to export data into a statsd (or carbon/Graphite) format

This class allows to send metrics to a StatsD server using UDP datagrams. Same behavior as:

echo "foo:1|c" | nc -u -w0 127.0.0.1 8125

With the Graphite option, this class stores the metrics in an inner list and flushes the metrics to a Graphite instance when the flush method is called.

connect(name, _type, host='localhost', port=2004, prefix='alignak', enabled=False, broks_enabled=False)[source]

Init instance with real values for a graphite/carbon connection

Parameters:
  • name (str) – daemon name
  • _type – daemon type
  • host (str) – host to post data
  • port (int) – port to post data
  • prefix (str) – prefix to add to metric
  • enabled (bool) – bool to enable statsd
  • broks_enabled (bool) – bool to enable broks sending
Returns:

None

counter(key, value, timestamp=None)[source]

Set a counter value

If the inner key does not exist is is created

Parameters:
  • key (str) – counter to update
  • value (float) – counter value
Returns:

An alignak_stat brok if broks are enabled else None

flush(log=False)[source]

Send inner stored metrics to the defined Graphite

Returns False if the sending failed with a warning log if log parameter is set

Returns:bool
gauge(key, value, timestamp=None)[source]

Set a gauge value

If the inner key does not exist is is created

Parameters:
  • key (str) – gauge to update
  • value (float) – counter value
Returns:

An alignak_stat brok if broks are enabled else None

load_statsd()[source]

Create socket connection to statsd host

Note that because of the UDP protocol used by StatsD, if no server is listening the socket connection will be accepted anyway :)

Returns:True if socket got created else False and an exception log is raised
metrics_count

Number of internal stored metrics :return:

register(name, _type, statsd_host='localhost', statsd_port=8125, statsd_prefix='alignak', statsd_enabled=False, broks_enabled=False)[source]

Init instance with real values

Parameters:
  • name (str) – daemon name
  • _type – daemon type
  • statsd_host (str) – host to post data
  • statsd_port (int) – port to post data
  • statsd_prefix (str) – prefix to add to metric
  • statsd_enabled (bool) – bool to enable statsd
  • broks_enabled (bool) – bool to enable broks sending
Returns:

None

send_to_graphite(metric, value, timestamp=None)[source]

Inner store a new metric and flush to Graphite if the flush threshold is reached.

If no timestamp is provided, get the current time for the metric timestam.

Parameters:
  • metric (str) – metric name in dotted format
  • value (float) –
  • timestamp (int) – metric timestamp
timer(key, value, timestamp=None)[source]

Set a timer value

If the inner key does not exist is is created

Parameters:
  • key (str) – timer to update
  • value (float) – timer value (in seconds)
  • timestamp (int) – metric timestamp
Returns:

An alignak_stat brok if broks are enabled else None

alignak.util module

This module provide a lot of utility functions. You can find functions for time management, type management (pythonization), macros solving, sorting, parsing, file handling, filters.

exception alignak.util.KeyValueSyntaxError[source]

Bases: exceptions.ValueError

Syntax error on a duplicate_foreach value

alignak.util.average_percentile(values)[source]

Get the average, min percentile (5%) and max percentile (95%) of a list of values.

Parameters:values (list) – list of value to compute
Returns:tuple containing average, min and max value
Return type:tuple
alignak.util.brok_last_time(ref, val)[source]

Convert float to int

Parameters:
  • ref – Not used
  • val (float) – value to convert
Returns:

int(val)

Return type:

int

alignak.util.dict_to_serialized_dict(ref, the_dict)[source]

Serialize the list of elements to a dictionary

Used for the retention store

Parameters:
  • ref – Not used
  • the_dict (dict) – dictionary to convert
Returns:

dict of serialized

Return type:

dict

alignak.util.expand_ranges(value)[source]
Parameters:value (str) – The value to be “expanded”.
Returns:A generator to yield the different resulting values from expanding the eventual ranges present in the input value.
>>> tuple(expand_ranges("Item [1-3] - Bla"))
('Item 1 - Bla', 'Item 2 - Bla', 'Item 3 - Bla')
>>> tuple(expand_ranges("X[1-10/2]Y"))
('X1Y', 'X3Y', 'X5Y', 'X7Y', 'X9Y')
>>> tuple(expand_ranges("[1-6/2] [1-3]"))
('1 1', '1 2', '1 3', '3 1', '3 2', '3 3', '5 1', '5 2', '5 3')
alignak.util.filter_any(ref)[source]

Filter for host Filter nothing

Parameters:name (str) – name to filter
Returns:Filter
Return type:bool
alignak.util.filter_host_by_bp_rule_label(label)[source]

Filter for host Filter on label

Parameters:label (str) – label to filter
Returns:Filter
Return type:bool
alignak.util.filter_host_by_group(group)[source]

Filter for host Filter on group

Parameters:group (str) – group name to filter
Returns:Filter
Return type:bool
alignak.util.filter_host_by_name(name)[source]

Filter for host Filter on name

Parameters:name (str) – name to filter
Returns:Filter
Return type:bool
alignak.util.filter_host_by_regex(regex)[source]

Filter for host Filter on regex

Parameters:regex (str) – regex to filter
Returns:Filter
Return type:bool
alignak.util.filter_host_by_tag(tpl)[source]

Filter for host Filter on tag

Parameters:tpl (str) – tag to filter
Returns:Filter
Return type:bool
alignak.util.filter_none(ref)[source]

Filter for host Filter all

Returns:Filter
Return type:bool
alignak.util.filter_service_by_bp_rule_label(label)[source]

Filter for service Filter on label

Parameters:label (str) – label to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_host_bp_rule_label(label)[source]

Filter for service Filter on label

Parameters:label (str) – label to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_host_name(host_name)[source]

Filter for service Filter on host_name

Parameters:host_name (str) – host_name to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_host_tag_name(tpl)[source]

Filter for service Filter on tag

Parameters:tpl (str) – tag to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_hostgroup_name(group)[source]

Filter for service Filter on hostgroup

Parameters:group (str) – hostgroup to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_name(name)[source]

Filter for service Filter on name

Parameters:name (str) – name to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_regex_host_name(regex)[source]

Filter for service Filter on regex host_name

Parameters:regex (str) – regex to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_regex_name(regex)[source]

Filter for service Filter on regex

Parameters:regex (str) – regex to filter
Returns:Filter
Return type:bool
alignak.util.filter_service_by_servicegroup_name(group)[source]

Filter for service Filter on group

Parameters:group (str) – group to filter
Returns:Filter
Return type:bool
alignak.util.format_t_into_dhms_format(timestamp)[source]

Convert an amount of second into day, hour, min and sec

Parameters:timestamp (int) – seconds
Returns:‘Ad Bh Cm Ds’
Return type:str
>>> format_t_into_dhms_format(456189)
'5d 6h 43m 9s'
>>> format_t_into_dhms_format(3600)
'0d 1h 0m 0s'
alignak.util.from_bool_to_int(boolean)[source]

Convert a bool to a int representation

Parameters:boolean (bool) – bool to convert
Returns:if boolean 1 ,else 0
Return type:int
alignak.util.from_bool_to_string(boolean)[source]

Convert a bool to a string representation

Parameters:boolean (bool) – bool to convert
Returns:if boolean ‘1’ ,else ‘0’
Return type:str
alignak.util.from_float_to_int(val)[source]

Convert float to int

Parameters:val (float) – value to convert
Returns:int(val)
Return type:int
alignak.util.from_list_to_set(ref, tab)[source]

Convert list to a set

Used for the retention restore

Parameters:
  • ref – Not used
  • tab (list) – list to parse
Returns:

list of names

Return type:

list

alignak.util.from_list_to_split(val)[source]

Convert list into a comma separated string

Parameters:val – value to convert
Returns:comma separated string
Return type:str
alignak.util.from_serialized(ref, the_data)[source]

Unserialize the element

Used for the retention store

Parameters:
  • ref – Not used
  • the_data (dict) – dictionary to convert
Returns:

serialized data

Return type:

dict

alignak.util.from_set_to_list(ref, tab)[source]

Convert set into a list

Used for the retention store

Parameters:
  • ref – Not used
  • tab (list) – list to parse
Returns:

list of names

Return type:

list

alignak.util.generate_key_value_sequences(entry, default_value)[source]

Parse a key value config entry (used in duplicate foreach)

If we have a key that look like [X-Y] we will expand it into Y-X+1 keys

Parameters:
  • entry (str) – The config line to be parsed.
  • default_value (str) – The default value to be used when none is available.
Returns:

a generator yielding dicts with ‘KEY’ & ‘VALUE’ & ‘VALUE1’ keys, with eventual others ‘VALUEx’ (x 1 -> N) keys.

>>> rsp = list(generate_key_value_sequences("var$(/var)$,root $(/)$"))
>>> import pprint
>>> pprint.pprint(rsp)
[{'KEY': 'var', 'VALUE': '/var', 'VALUE1': '/var'},
 {'KEY': 'root', 'VALUE': '/', 'VALUE1': '/'}]
alignak.util.get_obj_name_two_args_and_void(obj, value)[source]

Get value name (call get_name) if not a string

Parameters:
  • obj (object) – Not used
  • value – value to name
Returns:

value name

Return type:

str

alignak.util.is_complex_expr(expr)[source]

Check if expression in complex

Parameters:expr (str) – expression to parse
Returns:True if ‘(‘, ‘)’, ‘&’, ‘|’, ‘!’ or ‘*’ are in expr
Return type:bool
alignak.util.jsonify_r(obj)[source]

Convert an object into json (recursively on attribute)

Parameters:obj (object) – obj to jsonify
Returns:json representation of obj
Return type:dict
alignak.util.list_split(val, split_on_comma=True)[source]

Try to split each member of a list with comma separator. If we don’t have to split just return val

Parameters:
  • val – value to split
  • split_on_comma (bool) –
Returns:

list with members split on comma

Return type:

list

>>> list_split(['a,b,c'], False)
['a,b,c']
>>> list_split(['a,b,c'])
['a', 'b', 'c']
>>> list_split('')
[]
alignak.util.list_to_serialized(ref, the_list)[source]

Serialize the list of elements

Used for the retention store

Parameters:
  • ref – Not used
  • the_list (dict) – dictionary to convert
Returns:

dict of serialized

Return type:

dict

alignak.util.master_then_spare(data)[source]
Return the provided satellites list sorted as:
  • alive first,
  • then spare
  • then dead

satellites.

Parameters:data (list) – the SatelliteLink list
Returns:sorted list
Return type:list
alignak.util.merge_periods(data)[source]

Merge periods to have better continous periods. Like 350-450, 400-600 => 350-600

Parameters:data (list) – list of periods
Returns:better continous periods
Return type:list
alignak.util.parse_daemon_args(arbiter=False)[source]

Generic parsing function for daemons

All daemons:

‘-n’, “–name”: Set the name of the daemon to pick in the configuration files. This allows an arbiter to find its own configuration in the whole Alignak configuration Using this parameter is mandatory for all the daemons except for the arbiter (defaults to arbiter-master). If several arbiters are existing in the configuration this will allow to determine which one is the master/spare. The spare arbiter must be launched with this parameter!

‘-e’, ‘–environment’: Alignak environment file - the most important and mandatory parameter to define the name of the alignak.ini configuration file

‘-c’, ‘–config’: Daemon configuration file (ini file) - deprecated! ‘-d’, ‘–daemon’: Run as a daemon ‘-r’, ‘–replace’: Replace previous running daemon ‘-f’, ‘–debugfile’: File to dump debug logs.

These parameters allow to override the one defined in the Alignak configuration file:

‘-o’, ‘–host’: interface the daemon will listen to ‘-p’, ‘–port’: port the daemon will listen to

‘-l’, ‘–log_file’: set the daemon log file name ‘-i’, ‘–pid_file’: set the daemon pid file name

Arbiter only:
“-a”, “–arbiter”: Monitored configuration file(s), (multiple -a can be used, and they will be concatenated to make a global configuration file) - Note that this parameter is not necessary anymore “-V”, “–verify-config”: Verify configuration file(s) and exit
Parameters:arbiter (bool) – Do we parse args for arbiter?
Returns:args
alignak.util.sort_by_number_values(x00, y00)[source]

Compare x00, y00 base on number of values

Parameters:
  • x00 (list) – first elem to compare
  • y00 (list) – second elem to compare
Returns:

x00 > y00 (-1) if len(x00) > len(y00), x00 == y00 (0) if id equals, x00 < y00 (1) else

Return type:

int

alignak.util.split_semicolon(line, maxsplit=None)[source]

Split a line on semicolons characters but not on the escaped semicolons

Parameters:
  • line (str) – line to split
  • maxsplit (None | int) – maximal number of split (if None, no limit)
Returns:

split line

Return type:

list

>>> split_semicolon('a,b;c;;g')
['a,b', 'c', '', 'g']
>>> split_semicolon('a,b;c;;g', 2)
['a,b', 'c', ';g']
>>> split_semicolon(r'a,b;c\;;g', 2)
['a,b', 'c;', 'g']
alignak.util.strip_and_uniq(tab)[source]

Strip every element of a list and keep a list of ordered unique values

Parameters:tab (list) – list to strip
Returns:stripped list with unique values
Return type:list
alignak.util.to_best_int_float(val)[source]

Get best type for value between int and float

Parameters:val – value
Returns:int(float(val)) if int(float(val)) == float(val), else float(val)
Return type:int | float
>>> to_best_int_float("20.1")
20.1
>>> to_best_int_float("20.0")
20
>>> to_best_int_float("20")
20
alignak.util.to_bool(val)[source]

Convert value to bool

Because bool(‘0’) = true, so…

Parameters:val – value to convert
Returns:True if val == ‘1’ or val == ‘on’ or val == ‘true’ or val == ‘True’, else False
Return type:bool
alignak.util.to_char(val)[source]

Get first character of val (or raise Exception)

Parameters:val – value we get head
Returns:val[0]
Return type:str
alignak.util.to_float(val)[source]

Convert val to float (or raise Exception)

Parameters:val – value to convert
Returns:float(val)
Return type:float
alignak.util.to_hostnames_list(ref, tab)[source]

Convert Host list into a list of host_name

Parameters:
Returns:

host_name list

Return type:

list

alignak.util.to_int(val)[source]

Convert val to int (or raise Exception)

Parameters:val – value to convert
Returns:int(float(val))
Return type:int
alignak.util.to_list_string_of_names(ref, tab)[source]

Convert list into a comma separated list of element name

Parameters:
  • ref – Not used
  • tab (list) – list to parse
Returns:

comma separated string of names

Return type:

str

alignak.util.to_name_if_possible(ref, value)[source]

Try to get value name (call get_name method)

Parameters:
  • ref – Not used
  • value (str) – value to name
Returns:

name or ‘’

Return type:

str

alignak.util.to_serialized(ref, the_data)[source]

Serialize the property

Used for the retention store

Parameters:
  • ref – Not used
  • the_data (dict) – dictionary to convert
Returns:

serialized data

Return type:

dict

alignak.util.to_split(val, split_on_comma=True)[source]

Try to split a string with comma separator. If val is already a list return it If we don’t have to split just return [val] If split gives only [‘’] empty it

Parameters:
  • val – value to split
  • split_on_comma (bool) –
Returns:

split value on comma

Return type:

list

>>> to_split('a,b,c')
['a', 'b', 'c']
>>> to_split('a,b,c', False)
['a,b,c']
>>> to_split(['a,b,c'])
['a,b,c']
>>> to_split('')
[]
alignak.util.to_svc_hst_distinct_lists(ref, tab)[source]

create a dict with 2 lists:

* services: all services of the tab
* hosts: all hosts of the tab
Parameters:
  • ref – Not used
  • tab (list) – list of Host and Service
Returns:

dict with hosts and services names

Return type:

dict

alignak.util.unique_value(val)[source]

Get last element of a value if it is a list else returns the value

Used in parsing, if we set several time a parameter we only take the last one

Parameters:val – val to edit
Returns:single value
Return type:str

alignak.version module

This module provide Alignak current version

alignak.worker module

This module provide Worker class. It is used to spawn new processes in Poller and Reactionner

class alignak.worker.Worker(module_name, actions_queue, returns_queue, processes_by_worker, timeout=300, max_plugins_output_length=8192, target=None, loaded_into='unknown')[source]

Bases: object

This class is used for poller and reactionner to work. The worker is a process launch by theses process and read Message in a Queue (self.actions_queue) They launch the Check and then send the result in the Queue self.m (master) they can die if they do not do anything (param timeout)

check_for_system_time_change()[source]

Check if our system time change. If so, change our

Returns:0 if the difference < 900, difference else
Return type:int
do_work(actions_queue, returns_queue, control_queue=None)[source]

Main function of the worker. * Get checks * Launch new checks * Manage finished checks

Parameters:
  • actions_queue (Queue.Queue) – Global Queue Master->Slave
  • returns_queue (Queue.Queue) – queue managed by manager
Returns:

None

get_id()[source]

Accessor to get the worker identifier

Returns:the worker auto-generated identifier
Return type:str
get_module()[source]

Accessor to get the worker module name

Returns:the worker module name
Return type:str
get_new_checks(queue, return_queue)[source]

Get new checks if less than nb_checks_max If no new checks got and no check in queue, sleep for 1 sec REF: doc/alignak-action-queues.png (3)

Returns:None
get_pid()[source]

Accessor to get the worker process PID

Returns:the worker PID
Return type:int
is_alive()[source]

Wrapper for calling is_alive method of the process attribute

Returns:A boolean indicating if the process is alive
Return type:bool
join(timeout=None)[source]

Wrapper for calling join method of the process attribute

Parameters:timeout (int) – time to wait for the process to terminate
Returns:None
launch_new_checks()[source]

Launch checks that are in status REF: doc/alignak-action-queues.png (4)

Returns:None
manage_finished_checks(queue)[source]

Check the status of checks if done, return message finished :) REF: doc/alignak-action-queues.png (5)

Returns:None
manage_signal(sig, frame)[source]

Manage signals caught by the process but I do not do anything… our master daemon is managing our termination.

Parameters:
  • sig (str) – signal caught by daemon
  • frame – current stack frame
Returns:

None

set_exit_handler()[source]

Set the signal handler to manage_signal (defined in this class) Only set handlers for signal.SIGTERM, signal.SIGINT, signal.SIGUSR1, signal.SIGUSR2

Returns:None
start()[source]

Start the worker. Wrapper for calling start method of the process attribute

Returns:None
terminate()[source]

Wrapper for calling terminate method of the process attribute Also close queues (input and output) and terminate queues thread

Returns:None
uuid = ''
work(actions_queue, returns_queue, control_queue=None)[source]

Wrapper function for do_work in order to catch the exception to see the real work, look at do_work

Parameters:
  • actions_queue (Queue.Queue) – Global Queue Master->Slave
  • returns_queue (Queue.Queue) – queue managed by manager
Returns:

None

Module contents

Init of Alignak, basically only import version and shinken_hook. This file has to be as small as possible in order to namespace to work.