_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q236200
Scheduler.find_item_by_id
train
def find_item_by_id(self, object_id): """Get item based on its id or uuid :param object_id: :type object_id: int | str :return: :rtype: alignak.objects.item.Item | None """ # Item id may be an item if isinstance(object_id, Item): return object...
python
{ "resource": "" }
q236201
Scheduler.before_run
train
def before_run(self): """Initialize the scheduling process""" # Actions and checks counters self.nb_checks = 0 self.nb_internal_checks = 0 self.nb_checks_launched = 0 self.nb_actions_launched = 0 self.nb_checks_results = 0 self.nb_checks_results_timeout =...
python
{ "resource": "" }
q236202
Receiver.setup_new_conf
train
def setup_new_conf(self): """Receiver custom setup_new_conf method This function calls the base satellite treatment and manages the configuration needed for a receiver daemon: - get and configure its satellites - configure the modules :return: None """ #...
python
{ "resource": "" }
q236203
Receiver.get_external_commands_from_arbiters
train
def get_external_commands_from_arbiters(self): """Get external commands from our arbiters As of now, only the arbiter are requested to provide their external commands that the receiver will push to all the known schedulers to make them being executed. :return: None """ ...
python
{ "resource": "" }
q236204
Receiver.push_external_commands_to_schedulers
train
def push_external_commands_to_schedulers(self): """Push received external commands to the schedulers :return: None """ if not self.unprocessed_external_commands: return # Those are the global external commands commands_to_process = self.unprocessed_external_...
python
{ "resource": "" }
q236205
Receiver.do_loop_turn
train
def do_loop_turn(self): """Receiver daemon main loop :return: None """ # Begin to clean modules self.check_and_del_zombie_modules() # Maybe the arbiter pushed a new configuration... if self.watch_for_new_conf(timeout=0.05): logger.info("I got a new ...
python
{ "resource": "" }
q236206
Check.serialize
train
def serialize(self): """This function serializes into a simple dict object. The only usage is to send to poller, and it does not need to have the depend_on and depend_on_me properties. :return: json representation of a Check :rtype: dict """ res = super(Check, s...
python
{ "resource": "" }
q236207
AlignakObject.serialize
train
def serialize(self): """This function serializes into a simple dictionary object. It is used when transferring data to other daemons over the network (http) Here is the generic function that simply export attributes declared in the properties dictionary of the object. Note tha...
python
{ "resource": "" }
q236208
AlignakObject.fill_default
train
def fill_default(self): """ Define the object properties with a default value when the property is not yet defined :return: None """ for prop, entry in self.__class__.properties.items(): if hasattr(self, prop): continue if not hasattr(entr...
python
{ "resource": "" }
q236209
Host.fill_predictive_missing_parameters
train
def fill_predictive_missing_parameters(self): """Fill address with host_name if not already set and define state with initial_state :return: None """ if hasattr(self, 'host_name') and not hasattr(self, 'address'): self.address = self.host_name if hasattr(self...
python
{ "resource": "" }
q236210
Host.get_groupnames
train
def get_groupnames(self, hostgroups): """Get names of the host's hostgroups :return: comma separated names of hostgroups alphabetically sorted :rtype: str """ group_names = [] for hostgroup_id in self.hostgroups: hostgroup = hostgroups[hostgroup_id] ...
python
{ "resource": "" }
q236211
Host.get_groupaliases
train
def get_groupaliases(self, hostgroups): """Get aliases of the host's hostgroups :return: comma separated aliases of hostgroups alphabetically sorted :rtype: str """ group_aliases = [] for hostgroup_id in self.hostgroups: hostgroup = hostgroups[hostgroup_id] ...
python
{ "resource": "" }
q236212
Host.set_state_from_exit_status
train
def set_state_from_exit_status(self, status, notif_period, hosts, services): """Set the state in UP, DOWN, or UNREACHABLE according to the status of a check result. :param status: integer between 0 and 3 (but not 1) :type status: int :return: None """ now = time.time() ...
python
{ "resource": "" }
q236213
Host.is_state
train
def is_state(self, status): """Return if status match the current host status :param status: status to compare ( "o", "d", "x"). Usually comes from config files :type status: str :return: True if status <=> self.status, otherwise False :rtype: bool """ if status ...
python
{ "resource": "" }
q236214
Host.last_time_non_ok_or_up
train
def last_time_non_ok_or_up(self): """Get the last time the host was in a non-OK state :return: self.last_time_down if self.last_time_down > self.last_time_up, 0 otherwise :rtype: int """ non_ok_times = [x for x in [self.last_time_down] if x > self.last_ti...
python
{ "resource": "" }
q236215
Host.notification_is_blocked_by_contact
train
def notification_is_blocked_by_contact(self, notifways, timeperiods, notif, contact): """Check if the notification is blocked by this contact. :param notif: notification created earlier :type notif: alignak.notification.Notification :param contact: contact we want to notify :typ...
python
{ "resource": "" }
q236216
Host._tot_services_by_state
train
def _tot_services_by_state(self, services, state): """Get the number of service in the specified state :param state: state to filter service :type state: :return: number of service with s.state_id == state :rtype: int """ return str(sum(1 for s in self.services ...
python
{ "resource": "" }
q236217
Host.get_overall_state
train
def get_overall_state(self, services): """Get the host overall state including the host self status and the status of its services Compute the host overall state identifier, including: - the acknowledged state - the downtime state The host overall state is (prioritized)...
python
{ "resource": "" }
q236218
Hosts.linkify_h_by_h
train
def linkify_h_by_h(self): """Link hosts with their parents :return: None """ for host in self: # The new member list new_parents = [] for parent in getattr(host, 'parents', []): parent = parent.strip() o_parent = self.f...
python
{ "resource": "" }
q236219
Hosts.linkify_h_by_hg
train
def linkify_h_by_hg(self, hostgroups): """Link hosts with hostgroups :param hostgroups: hostgroups object to link with :type hostgroups: alignak.objects.hostgroup.Hostgroups :return: None """ # Register host in the hostgroups for host in self: new_hos...
python
{ "resource": "" }
q236220
Hosts.apply_dependencies
train
def apply_dependencies(self): """Loop on hosts and register dependency between parent and son call Host.fill_parents_dependency() :return: None """ for host in self: for parent_id in getattr(host, 'parents', []): if parent_id is None: ...
python
{ "resource": "" }
q236221
Hosts.find_hosts_that_use_template
train
def find_hosts_that_use_template(self, tpl_name): """Find hosts that use the template defined in argument tpl_name :param tpl_name: the template name we filter or :type tpl_name: str :return: list of the host_name of the hosts that got the template tpl_name in tags :rtype: list[...
python
{ "resource": "" }
q236222
ArbiterLink.is_me
train
def is_me(self): # pragma: no cover, seems not to be used anywhere """Check if parameter name if same than name of this object TODO: is it useful? :return: true if parameter name if same than this name :rtype: bool """ logger.info("And arbiter is launched with the host...
python
{ "resource": "" }
q236223
ArbiterLink.do_not_run
train
def do_not_run(self): """Check if satellite running or not If not, try to run :return: true if satellite not running :rtype: bool """ logger.debug("[%s] do_not_run", self.name) try: self.con.get('_do_not_run') return True except H...
python
{ "resource": "" }
q236224
Alignak.get_broks
train
def get_broks(self, broker_name): """Send broks to a specific broker :param broker_name: broker name to send broks :type broker_name: str :greturn: dict of brok for this broker :rtype: dict[alignak.brok.Brok] """ logger.debug("Broker %s requests my broks list", b...
python
{ "resource": "" }
q236225
Alignak.do_loop_turn
train
def do_loop_turn(self): """Scheduler loop turn Simply run the Alignak scheduler loop This is called when a configuration got received by the scheduler daemon. As of it, check if the first scheduling has been done... and manage this. :return: None """ if not sel...
python
{ "resource": "" }
q236226
Alignak.get_managed_configurations
train
def get_managed_configurations(self): """Get the configurations managed by this scheduler The configuration managed by a scheduler is the self configuration got by the scheduler during the dispatching. :return: a dict of scheduler links with instance_id as key and hash, push_fl...
python
{ "resource": "" }
q236227
Alignak.clean_previous_run
train
def clean_previous_run(self): """Clean variables from previous configuration :return: None """ # Execute the base class treatment... super(Alignak, self).clean_previous_run() # Clean all lists self.pollers.clear() self.reactionners.clear() self.b...
python
{ "resource": "" }
q236228
Alignak.get_monitoring_problems
train
def get_monitoring_problems(self): """Get the current scheduler livesynthesis :return: live synthesis and problems dictionary :rtype: dict """ res = {} if not self.sched: return res # Get statistics from the scheduler scheduler_stats = self.s...
python
{ "resource": "" }
q236229
ServicesExtInfo.merge_extinfo
train
def merge_extinfo(service, extinfo): """Merge extended host information into a service :param service: the service to edit :type service: alignak.objects.service.Service :param extinfo: the external info we get data from :type extinfo: alignak.objects.serviceextinfo.ServiceExtIn...
python
{ "resource": "" }
q236230
CommandCall.get_command_and_args
train
def get_command_and_args(self): r"""We want to get the command and the args with ! splitting. but don't forget to protect against the \! to avoid splitting on them Remember: A Nagios-like command is command_name!arg1!arg2!... :return: None """ # First protect p...
python
{ "resource": "" }
q236231
SatelliteLink.get_a_satellite_link
train
def get_a_satellite_link(sat_type, sat_dict): """Get a SatelliteLink object for a given satellite type and a dictionary :param sat_type: type of satellite :param sat_dict: satellite configuration data :return: """ cls = get_alignak_class('alignak.objects.%slink.%sLink' %...
python
{ "resource": "" }
q236232
SatelliteLink.get_livestate
train
def get_livestate(self): """Get the SatelliteLink live state. The live state is a tuple information containing a state identifier and a message, where: state is: - 0 for an up and running satellite - 1 if the satellite is not reachale - 2 if the satellite...
python
{ "resource": "" }
q236233
SatelliteLink.get_and_clear_context
train
def get_and_clear_context(self): """Get and clean all of our broks, actions, external commands and homerun :return: list of all broks of the satellite link :rtype: list """ res = (self.broks, self.actions, self.wait_homerun, self.pushed_commands) self.broks = [] ...
python
{ "resource": "" }
q236234
SatelliteLink.prepare_for_conf
train
def prepare_for_conf(self): """Initialize the pushed configuration dictionary with the inner properties that are to be propagated to the satellite link. :return: None """ logger.debug("- preparing: %s", self) self.cfg = { 'self_conf': self.give_satellite_cfg(...
python
{ "resource": "" }
q236235
SatelliteLink.give_satellite_cfg
train
def give_satellite_cfg(self): """Get the default information for a satellite. Overridden by the specific satellites links :return: dictionary of information common to all the links :rtype: dict """ # All the satellite link class properties that are 'to_send' are stored ...
python
{ "resource": "" }
q236236
SatelliteLink.give_satellite_json
train
def give_satellite_json(self): """Get the json information for a satellite. This to provide information that will be exposed by a daemon on its HTTP interface. :return: dictionary of information common to all the links :rtype: dict """ daemon_properties = ['type', 'name...
python
{ "resource": "" }
q236237
SatelliteLink.manages
train
def manages(self, cfg_part): """Tell if the satellite is managing this configuration part The managed configuration is formed as a dictionary indexed on the link instance_id: { u'SchedulerLink_1': { u'hash': u'4d08630a3483e1eac7898e7a721bd5d7768c8320', ...
python
{ "resource": "" }
q236238
SatelliteLink.set_alive
train
def set_alive(self): """Set alive, reachable, and reset attempts. If we change state, raise a status brok update alive, means the daemon is prenset in the system reachable, means that the HTTP connection is valid With this function we confirm that the daemon is reachable and, t...
python
{ "resource": "" }
q236239
SatelliteLink.add_failed_check_attempt
train
def add_failed_check_attempt(self, reason=''): """Set the daemon as unreachable and add a failed attempt if we reach the maximum attempts, set the daemon as dead :param reason: the reason of adding an attempts (stack trace sometimes) :type reason: str :return: None """ ...
python
{ "resource": "" }
q236240
SatelliteLink.valid_connection
train
def valid_connection(*outer_args, **outer_kwargs): # pylint: disable=unused-argument, no-method-argument """Check if the daemon connection is established and valid""" def decorator(func): # pylint: disable=missing-docstring def decorated(*args, **kwargs): # pylint: disable=missing-...
python
{ "resource": "" }
q236241
SatelliteLink.communicate
train
def communicate(*outer_args, **outer_kwargs): # pylint: disable=unused-argument, no-method-argument """Check if the daemon connection is authorized and valid""" def decorator(func): # pylint: disable=missing-docstring def decorated(*args, **kwargs): # pylint: disable=missing-docstr...
python
{ "resource": "" }
q236242
SatelliteLink.stop_request
train
def stop_request(self, stop_now=False): """Send a stop request to the daemon :param stop_now: stop now or go to stop wait mode :type stop_now: bool :return: the daemon response (True) """ logger.debug("Sending stop request to %s, stop now: %s", self.name, stop_now) ...
python
{ "resource": "" }
q236243
SatelliteLink.update_infos
train
def update_infos(self, forced=False, test=False): """Update satellite info each self.polling_interval seconds so we smooth arbiter actions for just useful actions. Raise a satellite update status Brok If forced is True, then ignore the ping period. This is used when the configuration ...
python
{ "resource": "" }
q236244
SatelliteLink.push_actions
train
def push_actions(self, actions, scheduler_instance_id): """Post the actions to execute to the satellite. Indeed, a scheduler post its checks to a poller and its actions to a reactionner. :param actions: Action list to send :type actions: list :param scheduler_instance_id: Schedu...
python
{ "resource": "" }
q236245
SatelliteLinks.linkify
train
def linkify(self, modules): """Link modules and Satellite links :param modules: Module object list :type modules: alignak.objects.module.Modules :return: None """ logger.debug("Linkify %s with %s", self, modules) self.linkify_s_by_module(modules)
python
{ "resource": "" }
q236246
Notification.get_return_from
train
def get_return_from(self, notif): """Setter of exit_status and execution_time attributes :param notif: notification to get data from :type notif: alignak.notification.Notification :return: None """ self.exit_status = notif.exit_status self.execution_time = notif....
python
{ "resource": "" }
q236247
Notification.get_initial_status_brok
train
def get_initial_status_brok(self): """Get a initial status brok :return: brok with wanted data :rtype: alignak.brok.Brok """ data = {'uuid': self.uuid} self.fill_data_brok_from(data, 'full_status') return Brok({'type': 'notification_raise', 'data': data})
python
{ "resource": "" }
q236248
Broker.manage_brok
train
def manage_brok(self, brok): """Get a brok. We put brok data to the modules :param brok: object with data :type brok: object :return: None """ # Unserialize the brok before consuming it brok.prepare() for module in self.modules_manager.get_intern...
python
{ "resource": "" }
q236249
Broker.get_internal_broks
train
def get_internal_broks(self): """Get all broks from self.broks_internal_raised and append them to our broks to manage :return: None """ statsmgr.gauge('get-new-broks-count.broker', len(self.internal_broks)) # Add the broks to our global list self.external_broks.e...
python
{ "resource": "" }
q236250
Broker.get_arbiter_broks
train
def get_arbiter_broks(self): """Get the broks from the arbiters, but as the arbiter_broks list can be push by arbiter without Global lock, we must protect this with a lock TODO: really? check this arbiter behavior! :return: None """ with self.arbiter_broks_lock:...
python
{ "resource": "" }
q236251
Broker.get_new_broks
train
def get_new_broks(self): """Get new broks from our satellites :return: None """ for satellites in [self.schedulers, self.pollers, self.reactionners, self.receivers]: for satellite_link in list(satellites.values()): logger.debug("Getting broks from %s", satell...
python
{ "resource": "" }
q236252
Realm.add_group_members
train
def add_group_members(self, members): """Add a new group member to the groups list :param members: member name :type members: str :return: None """ if not isinstance(members, list): members = [members] if not getattr(self, 'group_members', None): ...
python
{ "resource": "" }
q236253
Realm.get_realms_by_explosion
train
def get_realms_by_explosion(self, realms): """Get all members of this realm including members of sub-realms on multi-levels :param realms: realms list, used to look for a specific one :type realms: alignak.objects.realm.Realms :return: list of members and add realm to realm_members attr...
python
{ "resource": "" }
q236254
Realm.set_level
train
def set_level(self, level, realms): """Set the realm level in the realms hierarchy :return: None """ self.level = level if not self.level: logger.info("- %s", self.get_name()) else: logger.info(" %s %s", '+' * self.level, self.get_name()) ...
python
{ "resource": "" }
q236255
Realm.get_all_subs_satellites_by_type
train
def get_all_subs_satellites_by_type(self, sat_type, realms): """Get all satellites of the wanted type in this realm recursively :param sat_type: satellite type wanted (scheduler, poller ..) :type sat_type: :param realms: all realms :type realms: list of realm object :ret...
python
{ "resource": "" }
q236256
Realm.get_links_for_a_broker
train
def get_links_for_a_broker(self, pollers, reactionners, receivers, realms, manage_sub_realms=False): """Get a configuration dictionary with pollers, reactionners and receivers links for a broker :param pollers: pollers :type pollers: :param reactio...
python
{ "resource": "" }
q236257
Realm.get_links_for_a_scheduler
train
def get_links_for_a_scheduler(self, pollers, reactionners, brokers): """Get a configuration dictionary with pollers, reactionners and brokers links for a scheduler :return: dict containing pollers, reactionners and brokers links (key is satellite id) :rtype: dict """ # ...
python
{ "resource": "" }
q236258
Realms.explode
train
def explode(self): """Explode realms with each realm_members and higher_realms to get all the realms sub realms. :return: None """ # Manage higher realms where defined for realm in [tmp_realm for tmp_realm in self if tmp_realm.higher_realms]: for parent in re...
python
{ "resource": "" }
q236259
Realms.get_default
train
def get_default(self, check=False): """Get the default realm :param check: check correctness if True :type check: bool :return: Default realm of Alignak configuration :rtype: alignak.objects.realm.Realm | None """ found = [] for realm in sorted(self, key=...
python
{ "resource": "" }
q236260
ArbiterInterface.reload_configuration
train
def reload_configuration(self): """Ask to the arbiter to reload the monitored configuration **Note** tha the arbiter will not reload its main configuration file (eg. alignak.ini) but it will reload the monitored objects from the Nagios legacy files or from the Alignak backend! ...
python
{ "resource": "" }
q236261
ArbiterInterface.command
train
def command(self, command=None, timestamp=None, element=None, host=None, service=None, user=None, parameters=None): # pylint: disable=too-many-branches """ Request to execute an external command Allowed parameters are: `command`: mandatory parameter containing the whole ...
python
{ "resource": "" }
q236262
ArbiterInterface.monitoring_problems
train
def monitoring_problems(self): """Get Alignak detailed monitoring status This will return an object containing the properties of the `identity`, plus a `problems` object which contains 2 properties for each known scheduler: - _freshness, which is the timestamp when the provided data wer...
python
{ "resource": "" }
q236263
ArbiterInterface.livesynthesis
train
def livesynthesis(self): """Get Alignak live synthesis This will return an object containing the properties of the `identity`, plus a `livesynthesis` object which contains 2 properties for each known scheduler: - _freshness, which is the timestamp when the provided data were fet...
python
{ "resource": "" }
q236264
ArbiterInterface.object
train
def object(self, o_type, o_name=None): """Get a monitored object from the arbiter. Indeed, the arbiter requires the object from its schedulers. It will iterate in its schedulers list until a matching object is found. Else it will return a Json structure containing _status and _message p...
python
{ "resource": "" }
q236265
ArbiterInterface.status
train
def status(self, details=False): """Get the overall alignak status Returns a list of the satellites as in: { services: [ { livestate: { perf_data: "", timestamp: 1532106561, s...
python
{ "resource": "" }
q236266
ArbiterInterface.events_log
train
def events_log(self, details=False, count=0, timestamp=0): """Get the most recent Alignak events If count is specifies it is the maximum number of events to return. If timestamp is specified, events older than this timestamp will not be returned The arbiter maintains a list of the mos...
python
{ "resource": "" }
q236267
ArbiterInterface.satellites_list
train
def satellites_list(self, daemon_type=''): """Get the arbiter satellite names sorted by type Returns a list of the satellites as in: { reactionner: [ "reactionner-master" ], broker: [ "broker-master" ], ...
python
{ "resource": "" }
q236268
ArbiterInterface.satellites_configuration
train
def satellites_configuration(self): """Return all the configuration data of satellites :return: dict containing satellites data Output looks like this :: {'arbiter' : [{'property1':'value1' ..}, {'property2', 'value11' ..}, ..], 'scheduler': [..], 'poller': [..], ...
python
{ "resource": "" }
q236269
ArbiterInterface.external_commands
train
def external_commands(self): """Get the external commands from the daemon Use a lock for this function to protect :return: serialized external command list :rtype: str """ res = [] with self.app.external_commands_lock: for cmd in self.app.get_externa...
python
{ "resource": "" }
q236270
ArbiterInterface.search
train
def search(self): # pylint: disable=no-self-use """ Request available queries Posted data: {u'target': u''} Return the list of available target queries :return: See upper comment :rtype: list """ logger.debug("Grafana search... %s", cherrypy.request.me...
python
{ "resource": "" }
q236271
ArbiterInterface._build_host_livestate
train
def _build_host_livestate(self, host_name, livestate): # pylint: disable=no-self-use, too-many-locals """Build and notify the external command for an host livestate PROCESS_HOST_CHECK_RESULT;<host_name>;<status_code>;<plugin_output> :param host_name: the concerned host name :pa...
python
{ "resource": "" }
q236272
ArbiterInterface._build_service_livestate
train
def _build_service_livestate(self, host_name, service_name, livestate): # pylint: disable=no-self-use, too-many-locals """Build and notify the external command for a service livestate PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<return_code>;<plugin_output> Create an...
python
{ "resource": "" }
q236273
ArbiterInterface._do_not_run
train
def _do_not_run(self): """The master arbiter tells to its spare arbiters to not run. A master arbiter will ignore this request and it will return an object containing some properties: '_status': 'ERR' because of the error `_message`: some more explanations about the error ...
python
{ "resource": "" }
q236274
CommandCallItems.create_commandcall
train
def create_commandcall(prop, commands, command): """ Create CommandCall object with command :param prop: property :type prop: str :param commands: all commands :type commands: alignak.objects.command.Commands :param command: a command object :type command...
python
{ "resource": "" }
q236275
BrokerInterface._push_broks
train
def _push_broks(self): """Push the provided broks objects to the broker daemon Only used on a Broker daemon by the Arbiter :param: broks :type: list :return: None """ data = cherrypy.request.json with self.app.arbiter_broks_lock: logger.debug...
python
{ "resource": "" }
q236276
Config.load_params
train
def load_params(self, params): """Load parameters from main configuration file :param params: parameters list (converted right at the beginning) :type params: :return: None """ logger.debug("Alignak parameters:") for key, value in sorted(self.clean_params(params)...
python
{ "resource": "" }
q236277
Config._cut_line
train
def _cut_line(line): """Split the line on whitespaces and remove empty chunks :param line: the line to split :type line: str :return: list of strings :rtype: list """ # punct = '"#$%&\'()*+/<=>?@[\\]^`{|}~' if re.search("([\t\n\r]+|[\x0b\x0c ]{3,})+", lin...
python
{ "resource": "" }
q236278
Config.add_self_defined_objects
train
def add_self_defined_objects(raw_objects): """Add self defined command objects for internal processing ; bp_rule, _internal_host_up, _echo, _internal_host_check, _interna_service_check :param raw_objects: Raw config objects dict :type raw_objects: dict :return: raw_objects with ...
python
{ "resource": "" }
q236279
Config.early_create_objects
train
def early_create_objects(self, raw_objects): """Create the objects needed for the post configuration file initialization :param raw_objects: dict with all object with str values :type raw_objects: dict :return: None """ types_creations = self.__class__.types_creations ...
python
{ "resource": "" }
q236280
Config.create_objects
train
def create_objects(self, raw_objects): """Create all the objects got after the post configuration file initialization :param raw_objects: dict with all object with str values :type raw_objects: dict :return: None """ types_creations = self.__class__.types_creations ...
python
{ "resource": "" }
q236281
Config.create_objects_for_type
train
def create_objects_for_type(self, raw_objects, o_type): """Generic function to create objects regarding the o_type This function create real Alignak objects from the raw data got from the configuration. :param raw_objects: Raw objects :type raw_objects: dict :param o_type: the ...
python
{ "resource": "" }
q236282
Config.early_arbiter_linking
train
def early_arbiter_linking(self, arbiter_name, params): """ Prepare the arbiter for early operations :param arbiter_name: default arbiter name if no arbiter exist in the configuration :type arbiter_name: str :return: None """ if not self.arbiters: params.upda...
python
{ "resource": "" }
q236283
Config.linkify_one_command_with_commands
train
def linkify_one_command_with_commands(self, commands, prop): """ Link a command :param commands: object commands :type commands: object :param prop: property name :type prop: str :return: None """ if not hasattr(self, prop): return ...
python
{ "resource": "" }
q236284
Config.linkify
train
def linkify(self): """ Make 'links' between elements, like a host got a services list with all its services in it :return: None """ self.services.optimize_service_search(self.hosts) # First linkify myself like for some global commands self.linkify_one_command_w...
python
{ "resource": "" }
q236285
Config.clean
train
def clean(self): """Wrapper for calling the clean method of services attribute :return: None """ logger.debug("Cleaning configuration objects before configuration sending:") types_creations = self.__class__.types_creations for o_type in types_creations: (_, _...
python
{ "resource": "" }
q236286
Config.warn_about_unmanaged_parameters
train
def warn_about_unmanaged_parameters(self): """used to raise warning if the user got parameter that we do not manage from now :return: None """ properties = self.__class__.properties unmanaged = [] for prop, entry in list(properties.items()): if not en...
python
{ "resource": "" }
q236287
Config.apply_dependencies
train
def apply_dependencies(self): """Creates dependencies links between elements. :return: None """ self.hosts.apply_dependencies() self.services.apply_dependencies(self.hosts)
python
{ "resource": "" }
q236288
Config.fill_default_configuration
train
def fill_default_configuration(self): """Fill objects properties with default value if necessary :return: None """ logger.debug("Filling the unset properties with their default value:") types_creations = self.__class__.types_creations for o_type in types_creations: ...
python
{ "resource": "" }
q236289
Config.log_daemons_list
train
def log_daemons_list(self): """Log Alignak daemons list :return: """ daemons = [self.arbiters, self.schedulers, self.pollers, self.brokers, self.reactionners, self.receivers] for daemons_list in daemons: if not daemons_list: logger....
python
{ "resource": "" }
q236290
Config.got_broker_module_type_defined
train
def got_broker_module_type_defined(self, module_type): """Check if a module type is defined in one of the brokers :param module_type: module type to search for :type module_type: str :return: True if mod_type is found else False :rtype: bool """ for broker_link i...
python
{ "resource": "" }
q236291
Config.got_scheduler_module_type_defined
train
def got_scheduler_module_type_defined(self, module_type): """Check if a module type is defined in one of the schedulers :param module_type: module type to search for :type module_type: str :return: True if mod_type is found else False :rtype: bool TODO: Factorize it with...
python
{ "resource": "" }
q236292
Config.got_arbiter_module_type_defined
train
def got_arbiter_module_type_defined(self, module_type): """Check if a module type is defined in one of the arbiters Also check the module name :param module_type: module type to search for :type module_type: str :return: True if mod_type is found else False :rtype: bool ...
python
{ "resource": "" }
q236293
Config.create_business_rules
train
def create_business_rules(self): """Create business rules for hosts and services :return: None """ self.hosts.create_business_rules(self.hosts, self.services, self.hostgroups, self.servicegroups, self.macr...
python
{ "resource": "" }
q236294
Config.create_business_rules_dependencies
train
def create_business_rules_dependencies(self): """Create business rules dependencies for hosts and services :return: None """ for item in itertools.chain(self.hosts, self.services): if not item.got_business_rule: continue bp_items = item.business...
python
{ "resource": "" }
q236295
Config.propagate_timezone_option
train
def propagate_timezone_option(self): """Set our timezone value and give it too to unset satellites :return: None """ if self.use_timezone: # first apply myself os.environ['TZ'] = self.use_timezone time.tzset() tab = [self.schedulers, self...
python
{ "resource": "" }
q236296
Config.linkify_templates
train
def linkify_templates(self): """ Like for normal object, we link templates with each others :return: None """ self.hosts.linkify_templates() self.contacts.linkify_templates() self.services.linkify_templates() self.servicedependencies.linkify_templates() s...
python
{ "resource": "" }
q236297
Config.remove_templates
train
def remove_templates(self): """Clean useless elements like templates because they are not needed anymore :return: None """ self.hosts.remove_templates() self.contacts.remove_templates() self.services.remove_templates() self.servicedependencies.remove_templates() ...
python
{ "resource": "" }
q236298
Config.show_errors
train
def show_errors(self): """ Loop over configuration warnings and log them as INFO log Loop over configuration errors and log them as INFO log Note that the warnings and errors are logged on the fly during the configuration parsing. It is not necessary to log as WARNING and ERROR ...
python
{ "resource": "" }
q236299
Config.prepare_for_sending
train
def prepare_for_sending(self): """The configuration needs to be serialized before being sent to a spare arbiter :return: None """ if [arbiter_link for arbiter_link in self.arbiters if arbiter_link.spare]: logger.info('Serializing the configuration for my spare arbiter...') ...
python
{ "resource": "" }