This module provides Acknowledge class that implements acknowledgment for notification. Basically used for parsing.
Allows you to acknowledge the current problem for the specified service. By acknowledging the current problem, future notifications (for the same servicestate) are disabled.
This module provides a system-independent Action class. Action class is used for handling check and notification execution (handle output, execute process, kill process..)
Bases: alignak.action.ActionBase
Action class for *NIX systems
Execute action in a subprocess
Parameters: | force_shell (bool) – if True, force execution in a shell |
---|---|
Returns: | None or str ‘toomanyopenfiles’ |
TODO: Clean this
This module provide ArbiterLink and ArbiterLinks classes used to manage link with Arbiter daemon
The AutoSlots Class is a MetaClass: it manages how other classes are created (Classes, not instances of theses classes). Here it’s 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
This python module contains the class BaseModule that alignak modules will subclass
Bases: object
This is the base class for the Alignak modules. Modules can be used by the different Alignak daemons/services for different tasks. Example of task that a Alignak module can do:
load additional configuration objects.
information in different format.
...
Release the resources associated to the queues of this instance
Parameters: | manager (None | object) – None on android, otherwise Manager() object |
---|---|
Returns: | None |
The manager is None on android, but a true Manager() elsewhere 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.
Parameters: | manager (None | object) – None on android, otherwise Manager() object |
---|---|
Returns: | None |
For external modules only: implement in this method the body of you main loop
Returns: | None |
---|
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 |
---|
The classic has: do we have a prop or not?
Parameters: | prop (str) – property name |
---|---|
Returns: | True if has a property, otherwise False |
Return type: | bool |
Handle this module “post” init ; just before it’ll be started. Like just open necessaries file(s), database(s), or whatever the module will need.
Returns: | None |
---|
Request the module to manage the given brok. There a lot of different possible broks to manage.
Parameters: | brok – |
---|---|
Returns: | |
Return type: |
Generic function to handle signals Set interrupted attribute to True and return
Parameters: |
|
---|---|
Returns: | None |
Set the signal handler function (manage_signal) for sigs signals or signal.SIGINT and signal.SIGTERM if sigs is None
Parameters: | sigs – signals to handle |
---|---|
Returns: | None |
Setter for loaded_into attribute Used to know what daemon has loaded this module
Parameters: | daemon_name (str) – value to set |
---|---|
Returns: | None |
Wrapper for setproctitle method
Parameters: | name (str) – module name |
---|---|
Returns: | None |
Set the signal handler function (manage_signal) for sigs signals or signal.SIGINT and signal.SIGTERM if sigs is None
Parameters: | sigs – signals to handle |
---|---|
Returns: | None |
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 |
Wrapper for _main function. Catch and raise any exception occurring in the main function
Returns: | None |
---|
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 |
module “main” method. Only used by external modules.
Returns: | None |
---|
Borg module provides Borg class. Used only for MacroSolver
Brok module provide Brok class which is basically event for Alignak. Brok are filled depending on their type (check_result, initial_state ...)
This module provide BrokerLink and BrokerLinks classes used to manage brokers
This module provides Check classe which is a simple abstraction for monitoring checks
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.
return a copy of the check but just what is important for execution So we remove the ref and all
Returns: | a copy of check |
---|---|
Return type: | object |
Update check data from action (notification for instance)
Parameters: | check (alignak.action.Action) – action to get data from |
---|---|
Returns: | None |
Getter for dependency_check attribute
Returns: | True if this check was created for dependent one, False otherwise |
---|---|
Return type: | bool |
Check if the check can be launched
Parameters: | timestamp (int) – time to compare with t_to_go attribute |
---|---|
Returns: | True if t > self.t_to_go, False otherwise |
Return type: | bool |
This modules provide CommandCall class which is a abstraction for dealing with command line (resolve macro, parse commands etc)
Bases: alignak.commandcall.DummyCommandCall
This class is use when a service, contact or host define a command with args.
We want to get the command and the args with ! splitting. but don’t forget to protect against the ! to do not split them
Returns: | None |
---|
Getter for valid attribute
Returns: | True if object is valid, False otherwise |
---|---|
Return type: | bool |
This module provide Comment class, used to attach comments to hosts / services
Comment class implements comments for monitoring purpose. It contains data like author, type, expire_time, persistent etc..
This module provides ComplexExpressionNode and ComplexExpressionFactory used for parsing expression (business rules)
Bases: object
ComplexExpressionFactory provides complex expression parsing functions
Bases: object
ComplexExpressionNode is a node class for complex_expression(s)
This module provides ContactDowntime class which implement downtime for contact
ContactDowntime class allows a contact to be in downtime. During this time the contact won’t get notifications
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 |
---|
Wrapper to call raise_exit_downtime_log_entry for ref (host/service) set can_be_deleted to True
Returns: | None |
---|
Getter for is_in_effect attribute
Returns: | True if downtime is active, False otherwise |
---|---|
Return type: | bool |
This module provides abstraction for creating daemon in Alignak
Bases: object
Class providing daemon level call for Alignak TODO: Consider clean this code and use standard libs
Parameters: | elt – element to add |
---|---|
Returns: | None |
Change to user of the running program. If change failed we sys.exit(2)
Parameters: | insane (bool) – boolean to allow running as root |
---|---|
Returns: | None |
Check alive instance and try to restart the dead ones
Returns: | None |
---|
Check if our system time change. If so, change our
Returns: | 0 if the difference < 900, difference else |
---|---|
Return type: | int |
TODO: Duplicate of alignak.worker.Worker.check_for_system_time_change
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 |
---|
Close all the process file descriptors. Skip the descriptors present in the skip_close_fds list
Parameters: | skip_close_fds (list) – list of fd to skip |
---|---|
Returns: | None |
Default action for system time change. Actually a log is done
Returns: | None |
---|
Go in “daemon” mode: close unused fds, redirect stdout/err, chdir, umask, fork-setsid-fork-writepid Do the double fork to properly go daemon
Parameters: | skip_close_fds (list) – list of fd to keep open |
---|---|
Returns: | None |
Main daemon function. Clean, allocates, initializes and starts all necessary resources to go in daemon mode.
Parameters: | fake (bool) – use for test to do not launch runonly feature, like the stats reaper thread. |
---|---|
Returns: | None |
Wrapper for calling load_and_init method of modules_manager attribute
Returns: | None |
---|
Abstract method for deamon loop turn. It must be overridden by class inheriting from Daemon
Returns: | None |
---|
Returns: | None |
---|
Wrapper for getgrnam : get the uid of user attribute
Returns: | Uid of user attribute |
---|---|
Return type: | str | None |
Find the absolute path of the alignak module directory and returns it. If the directory do not exist, we must exit!
Returns: | modules_dir path |
---|---|
Return type: | str |
Wrapper for getpwnam : get the uid of user attribute
Returns: | Uid of user attribute |
---|---|
Return type: | str | None |
Get the log file header
Returns: | A string list containing project name, version, licence etc. |
---|---|
Return type: | list |
Get objects from “from” queues and add them.
Returns: | True if we got some objects, False otherwise. |
---|---|
Return type: | bool |
Basic function to get retention data, Maybe be overridden by subclasses to implement real get
Returns: | A list of Alignak object (scheduling items) |
---|---|
Return type: | list |
Global loop part : wait for socket to be ready
Parameters: |
|
---|---|
Returns: | A list of socket file descriptor ready to read |
Return type: | list |
Get state of modules and create a scheme for stats data of daemon This may be overridden in subclasses
Returns: | A dict with the following structure |
---|
{ 'metrics': [],
'version': __version__,
'name': '',
'modules':
{'internal': {'name': "MYMODULE1", 'state': 'ok'},
{'external': {'name': "MYMODULE2", 'state': 'stopped'},
]
}
Return type: | dict |
---|
Wait up to timeout to handle the requests. If suppl_socks is given it also looks for activity on that list of fd.
Parameters: |
|
---|
:return:Returns a 3-tuple: * If timeout: first arg is 0, second is [], third is possible system time change value * If not timeout (== some fd got activity):
- first arg is elapsed time since wait,
- second arg is sublist of suppl_socks that got activity.
- third arg is possible system time change value, or 0 if no change
Return type: | tuple |
---|
Used to call module function that may define a hook fonction for hook_name
Parameters: | hook_name (str) – function name we may hook in module |
---|---|
Returns: | None |
Main fonction of the http daemon thread will loop forever unless we stop the root daemon
Returns: | None |
---|
Instanciate Modulesmanager and load the SyncManager (multiprocessing)
Returns: | None |
---|
Manage signals caught by the daemon signal.SIGUSR1 : dump_memory signal.SIGUSR2 : dump_object (nothing) signal.SIGTERM, signal.SIGINT : terminate process
Parameters: |
|
---|---|
Returns: | None |
Parse self.config_file and get all properties in it. If some properties need a pythonization, we do it. Also put default value in the properties if some are missing in the config_file
Returns: | None |
---|
Log generic message when getting an unrecoverable error
Parameters: | trace – stack trace of the Exception |
---|---|
Returns: | None |
Set a full path from a relative one with che config file as reference TODO: This should be done in pythonize method of Properties.
Parameters: | reference_path (str) – reference path for reading full path |
---|---|
Returns: | None |
Basic function to save retention data, Maybe be overridden by subclasses to implement real save
Returns: | None |
---|
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 |
---|
Setup HTTP server daemon to listen for incoming HTTP requests from other Alignak daemons
Returns: | None |
---|
Bases: exceptions.Exception
Exception raise when a pid file is invalid
This module provide Daterange and Timerange classes used to create Timeperiod in Alignak
Bases: object
AbstractDaterange class provides functions to deal with a range of dates It is subclassed for more granularity (weekday, month ...)
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 the first second from midnight where a timerange is effective
Returns: | smallest amount of second from midnight of all timerange |
---|---|
Return type: | int |
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 |
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'
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 invalid time for timeranges
Parameters: | timestamp (int) – time to check |
---|---|
Returns: | next time when a timerange is not valid |
Return type: | None | int |
TODO: Looks like this function is buggy, start time should not be included in returned values
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 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 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 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 for time range
Parameters: | timestamp (int) – time we compute from |
---|---|
Returns: | timestamp of the next valid time (LOCAL TIME) |
Return type: | int | None |
Generic function to get start time and end time
Parameters: | ref (int) – time in seconds |
---|---|
Returns: | None |
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'
Get weekday id from weekday name
Parameters: | weekday (str) – weekday name |
---|---|
Returns: | weekday id |
Return type: | int |
>>> Daterange.get_weekday_id("monday")
0
Check if each timerange of this datarange is correct
Returns: | True if timerange are correct, False otherwise |
---|---|
Return type: | bool |
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 |
TODO: Remove this function. Duplication
Bases: alignak.daterange.Daterange
CalendarDaterange is for calendar entry (YYYY-MM-DD - YYYY-MM-DD)
Bases: alignak.daterange.AbstractDaterange
Daterange subclasses AbstractDaterange and instantiates Timerange objects
Bases: alignak.daterange.Daterange
MonthDateDaterange is for month and day entry (month DD - month DD)
Bases: alignak.daterange.Daterange
MonthDayDaterange is for month week day entry (day DD - DD)
Bases: alignak.daterange.Daterange
MonthWeekDayDaterange is for month week day entry (weekday DD month - weekday DD month)
Bases: alignak.daterange.AbstractDaterange
StandardDaterange is for standard entry (weekday - weekday)
Bases: object
Timerange class provides parsing facilities for time range declaration
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 Timerange start time in seconds (from midnight)
Returns: | amount of seconds from midnight |
---|---|
Return type: | int |
Bases: alignak.daterange.Daterange
WeekDayDaterange is for month week day entry (weekday offset - weekday offset)
Get the month day based on date and offset
Parameters: | |
---|---|
Returns: | day number in the month |
Return type: | int |
>>> find_day_by_offset(2015, 7, -1)
31
This module provide DB class which is a generic class to access relational databases
Bases: object
DB is a generic class for SQL Database
Create a INSERT query in table with all data of data (a dict)
Parameters: | |
---|---|
Returns: | the query |
Return type: | str |
This module provide DBSqlite class to access SQLite databases
Bases: alignak.db.DB
DBSqlite is a sqlite access database class
This module provides DependencyNode and DependencyNodeFactory used for parsing expression (business rules)
Bases: object
DependencyNode is a node class for business_rule expression(s)
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
Returns: | 0, 1 or 2 |
---|---|
Return type: | int |
Get state, handle AND, OR, X of aggregation.
Returns: | 0, 1 or 2 |
---|---|
Return type: | int |
Get state , handle OR aggregation
* Get the best state (min of sons)
* Revert if it's a not node
Returns: | 0, 1 or 2 |
---|---|
Return type: | int |
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
Returns: | 0, 1 or 2 |
---|---|
Return type: | int |
TODO: Looks like the last if does the opposite of what the comment says
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 node state, simplest case
* Handle not value (revert) for host and service node
* Return 2 instead of 1 for host
Returns: | 0, 1 or 2 |
---|---|
Return type: | int |
TODO: Why return 1 when not 0 instead of 2 ?
Get node state by looking recursively over sons and applying operand
Returns: | Node state |
---|---|
Return type: | int |
Check if all leaves are correct (no error)
Returns: | True if correct, otherwise False |
---|---|
Return type: | bool |
Bases: object
DependencyNodeFactory provides dependency node parsing functions
Parse and build recursively a tree of DependencyNode from a complex pattern
Parameters: |
|
---|---|
Returns: | root node of parsed tree |
Return type: | alignak.dependencynode.DependencyNode |
Parse and build recursively a tree of DependencyNode from pattern
Parameters: |
|
---|---|
Returns: | root node of parsed tree |
Return type: | alignak.dependencynode.DependencyNode |
Parse and build recursively a tree of DependencyNode from a simple pattern
Parameters: |
|
---|---|
Returns: | root node of parsed tree |
Return type: | alignak.dependencynode.DependencyNode |
Parse a X of pattern * Set is_of_mul attribute * Set of_values attribute
Parameters: |
|
---|---|
Returns: | end of the line (without X of :) |
Return type: | str |
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 from pattern
Parameters: |
|
---|---|
Returns: | tuple with Host or Service object and error |
Return type: | tuple |
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 |
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 |
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 |
This is the class of the dispatcher. Its role is to dispatch configurations to other elements like schedulers, reactionner, 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
Dispatcher is in charge of sending configuration to other daemon. It has to handle spare, realms, poller tags etc.
Check all daemons state (alive or not) and send conf if necessary
Returns: | None |
---|
Check if we have a bad dispatch For example : a spare started but the master was still alive We need ask the spare to wait a new conf
Returns: | None |
---|
Check if all active items are still alive
Returns: | None |
---|
TODO: finish need conf
This modules provides Downtime class, used to implements downtime monitoring concept. See detailed concepts below
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.
Remove ref in scheduled downtime and raise downtime log entry (cancel)
Returns: | [], always |
---|---|
Return type: | list |
TODO: res is useless
Set ref in scheduled downtime and raise downtime log entry (start)
Returns: | [], always |
---|---|
Return type: | list |
TODO: res is useless
Remove ref in scheduled downtime and raise downtime log entry (exit)
Returns: | [], always | None |
---|---|
Return type: | list |
TODO: res is useless
Fill data with info of item by looking at brok_type in props of properties or running_properties
Parameters: |
|
---|---|
Returns: | None |
TODO: Duplicate from Notification.fill_data_brok_from
Get a initial status brok
Returns: | brok with wanted data |
---|---|
Return type: | alignak.brok.Brok |
TODO: Duplicate from Notification.fill_data_brok_from
Getter for is_in_effect attribute
Returns: | True if downtime is in effect, False otherwise |
---|---|
Return type: | bool |
This module provides EventHandler class, used when hosts or services reach a bad state.
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
Get a copy o this event handler with minimal values (default, id, is snapshot)
Returns: | new event handler |
---|---|
Return type: | alignak.eventhandler.EventHandler |
Getter to id attribute
Returns: | event handler id |
---|---|
Return type: | int |
TODO: Duplicate from Notification.get_id
Setter of output attribute
Parameters: |
|
---|---|
Returns: | None |
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 |
Check if this event handler can be launched base on time
Parameters: | timestamp (int) – time to compare |
---|---|
Returns: | True if t >= self.t_to_go, False otherwise |
Return type: | bool |
TODO: Duplicate from Notification.is_launchable
This module provides ExternalCommand and ExternalCommandManager classes Used to process command sent by users
ExternalCommand class is only an object with a cmd_line attribute. All parsing and execution is done in manager
ExternalCommandManager class managed all external command sent to Alignak It basically parses arguments and execute the right function
Acknowledge a host problem Format of the line that triggers function call:
ACKNOWLEDGE_HOST_PROBLEM;<host_name>;<sticky>;<notify>;<persistent>;<author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
TODO: add a better ACK management
Acknowledge a host problem with expire time for this acknowledgement Format of the line that triggers function call:
ACKNOWLEDGE_HOST_PROBLEM;<host_name>;<sticky>;<notify>;<persistent>;<end_time>; <author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
TODO: add a better ACK management
Acknowledge a service problem Format of the line that triggers function call:
ACKNOWLEDGE_SVC_PROBLEM;<host_name>;<service_description>;<sticky>;<notify>;<persistent>; <author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
Acknowledge a service problem with expire time for this acknowledgement Format of the line that triggers function call:
ACKNOWLEDGE_SVC_PROBLEM;<host_name>;<service_description>;<sticky>;<notify>;<persistent>; <end_time>;<author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
Add a host comment Format of the line that triggers function call:
ADD_HOST_COMMENT;<host_name>;<persistent>;<author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
Add a host dependency between son and father Format of the line that triggers function call:
ADD_SIMPLE_HOST_DEPENDENCY;<host_name>;<host_name>
Parameters: |
|
---|---|
Returns: | None |
Add a poller Format of the line that triggers function call:
ADD_SIMPLE_POLLER;realm_name;poller_name;address;port
Parameters: | |
---|---|
Returns: | None |
Add a service comment Format of the line that triggers function call:
ADD_SVC_COMMENT;<host_name>;<service_description>;<persistent>;<author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
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 |
Change contact modified attribute value Format of the line that triggers function call:
CHANGE_CONTACT_MODATTR;<contact_name>;<value>
Parameters: |
|
---|---|
Returns: | None |
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
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 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 variable Format of the line that triggers function call:
CHANGE_CUSTOM_CONTACT_VAR;<contact_name>;<varname>;<varvalue>
Parameters: |
|
---|---|
Returns: | None |
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 service variable Format of the line that triggers function call:
CHANGE_CUSTOM_SVC_VAR;<host_name>;<service_description>;<varname>;<varvalue>
Parameters: |
|
---|---|
Returns: | None |
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
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
Modify host check command Format of the line that triggers function call:
CHANGE_HOST_CHECK_COMMAND;<host_name>;<check_command>
Parameters: |
|
---|---|
Returns: | None |
Modify host check timeperiod Format of the line that triggers function call:
CHANGE_HOST_CHECK_TIMEPERIOD;<host_name>;<timeperiod>
Parameters: |
|
---|---|
Returns: | None |
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 modified attributes Format of the line that triggers function call:
CHANGE_HOST_MODATTR;<host_name>;<value>
Parameters: |
|
---|---|
Returns: | None |
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 |
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 |
Modify host check interval Format of the line that triggers function call:
CHANGE_NORMAL_HOST_CHECK_INTERVAL;<host_name>;<check_interval>
Parameters: |
|
---|---|
Returns: | None |
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 |
Modify host retry interval Format of the line that triggers function call:
CHANGE_RETRY_HOST_CHECK_INTERVAL;<host_name>;<check_interval>
Parameters: |
|
---|---|
Returns: | None |
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 |
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 |
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 |
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 service modified attributes Format of the line that triggers function call:
CHANGE_SVC_MODATTR;<host_name>;<service_description>;<value>
Parameters: |
|
---|---|
Returns: | None |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Delete a host dependency between son and father Format of the line that triggers function call:
DEL_SIMPLE_HOST_DEPENDENCY;<host_name>;<host_name>
Parameters: |
|
---|---|
Returns: | None |
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 |
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 |
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 |
Modify host first notification delay Format of the line that triggers function call:
DELAY_HOST_NOTIFICATION;<host_name>;<notification_time>
Parameters: |
|
---|---|
Returns: | None |
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 |
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 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 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 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 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 (globally) Format of the line that triggers function call:
DISABLE_EVENT_HANDLERS
Returns: | None |
---|
Disable failure prediction (globally) Format of the line that triggers function call:
DISABLE_FAILURE_PREDICTION
Returns: | None |
---|
Disable flap detection (globally) Format of the line that triggers function call:
DISABLE_FLAP_DETECTION
Returns: | None |
---|
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 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 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 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 freshness checks (globally) Format of the line that triggers function call:
DISABLE_HOST_FRESHNESS_CHECKS
Returns: | None |
---|
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 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 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 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 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 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 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 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 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 (globally) Format of the line that triggers function call:
DISABLE_NOTIFICATIONS
Returns: | None |
---|
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 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 processing (globally) Format of the line that triggers function call:
DISABLE_PERFORMANCE_DATA
Returns: | None |
---|
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 (globally) Format of the line that triggers function call:
DISABLE_SERVICE_FRESHNESS_CHECKS
Returns: | None |
---|
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 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 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 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 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 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 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 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 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 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 |
Send command to scheduler, it’s a global one
Parameters: | command (alignak.external_command.ExternalCommand) – command to send |
---|---|
Returns: | None |
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 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 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 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 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 (globally) Format of the line that triggers function call:
ENABLE_EVENT_HANDLERS
Returns: | None |
---|
Enable failure prediction (globally) Format of the line that triggers function call:
ENABLE_FAILURE_PREDICTION
Returns: | None |
---|
Enable flap detection (globally) Format of the line that triggers function call:
ENABLE_FLAP_DETECTION
Returns: | None |
---|
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 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 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 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 freshness checks (globally) Format of the line that triggers function call:
ENABLE_HOST_FRESHNESS_CHECKS
Returns: | None |
---|
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 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 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 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 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 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 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 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 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 (globally) Format of the line that triggers function call:
ENABLE_NOTIFICATIONS
Returns: | None |
---|
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 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 processing (globally) Format of the line that triggers function call:
ENABLE_PERFORMANCE_DATA
Returns: | None |
---|
Enable service freshness checks (globally) Format of the line that triggers function call:
ENABLE_SERVICE_FRESHNESS_CHECKS
Returns: | None |
---|
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 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 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 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 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 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 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 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 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 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 external commands from fifo
Returns: | external commands |
---|---|
Return type: | list[alignak.external_command.ExternalCommand] |
Parse command and get args
Parameters: |
|
---|---|
Returns: | Dict containing command and arg |
{‘global’: False, ‘c_name’: c_name, ‘args’: args}
Return type: | dict | None |
---|
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 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 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 |
Setter for arbiter attribute
Parameters: | arbiter (object) – arbiter to set |
---|---|
Returns: | None |
Setter for receiver attribute
Parameters: | receiver (object) – receiver to set |
---|---|
Returns: | None |
Setter for scheduler attribute
Parameters: | scheduler (object) – scheduler to set |
---|---|
Returns: | None |
Create if necessary and open a pipe (Won’t work under Windows)
Returns: | pipe file descriptor |
---|---|
Return type: | file |
DOES NOTHING (should process a file) Format of the line that triggers function call:
PROCESS_FILE;<file_name>;<delete>
Parameters: |
|
---|---|
Returns: | None |
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 Format of the line that triggers function call:
PROCESS_HOST_OUTPUT;<host_name>;<plugin_output>
Parameters: |
|
---|---|
Returns: | None |
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 Format of the line that triggers function call:
PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<plugin_output>
Parameters: |
|
---|---|
Returns: | None |
DOES NOTHING (What it is supposed to do?) Format of the line that triggers function call:
READ_STATE_INFORMATION
Returns: | None |
---|
Reload Alignak configuration Format of the line that triggers function call:
RELOAD_CONFIG
Returns: | None |
---|
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 |
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 |
Parse command and dispatch it (to sched 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: | None |
Restart Alignak Format of the line that triggers function call:
RESTART_PROGRAM
Returns: | None |
---|
DOES NOTHING (What it is supposed to do?) Format of the line that triggers function call:
SAVE_STATE_INFORMATION
Returns: | None |
---|
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 |
---|
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 Format of the line that triggers function call:
SCHEDULE_CONTACT_DOWNTIME;<contact_name>;<start_time>;<end_time>;<author>;<comment>
Parameters: |
|
---|---|
Returns: | None |
Schedule a forced check on a host Format of the line that triggers function call:
SCHEDULE_FORCED_HOST_CHECK;<host_name>;<check_time>
Parameters: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
Schedule a check on a host Format of the line that triggers function call:
SCHEDULE_HOST_CHECK;<host_name>;<check_time>
Parameters: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
Schedule a service downtime for each service of a 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: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
Schedule a check on a service Format of the line that triggers function call:
SCHEDULE_SVC_CHECK;<host_name>;<service_description>;<check_time>
Parameters: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
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 |
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: | |
---|---|
Returns: | None |
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: | |
---|---|
Returns: | None |
DOES NOTHING (Should set host notification number) Format of the line that triggers function call:
SET_HOST_NOTIFICATION_NUMBER;<host_name>;<notification_number>
Parameters: |
|
---|---|
Returns: | None |
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: |
|
---|---|
Returns: | None |
DOES NOTHING (Should shutdown Alignak) Format of the line that triggers function call:
SHUTDOWN_PROGRAM
Returns: | None |
---|
Enable passive host check submission (globally) Format of the line that triggers function call:
START_ACCEPTING_PASSIVE_HOST_CHECKS
Returns: | None |
---|
Enable passive service check submission (globally) Format of the line that triggers function call:
START_ACCEPTING_PASSIVE_SVC_CHECKS
Returns: | None |
---|
Enable host check execution (globally) Format of the line that triggers function call:
START_EXECUTING_HOST_CHECKS
Returns: | None |
---|
Enable service check execution (globally) Format of the line that triggers function call:
START_EXECUTING_SVC_CHECKS
Returns: | None |
---|
Enable obsessing over host for a host Format of the line that triggers function call:
START_OBSESSING_OVER_HOST;<host_name>
Parameters: | host (alignak.objects.host.Host) – host to obsess over |
---|---|
Returns: | None |
Enable obssessing over host check (globally) Format of the line that triggers function call:
START_OBSESSING_OVER_HOST_CHECKS
Returns: | None |
---|
Enable obssessing over service for a service Format of the line that triggers function call:
START_OBSESSING_OVER_SVC;<host_name>;<service_description>
Parameters: | service (alignak.objects.service.Service) – service to obssess over |
---|---|
Returns: | None |
Enable obssessing over service check (globally) Format of the line that triggers function call:
START_OBSESSING_OVER_SVC_CHECKS
Returns: | None |
---|
Disable passive host check submission (globally) Format of the line that triggers function call:
STOP_ACCEPTING_PASSIVE_HOST_CHECKS
Returns: | None |
---|
Disable passive service check submission (globally) Format of the line that triggers function call:
STOP_ACCEPTING_PASSIVE_SVC_CHECKS
Returns: | None |
---|
Disable host check execution (globally) Format of the line that triggers function call:
STOP_EXECUTING_HOST_CHECKS
Returns: | None |
---|
Disable service check execution (globally) Format of the line that triggers function call:
STOP_EXECUTING_SVC_CHECKS
Returns: | None |
---|
Disable obsessing over host for a host Format of the line that triggers function call:
STOP_OBSESSING_OVER_HOST;<host_name>
Parameters: | host (alignak.objects.host.Host) – host to obsess over |
---|---|
Returns: | None |
Disable obssessing over host check (globally) Format of the line that triggers function call:
STOP_OBSESSING_OVER_HOST_CHECKS
Returns: | None |
---|
Disable obssessing over service for a service Format of the line that triggers function call:
STOP_OBSESSING_OVER_SVC;<host_name>;<service_description>
Parameters: | service (alignak.objects.service.Service) – service to obssess over |
---|---|
Returns: | None |
This modules provide Graph class. Used to check for loop into dependencies
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 between two node The edge is oriented
Parameters: | |
---|---|
Returns: | None |
Create the node key into the mode dict with [] value
Parameters: | node (object) – node to add |
---|---|
Returns: | None |
Add several nodes into the nodes dict
Parameters: | nodes (object) – nodes to add |
---|---|
Returns: | None |
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 stucked in loop.
Parameters: | root – Root of the dependency tree |
---|---|
Returns: | None |
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 |
This module provide a simple abstraction for load computation in satellite
This class is for having a easy Load calculation without having to send value at regular interval (but it’s more efficient if you do this :) ) and without having a list or other stuff. It’s just an object, an update and a get You can define mins: the average for mins minutes. The val is the initial value. It’s better if it’s 0 but you can choose.
This module provide logging facilities for Alignak. There is a custom log handler that create broks for every log emited with level < debug
Bases: logging.Handler
This log handler is forwarding log messages as broks to the broker.
Only messages of level higher than DEBUG are send to other satellite to not risk overloading them.
Bases: logging.StreamHandler
This log handler provides colored logs when logs are emitted to a tty.
Bases: logging.Logger
Alignak logger class, wrapping access to Python logging standard library. See : https://docs.python.org/2/howto/logging.html#logging-flow for more detail about how log are handled
We load the object where we will put log broks with the ‘add’ method
Parameters: |
|
---|---|
Returns: | None |
The alignak logging wrapper can write to a local file if needed and return the file descriptor so we can avoid to close it.
Add logging to a local log-file.
The file will be rotated once a day
Parameters: | |
---|---|
Returns: |
Set level of logger and handlers. The logger need the lowest level (see link above)
Parameters: | level (int) – logger/handler level |
---|---|
Returns: | None |
This class resolve Macro in commands by looking at the macros list in Class of elements. It give a property that call be callable or not. It not callable, it’s a simple property and replace the macro with the 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)
Bases: alignak.borg.Borg
MacroResolver class is used to resolve macros (in command call). See above for details
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 macroresolver instance with conf. Must be called once.
Parameters: | conf – conf to load |
---|---|
Returns: | None |
Resolve command macros with data
Parameters: |
|
---|---|
Returns: | command line with ‘$MACRO$’ replaced with values |
Return type: | str |
Replace macro in the command line with the real value
Parameters: |
|
---|---|
Returns: | command line with ‘$MACRO$’ replaced with values |
Return type: | str |
This module provides Message class. Used for communication between daemon process (with queues)
This module provides ModulesContext class that allow Alignak module to load other module. This will become deprecated with namespace in Alignak and keep for backward compatibility with Shinken.
This module provides ModulesManager class. Used to load modules in Alignak
Bases: object
This class is use to manage modules and call callback
Check alive isntances. If not, log error and try to restart it
Returns: | None |
---|
Request to “remove” the given instances list or all if not provided
Parameters: | insts – instances to remove (all if None) |
---|---|
Returns: | None |
Get a list of queue from external instances
Returns: | queue list |
---|---|
Return type: | list |
Get a list of external instances (in a specific phase)
Parameters: | phase – phase to filter (never used) |
---|---|
Returns: | external instances list |
Return type: | list |
Get a list of queue to external instances
Returns: | queue list |
---|---|
Return type: | list |
Create, init and then returns the list of module instances that the caller needs. If an instance can’t be created or init’ed then only log is done. That instance is skipped. The previous modules instance(s), if any, are all cleaned.
Arbiter call this method with start_external=False
Returns: | module instances list |
---|---|
Return type: | list |
Get a list of internal instances (in a specific phase)
Parameters: | phase – phase to filter (never used) |
---|---|
Returns: | internal instances list |
Return type: | list |
Try to import the requested modules ; put the imported modules in self.imported_modules. The previous imported modules, if any, are cleaned before.
Returns: | None |
---|
Import, instanciate & “init” the modules we have been requested
Returns: | None |
---|
Setter for manager attribute
Parameters: | manager (str) – value to set |
---|---|
Returns: | None |
Request to cleanly remove the given instance. If instance is external also shutdown it cleanly
Parameters: | inst (object) – instance to remove |
---|---|
Returns: | None |
Setter for max_queue_size attribute
Parameters: | max_queue_size (int) – value to set |
---|---|
Returns: | None |
Setter for modules and allowed_type attributes Allowed type attribute is set based on module type in modules arg
Parameters: | modules – value to set to module |
---|---|
Returns: | None |
Put an instance to the restart queue
Parameters: | inst (object) – instance to restart |
---|---|
Returns: | None |
Launch external instances that are load correctly
Parameters: | late_start (bool) – If late_start, don’t look for last_init_try |
---|---|
Returns: | None |
Try to load module in the bast way possible (using importlib)
Parameters: |
|
---|---|
Returns: | None | module |
Return type: |
Try to “init” the given module instance.
Parameters: | |
---|---|
Returns: | True on successful init. False if instance init method raised any Exception. |
Return type: | bool |
This module provides Notification class. Used to define monitoring notifications (email, contacts..)
Bases: alignak.action.Action
Notification class, inherits from action class. Used to notify contacts and execute notification command defined in configuration
Get a copy o this notification with minimal values (default + id)
Returns: | new notification |
---|---|
Return type: | alignak.notification.Notification |
Fill data with info of item by looking at brok_type in props of properties or running_properties
Parameters: |
|
---|---|
Returns: | brok with wanted data |
Return type: | alignak.brok.Brok |
Get a initial status brok
Returns: | brok with wanted data |
---|---|
Return type: | alignak.brok.Brok |
Setter of exit_status and execution_time attributes
Parameters: | notif (alignak.notification.Notification) – notification to get data from |
---|---|
Returns: | None |
Check if this notification is “administrative”
Returns: | True in type not in (‘PROBLEM’, ‘RECOVERY’), False otherwise |
---|---|
Return type: | bool |
Check if this notification can be launched base on time
Parameters: | timestamp (int) – time to compare |
---|---|
Returns: | True if timestamp >= self.t_to_go, False otherwise |
Return type: | bool |
This module used to provide daemon links. They have been moved to objects now You will get deprecation warning if you use it
This module provide PollerLink and PollerLinks classes used to manage link between the modules Arbiter and Poller
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.
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.
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).
Bases: alignak.property.Property
Integer property
Bases: alignak.property.Property
Float property
Bases: alignak.property.Property
One character string property
Bases: alignak.property.Property
String property
Bases: alignak.property.Property
List property
This module provide ReactionnerLink and ReactionnerLinks classes used to manage reactionners
This module provide ReceiverLink and ReceiverLinks classes used to manage receivers
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 (one a timeout)
Bases: alignak.daemon.Daemon
Base Satellite class. Subclassed by Alignak (scheduler), Broker and Satellite
Abstract method for satellite loop turn. It must be overridden by class inheriting from Daemon
Returns: | None |
---|
Get the external commands
Returns: | External commands list |
---|---|
Return type: | list |
Bases: exceptions.Exception
Class to tell that we are facing a non worker module but a standard one
Bases: alignak.satellite.BaseSatellite
Satellite class. Subclassed by Receiver, Reactionner and Poller
Add an object to the satellite one Handles brok and externalcommand
Parameters: | elt (object) – object to add |
---|---|
Returns: | None |
Add a list of actions to the satellite queues
Parameters: | |
---|---|
Returns: | None |
Try to create the minimum workers specified in the configuration
Returns: | None |
---|
Take an action and put it to action queue
Parameters: | action (alignak.action.Action) – action to put |
---|---|
Returns: | None |
Check if worker are fine and kill them if not. Dispatch the actions in the worker to another one
Returns: | None |
---|
Clean variables from previous configuration, such as schedulers, broks and external commands
Returns: | None |
---|
Parameters: |
|
---|---|
Returns: | None |
Get new actions from schedulers Create a Message and put into the module queue REF: doc/alignak-action-queues.png (1)
Returns: | None |
---|
Satellite main loop:
* Setup new conf if necessary
* Watch for new conf
* Check and delete zombies actions / modules
* Get returns from queues
* Adjust worker number
* Get new actions
Returns: | None |
---|
Manage the checks and then send a HTTP request to schedulers (POST /put_results) REF: doc/alignak-action-queues.png (6)
Returns: | None |
---|
Do this satellite (poller or reactionner) post “daemonize” init
Returns: | None |
---|
Initialize a connection with scheduler having ‘_id’ Return the new connection to the scheduler if it succeeded,
else: any error OR sched is inactive: return None.
NB: if sched is inactive then None is directly returned.
Parameters: | s_id (int) – scheduler s_id to connect to |
---|---|
Returns: | scheduler connection object or None |
Return type: | alignak.http.client.HTTPClient |
Wrapper function for do_get_new_actions For stats purpose
Returns: | None |
---|
TODO: Use a decorator
Get returns of passive actions for a specific scheduler
Parameters: | sched_id (int) – scheduler id |
---|---|
Returns: | Action list |
Return type: | list |
Wrapper for returns_queue.get method. Return an queue element
Returns: | queue Message |
---|---|
Return type: | alignak.message.Message |
Wrapper for returns_queue.qsize method. Return queue length
Returns: | queue length |
---|---|
Return type: | int |
Get state of modules and create a scheme for stats data of daemon This may be overridden in subclasses
Returns: | A dict with the following structure |
---|
{ 'metrics': ['%s.%s.external-commands.queue %d %d'],
'version': __version__,
'name': self.name,
'type': _type,
'passive': self.passive,
'modules':
{'internal': {'name': "MYMODULE1", 'state': 'ok'},
{'external': {'name': "MYMODULE2", 'state': 'stopped'},
]
}
Return type: | dict |
---|
Manage action return from Workers We just put them into the corresponding sched and we clean unused properties like sched_id
Parameters: | action (alignak.action.Action) – the action to manage |
---|---|
Returns: | None |
Wrapper function of do_manage_returns()
Returns: | None |
---|
TODO: Use a decorator for stat
This module provides an abstraction layer for communications between Alignak daemons Used by the Arbiter
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.
Bases: object
Scheduler class. Mostly handle scheduling items (host service) to schedule check raise alert, enter downtime etc.
Generic function to add objects into scheduler internal lists:
Brok -> self.broks Check -> self.checks Notification -> self.actions Downtime -> self.downtimes ContactDowntime -> self.contact_downtimes
Parameters: | elt – element to add |
---|---|
Returns: | None |
Add a brok into brokers list It can be for a specific one, all brokers or none (startup)
Parameters: |
|
---|---|
Returns: | None |
Add a check into checks list
Parameters: | check (alignak.check.Check) – check to add |
---|---|
Returns: | None |
Add a comment into comments list
Parameters: | comment (alignak.comment.Comment) – comment to add |
---|---|
Returns: | None |
Add a contact downtime into contact_downtimes list
Parameters: | contact_dt (alignak.contactdowntime.ContactDowntime) – contact downtime to add |
---|---|
Returns: | None |
Add a downtime into downtimes list
Parameters: | downtime (alignak.downtime.Downtime) – downtime to add |
---|---|
Returns: | None |
Add a event handler into actions list
Parameters: | action (alignak.eventhandler.EventHandler) – event handler to add |
---|---|
Returns: | None |
Resolve external command
Parameters: | ext_cmd – extermal command to run |
---|---|
Returns: | None |
Add a notification into actions list
Parameters: | notif (alignak.notification.Notification) – notification to add |
---|---|
Returns: | None |
Iter over host and service and check if any acknowledgement has expired
Returns: | None |
---|
Check for orphaned checks/actions:
* status == 'inpoller' and t_to_go < now - time_to_orphanage (300 by default)
if so raise a logger warning
Returns: | None |
---|
Reduces internal list size to max allowed
Returns: | None |
---|
Handle results waiting in waiting_results list. Check ref will call consume result and update their status
Returns: | None |
---|
Delete a comment
Parameters: | c_id (int) – comment id to delete |
---|---|
Returns: | None |
Delete a contact downtime
Parameters: | dt_id (int) – contact downtime id to delete |
---|---|
Returns: | None |
Delete a downtime
Parameters: | dt_id (int) – downtime id to delete |
---|---|
Returns: | None |
Remove actions that have a zombie status (usually timeouts)
Returns: | None |
---|
Remove checks that have a zombie status (usually timeouts)
Returns: | None |
---|
Create initial broks for a specific broker
Parameters: | |
---|---|
Returns: | None |
Get actions/checks results from passive poller/reactionners
Returns: | None |
---|
Get a check result brok for item and add it
Parameters: | item (alignak.objects.schedulingitem.SchedulingItem) – item to get brok from |
---|---|
Returns: | None |
Get a update status brok for item and add it
Parameters: | item (alignak.objects.item.Item) – item to get brok from |
---|---|
Returns: | None |
Create and add a update_program_status brok
Returns: | None |
---|
Send broks to a specific broker
Parameters: | bname (str) – broker name to send broks |
---|---|
Returns: | list of brok for this broker |
Return type: | list[alignak.brok.Brok] |
Compute the counts of the different checks status and return it as a defaultdict(int) with the keys being the different statutes and the value 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 poller link or reactionner link depending on the wanted type
Parameters: | s_type (str) – type we want |
---|---|
Returns: | links wanted |
Return type: | alignak.objects.pollerlink.PollerLinks | alignak.objects.reactionnerlink.ReactionnerLinks | None |
Call ‘get_new_actions’ hook point Iter over all hosts and services to add new actions in internal lists
Returns: | None |
---|
Iter over all hosts and services to add new broks in internal lists
Returns: | None |
---|
Same behavior than Daemon.get_objects_from_from_queues().
Returns: | |
---|---|
Return type: |
Create a program status brok
Returns: | Brok with program status data |
---|---|
Return type: | alignak.brok.Brok |
TODO: GET REAL VALUES
Get all host and service data in order to store it after The module is in charge of that
Returns: | dict containing host and service data |
---|---|
Return type: | dict |
Get state of modules and create a scheme for stats data of daemon
Returns: | A dict with the following structure |
---|
{ 'metrics': ['scheduler.%s.checks.%s %d %d', 'scheduler.%s.%s.queue %d %d',
'scheduler.%s.%s %d %d', 'scheduler.%s.latency.min %f %d',
'scheduler.%s.latency.avg %f %d', 'scheduler.%s.latency.max %f %d'],
'version': __version__,
'name': instance_name,
'type': 'scheduler',
'modules': [
{'internal': {'name': "MYMODULE1", 'state': 'ok'},
{'external': {'name': "MYMODULE2", 'state': 'stopped'},
]
'latency': {'avg': lat_avg, 'min': lat_min, 'max': lat_max}
'host': len(self.hosts),
'services': len(self.services),
'commands': [{'cmd': c, 'u_time': u_time, 's_time': s_time}, ...] (10 first)
}
Return type: | dict |
---|
Get actions/checks for reactionner/poller Called by poller to get checks Can get checks and actions (notifications and co)
Parameters: | |
---|---|
Returns: | Check/Action list with poller/reactionner tags matching and module type matching |
Return type: | list |
Generic function to call modules methods if such method is avalaible
Parameters: | hook_name (str) – function name to call |
---|
:return:None TODO: find a way to merge this and the version in daemon.py
Check if last connection was too early for element
Parameters: | elt – element to check |
---|---|
Returns: | True if now - last_connection < 5, False otherwise |
Return type: | bool |
Load configuration received from Arbiter
Parameters: | conf (alignak.objects.config.Config) – configuration to laod |
---|---|
Returns: | None |
Setter for external_command attribute
Parameters: | ecm (alignak.external_command.ExternalCommandManager) – new value |
---|---|
Returns: | None |
Setter for pollers and reactionners attributes
Parameters: |
|
---|---|
Returns: | None |
Send actions/checks to passive poller/reactionners
Returns: | None |
---|
Get result from pollers/reactionners (actives ones)
Parameters: | action – check / action / eventhandler to handle |
---|---|
Returns: | None |
Init or reinit connection to a poller or reactionner Used for passive daemons
Parameters: | |
---|---|
Returns: | None |
Reset scheduler:
* Remove waiting results
* Clear check, actions, downtimes, comments, broks lists
Returns: | None |
---|
Set topology_change attribute to False in all hosts and services
Returns: | None |
---|
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 – |
---|---|
Returns: | None |
Call hook point ‘load_retention’. Retention modules will read retention (from file, db etc)
Parameters: | forced (bool) – if update forced? |
---|---|
Returns: | None |
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
Returns: | None |
---|
Run a single external command
Parameters: | command (str) – command line to run |
---|---|
Returns: | None |
Run external commands Arbiter/Receiver sent
Parameters: | cmds (list) – commands to run |
---|---|
Returns: | None |
Generate children notifications from master notifications Also update notification number Master notification are not launched by reactionners, only children ones
Returns: | None |
---|
Iter over all hosts and services and call schedule method (schedule next check)
Returns: | None |
---|
Put broks into module queues Only broks without sent_to_sched_externals to True are sent Only modules that ask for broks will get some
Returns: | None |
---|
Iter over host and service and update business_impact
Returns: | None |
---|
Iter over all hosts and services:
* Update downtime status (start / stop) regarding maintenance period
* Register new comments in comments list
Returns: | None |
---|
This module provide SchedulerLink and SchedulerLinks classes used to manage schedulers
This module provides a Finder class for python modules. It is used to keep compatibility with Shinken modules to be able to import them.
It basically replace shinken package by alignak one
Bases: object
Finder class to import and load module
This module provide export of Alignak metrics in a statsd format
Bases: object
Stats class to export data into a statsd format
Increments a key with value
Parameters: |
|
---|---|
Returns: | None |
Init statsd instance with real values
Parameters: |
|
---|---|
Returns: | None |
This module provide a set of function for triggers Basically used to handle perfdata, exit status and output
Get all perfdatas from a service or a host
Parameters: | obj_ref (object) – |
---|---|
Returns: | dictionary with perfdatas |
Return type: | dict |
Set a service in CRITICAL state
Parameters: |
|
---|---|
Returns: | None |
Decorator to add function in trigger environment
Parameters: | function (types.FunctionType) – function to add to trigger environment |
---|
:return : the function itself only update TRIGGER_FUNCTIONS variable
Set a host in DOWN state
Parameters: |
|
---|---|
Returns: | None |
Get custom variable from a service or a host
Parameters: | |
---|---|
Returns: | |
Return type: |
Retrive object (service/host) from name
Parameters: | ref – |
---|---|
Returns: | |
Return type: |
Parameters: | ref – |
---|---|
Returns: | list of object (service/host) |
Return type: | list |
Set a service in OK state
Parameters: |
|
---|---|
Returns: | None |
Get perf data from a service
Parameters: | |
---|---|
Returns: | None |
Parameters: | |
---|---|
Returns: | list of metrics |
Return type: | list |
Set output, state and perfdata to a service or host
Parameters: |
|
---|---|
Returns: | None |
Set a service in UNKNOWN state
Parameters: |
|
---|---|
Returns: | None |
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.
Bases: exceptions.ValueError
Syntax error on a duplicate_foreach value
Compare two satellite link based on alive attribute then spare attribute
Parameters: |
|
---|---|
Returns: | x00 > y00 (1) if x00 alive and not y00 or both alive but x00 not spare x00 == y00 (0) if both alive and spare x00 < y00 (-1) else |
Return type: | int |
TODO: Rework it
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')
Parameters: |
|
---|---|
Returns: | value with macro replaced |
Return type: |
We got a file like /tmp/toto/toto2/bob.png And we want to be sure the dir /tmp/toto/toto2/ will really exists so we can copy it. Try to make if needed
Parameters: | |
---|---|
Returns: | True on success, False otherwise |
Return type: | bool |
Filter for host Filter nothing
Parameters: | name (str) – name to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for host Filter on label
Parameters: | label (str) – label to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for host Filter on group
Parameters: | group (str) – group name to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for host Filter on name
Parameters: | name (str) – name to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for host Filter on regex
Parameters: | regex (str) – regex to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for host Filter on tag
Parameters: | tpl (str) – tag to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for host Filter all
Parameters: | name (str) – name to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on label
Parameters: | label (str) – label to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on label
Parameters: | label (str) – label to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on host_name
Parameters: | host_name (str) – host_name to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on tag
Parameters: | tpl (str) – tag to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on hostgroup
Parameters: | group (str) – hostgroup to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on name
Parameters: | name (str) – name to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on regex host_name
Parameters: | regex (str) – regex to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on regex
Parameters: | regex (str) – regex to filter |
---|---|
Returns: | Filter |
Return type: | bool |
Filter for service Filter on group
Parameters: | group (str) – group to filter |
---|---|
Returns: | Filter |
Return type: | bool |
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'
Convert a bool to a int representation
Parameters: | boolean (bool) – bool to convert |
---|---|
Returns: | if boolean 1 ,else 0 |
Return type: | int |
Convert a bool to a string representation
Parameters: | boolean (bool) – bool to convert |
---|---|
Returns: | if boolean ‘1’ ,else ‘0’ |
Return type: | str |
Convert float to int
Parameters: | val (float) – value to convert |
---|---|
Returns: | int(val) |
Return type: | int |
Convert list into a comma separated string
Parameters: | val – value to convert |
---|---|
Returns: | comma separated string |
Return type: | str |
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: | |
---|---|
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': '/'}]
Get a list of keys of the custom dict without the first char
Used for macros (_name key)
Parameters: | dic (dict) – dict to parse |
---|---|
Returns: | list of keys |
Return type: | list |
Wrapper for values() method
Parameters: | dic (dict) – dict |
---|---|
Returns: | dic.values |
Return type: |
TODO: Remove it?
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 |
TODO: Missing timezone
Get the timestamp of the end (local) of a specific day
Parameters: | |
---|---|
Returns: | timestamp |
Return type: | int |
TODO: Missing timezone
Wrapepr to call obj.get_full_name or obj.get_name
Parameters: | obj (object) – object name |
---|---|
Returns: | object name |
Return type: | str |
Get object name (call get_name) if not a string
Parameters: | obj (object) – obj we wan the name |
---|---|
Returns: | object name |
Return type: | str |
Get value name (call get_name) if not a string
Parameters: |
|
---|---|
Returns: | value name |
Return type: | str |
Get the numbers of seconds elapsed since the beginning of the day (local) given by timestamp
Parameters: | timestamp (int) – time to get amount of second from |
---|---|
Returns: | timestamp |
Return type: | int |
TODO: Missing timezone
Get the timestamp of the beginning (local) of a specific day
Parameters: | |
---|---|
Returns: | timestamp |
Return type: | float |
TODO: Missing timezone
Get week day from date
Parameters: | timestamp (int) – timestamp date |
---|---|
Returns: | weekday (0-6) |
Return type: | int |
TODO: Missing timezone
Check if expression in complex
Parameters: | expr (str) – expression to parse |
---|---|
Returns: | True if ‘(‘, ‘)’, ‘&’, ‘|’, ‘!’ or ‘*’ are in expr |
Return type: | bool |
Convert an object into json (recursively on attribute)
Parameters: | obj (object) – obj to jsonify |
---|---|
Returns: | json representation of obj |
Return type: | dict |
Try to split a each member of a list with comma separator. If we don’t have to split just return val
Parameters: |
|
---|---|
Returns: | list with splitted member on comma |
Return type: | list |
>>> list_split(['a,b,c'], False)
['a,b,c']
>>> list_split(['a,b,c'])
['a', 'b', 'c']
>>> list_split('')
[]
From a tab, get the avg, min, max for the tab values, but not the lower ones and higher ones that are too distinct than major ones
Parameters: | table – list of value to compute |
---|---|
Returns: | tuple containing average, min and max value |
Return type: | tuple |
Get date (local) in asc format from timestamp
example : ‘Thu Jan 1 01:00:00 1970’ (for timestamp=0 in a EUW server)
Parameters: | timestamp – timestamp |
---|
:type timestamp; int :return: formatted time :rtype: int TODO: Missing timezone
Try to print strings, but if there is an utf8 error, go in simple ascii mode (Like if the terminal do not have en_US.UTF8 as LANG for example)
Parameters: | args – args to print |
---|---|
Returns: | None |
Compare two satellite link based on spare attribute(scheduler usually)
Parameters: |
|
---|---|
Returns: | x00 > y00 (1) if x00.spare and not y00.spare, x00 == y00 (0) if both spare, x00 < y00 (-1) else |
Return type: | int |
Compare x00, y00 base on their id
Parameters: | |
---|---|
Returns: | x00 > y00 (1) if x00._id > y00._id, x00 == y00 (0) if id equals, x00 < y00 (-1) else |
Return type: | int |
Split a line on semicolons characters but not on the escaped semicolons
Parameters: |
|
---|
:type maxsplitL int :return: splitted line :rtype: 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']
Strip every element of a list and keep unique values
Parameters: | tab (list) – list to strip |
---|---|
Returns: | stripped list with unique values |
Return type: | list |
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
Convert value to bool
Parameters: | val – value to convert |
---|---|
Returns: | True if val == ‘1’ or val == ‘on’ or val == ‘true’ or val == ‘True’, else False |
Return type: | bool |
Get first character of val (or raise Exception)
Parameters: | val – value we get head |
---|---|
Returns: | val[0] |
Return type: | str |
Convert val to float (or raise Exception)
Parameters: | val – value to convert |
---|---|
Returns: | float(val) |
Return type: | float |
Convert Host list into a list of host_name
Parameters: |
|
---|---|
Returns: | host_name list |
Return type: | list |
Convert val to int (or raise Exception)
Parameters: | val – value to convert |
---|---|
Returns: | int(float(val)) |
Return type: | int |
Convert list into a list of element name
Parameters: |
|
---|---|
Returns: | list of names |
Return type: | list |
Convert list into a comma separated list of element name
Parameters: |
|
---|---|
Returns: | comma separated string of names |
Return type: | str |
Try to get value name (call get_name method)
Parameters: |
|
---|---|
Returns: | name or ‘’ |
Return type: | str |
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: |
|
---|---|
Returns: | splitted 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('')
[]
create a dict with 2 lists:
* services: all services of the tab
* hosts: all hosts of the tab
Parameters: |
|
---|---|
Returns: | dict with hosts and services names |
Return type: | dict |
Get last elem of val if it is a list Else return val 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 |
TODO: Raise erro/warning instead of silently removing something
This module provide Alignak current version
This module provide Worker class. It is used to spawn new processes in Poller and Reactionner
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.s) (slave) 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)
Increment idletime
Parameters: | time (int) – time to increment in seconds |
---|---|
Returns: | None |
Check if our system time change. If so, change our
Returns: | 0 if the difference < 900, difference else |
---|---|
Return type: | int |
Main function of the worker. * Get checks * Launch new checks * Manage finished checks
Parameters: |
|
---|---|
Returns: | None |
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 |
---|
Wrapper for calling is_alive method of the process attribute
Returns: | A boolean indicating if the process is alive |
---|---|
Return type: | bool |
Determine whether a process is killable :
Returns: | a boolean indicating if it is killable |
---|---|
Return type: | bool |
Accessor to _mortal attribute
Returns: | A boolean indicating if the worker is mortal or not. |
---|---|
Return type: | bool |
Wrapper for calling join method of the process attribute
Parameters: | timeout (int) – time to wait for the process to terminate |
---|---|
Returns: | None |
Launch checks that are in status REF: doc/alignak-action-queues.png (4)
Returns: | None |
---|
Check the status of checks if done, return message finished :) REF: doc/alignak-action-queues.png (5)
Returns: | None |
---|
Wrapper for calling put method of the _control_q attribute
Parameters: | msg (str) – the message to put in queue |
---|---|
Returns: | None |
Start the worker. Wrapper for calling start method of the process attribute
Returns: | None |
---|
Wrapper for calling terminate method of the process attribute Also close queues (input and output) and terminate queues thread
Returns: | None |
---|
Wrapper function for work in order to catch the exception to see the real work, look at do_work
Parameters: |
|
---|---|
Returns: | None |
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.