Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def _get_object(self, o_type, o_name=None): try: o_found = None o_list = self._get_objects(o_type) if o_list: if o_name is None: return serialize(o_list, True) if o_list else None ...
[ "Get an object from the scheduler\n\n Returns None if the required object type (`o_type`) is not known.\n Else returns the serialized object if found. The object is searched first with\n o_name as its name and then with o_name as its uuid.\n\n :param o_type: searched object type\n ...
Please provide a description of the function:def is_a_module(self, module_type): if hasattr(self, 'type'): return module_type in self.type return module_type in self.module_types
[ "\n Is the module of the required type?\n\n :param module_type: module type to check\n :type: str\n :return: True / False\n " ]
Please provide a description of the function:def serialize(self): res = super(Module, self).serialize() cls = self.__class__ for prop in self.__dict__: if prop in cls.properties or prop in cls.running_properties or prop in ['properties', ...
[ "A module may have some properties that are not defined in the class properties list.\n Serializing a module is the same as serializing an Item but we also also include all the\n existing properties that are not defined in the properties or running_properties\n class list.\n\n We must al...
Please provide a description of the function:def linkify_s_by_plug(self): for module in self: new_modules = [] for related in getattr(module, 'modules', []): related = related.strip() if not related: continue o_...
[ "Link a module to some other modules\n\n :return: None\n " ]
Please provide a description of the function:def get_start_of_day(year, month, day): # DST is not known in the provided date try: timestamp = time.mktime((year, month, day, 00, 00, 00, 0, 0, -1)) except (OverflowError, ValueError): # Windows mktime sometimes crashes on (1970, 1, 1, ...)...
[ "Get the timestamp associated to the first second of a specific day\n\n :param year: date year\n :type year: int\n :param month: date month\n :type month: int\n :param day: date day\n :type day: int\n :return: timestamp\n :rtype: int\n " ]
Please provide a description of the function:def get_end_of_day(year, month, day): # DST is not known in the provided date timestamp = time.mktime((year, month, day, 23, 59, 59, 0, 0, -1)) return int(timestamp)
[ "Get the timestamp associated to the last second of a specific day\n\n :param year: date year\n :type year: int\n :param month: date month (int)\n :type month: int\n :param day: date day\n :type day: int\n :return: timestamp\n :rtype: int\n " ]
Please provide a description of the function:def get_sec_from_morning(timestamp): t_lt = time.localtime(timestamp) return t_lt.tm_hour * 3600 + t_lt.tm_min * 60 + t_lt.tm_sec
[ "Get the number of seconds elapsed since the beginning of the\n day deducted from the provided timestamp\n\n :param timestamp: time to use for computation\n :type timestamp: int\n :return: timestamp\n :rtype: int\n " ]
Please provide a description of the function:def find_day_by_weekday_offset(year, month, weekday, offset): # thanks calendar :) cal = calendar.monthcalendar(year, month) # If we ask for a -1 day, just reverse cal if offset < 0: offset = abs(offset) cal.reverse() # ok go for it...
[ "Get the day number based on a date and offset\n\n :param year: date year\n :type year: int\n :param month: date month\n :type month: int\n :param weekday: date week day\n :type weekday: int\n :param offset: offset (-1 is last, 1 is first etc)\n :type offset: int\n :return: day number in ...
Please provide a description of the function:def find_day_by_offset(year, month, offset): (_, days_in_month) = calendar.monthrange(year, month) if offset >= 0: return min(offset, days_in_month) return max(1, days_in_month + offset + 1)
[ "Get the month day based on date and offset\n\n :param year: date year\n :type year: int\n :param month: date month\n :type month: int\n :param offset: offset in day to compute (usually negative)\n :type offset: int\n :return: day number in the month\n :rtype: int\n\n >>> find_day_by_offs...
Please provide a description of the function:def serialize(self): return {"hstart": self.hstart, "mstart": self.mstart, "hend": self.hend, "mend": self.mend, "is_valid": self.is_valid}
[ "This function serialize into a simple dict object.\n It is used when transferring data to other daemons over the network (http)\n\n Here we directly return all attributes\n\n :return: json representation of a Timerange\n :rtype: dict\n " ]
Please provide a description of the function:def get_first_sec_out_from_morning(self): # If start at 0:0, the min out is the end if self.hstart == 0 and self.mstart == 0: return self.hend * 3600 + self.mend * 60 return 0
[ "Get the first second (from midnight) where we are out of the timerange\n\n :return: seconds from midnight where timerange is not effective\n :rtype: int\n " ]
Please provide a description of the function:def is_time_valid(self, timestamp): sec_from_morning = get_sec_from_morning(timestamp) return (self.is_valid and self.hstart * 3600 + self.mstart * 60 <= sec_from_morning <= self.hend * 3600 + self.mend...
[ "Check if time is valid for this Timerange\n\n If sec_from_morning is not provided, get the value.\n\n :param timestamp: time to check\n :type timestamp: int\n :return: True if time is valid (in interval), False otherwise\n :rtype: bool\n " ]
Please provide a description of the function:def is_time_valid(self, timestamp): if self.is_time_day_valid(timestamp): for timerange in self.timeranges: if timerange.is_time_valid(timestamp): return True return False
[ "Check if time is valid for one of the timerange.\n\n :param timestamp: time to check\n :type timestamp: int\n :return: True if one of the timerange is valid for t, False otherwise\n :rtype: bool\n " ]
Please provide a description of the function:def get_min_sec_from_morning(self): mins = [] for timerange in self.timeranges: mins.append(timerange.get_sec_from_morning()) return min(mins)
[ "Get the first second from midnight where a timerange is effective\n\n :return: smallest amount of second from midnight of all timerange\n :rtype: int\n " ]
Please provide a description of the function:def get_min_sec_out_from_morning(self): mins = [] for timerange in self.timeranges: mins.append(timerange.get_first_sec_out_from_morning()) return min(mins)
[ "Get the first second (from midnight) where we are out of a timerange\n\n :return: smallest seconds from midnight of all timerange where it is not effective\n :rtype: int\n " ]
Please provide a description of the function:def get_min_from_t(self, timestamp): if self.is_time_valid(timestamp): return timestamp t_day_epoch = get_day(timestamp) tr_mins = self.get_min_sec_from_morning() return t_day_epoch + tr_mins
[ "Get next time from t where a timerange is valid (withing range)\n\n :param timestamp: base time to look for the next one\n :return: time where a timerange is valid\n :rtype: int\n " ]
Please provide a description of the function:def is_time_day_valid(self, timestamp): (start_time, end_time) = self.get_start_and_end_time(timestamp) return start_time <= timestamp <= end_time
[ "Check if it is within start time and end time of the DateRange\n\n :param timestamp: time to check\n :type timestamp: int\n :return: True if t in range, False otherwise\n :rtype: bool\n " ]
Please provide a description of the function:def get_next_future_timerange_valid(self, timestamp): sec_from_morning = get_sec_from_morning(timestamp) starts = [] for timerange in self.timeranges: tr_start = timerange.hstart * 3600 + timerange.mstart * 60 if tr_st...
[ "Get the next valid timerange (next timerange start in timeranges attribute)\n\n :param timestamp: base time\n :type timestamp: int\n :return: next time when a timerange is valid\n :rtype: None | int\n " ]
Please provide a description of the function:def get_next_future_timerange_invalid(self, timestamp): sec_from_morning = get_sec_from_morning(timestamp) ends = [] for timerange in self.timeranges: tr_end = timerange.hend * 3600 + timerange.mend * 60 if tr_end >= s...
[ "Get next invalid time for timeranges\n\n :param timestamp: time to check\n :type timestamp: int\n :return: next time when a timerange is not valid\n :rtype: None | int\n " ]
Please provide a description of the function:def get_next_valid_day(self, timestamp): if self.get_next_future_timerange_valid(timestamp) is None: # this day is finish, we check for next period (start_time, _) = self.get_start_and_end_time(get_day(timestamp) + 86400) else...
[ "Get next valid day for timerange\n\n :param timestamp: time we compute from\n :type timestamp: int\n :return: timestamp of the next valid day (midnight) in LOCAL time.\n :rtype: int | None\n " ]
Please provide a description of the function:def get_next_valid_time_from_t(self, timestamp): if self.is_time_valid(timestamp): return timestamp # First we search for the day of t t_day = self.get_next_valid_day(timestamp) if t_day is None: return t_day ...
[ "Get next valid time for time range\n\n :param timestamp: time we compute from\n :type timestamp: int\n :return: timestamp of the next valid time (LOCAL TIME)\n :rtype: int | None\n " ]
Please provide a description of the function:def get_next_invalid_day(self, timestamp): # pylint: disable=no-else-return if self.is_time_day_invalid(timestamp): return timestamp next_future_timerange_invalid = self.get_next_future_timerange_invalid(timestamp) # If ...
[ "Get next day where timerange is not active\n\n :param timestamp: time we compute from\n :type timestamp: int\n :return: timestamp of the next invalid day (midnight) in LOCAL time.\n :rtype: int | None\n " ]
Please provide a description of the function:def get_next_invalid_time_from_t(self, timestamp): if not self.is_time_valid(timestamp): return timestamp # First we search for the day of time range t_day = self.get_next_invalid_day(timestamp) # We search for the min o...
[ "Get next invalid time for time range\n\n :param timestamp: time we compute from\n :type timestamp: int\n :return: timestamp of the next invalid time (LOCAL TIME)\n :rtype: int\n " ]
Please provide a description of the function:def serialize(self): return {'syear': self.syear, 'smon': self.smon, 'smday': self.smday, 'swday': self.swday, 'swday_offset': self.swday_offset, 'eyear': self.eyear, 'emon': self.emon, 'emday': self.emday, 'ew...
[ "This function serialize into a simple dict object.\n It is used when transferring data to other daemons over the network (http)\n\n Here we directly return all attributes\n\n :return: json representation of a Daterange\n :rtype: dict\n " ]
Please provide a description of the function:def get_start_and_end_time(self, ref=None): return (get_start_of_day(self.syear, int(self.smon), self.smday), get_end_of_day(self.eyear, int(self.emon), self.emday))
[ "Specific function to get start time and end time for CalendarDaterange\n\n :param ref: time in seconds\n :type ref: int\n :return: tuple with start and end time\n :rtype: tuple (int, int)\n " ]
Please provide a description of the function:def serialize(self): return {'day': self.day, 'other': self.other, 'timeranges': [t.serialize() for t in self.timeranges]}
[ "This function serialize into a simple dict object.\n It is used when transferring data to other daemons over the network (http)\n\n Here we directly return all attributes\n\n :return: json representation of a Daterange\n :rtype: dict\n " ]
Please provide a description of the function:def is_correct(self): valid = self.day in Daterange.weekdays if not valid: logger.error("Error: %s is not a valid day", self.day) # Check also if Daterange is correct. valid &= super(StandardDaterange, self).is_correct() ...
[ "Check if the Daterange is correct : weekdays are valid\n\n :return: True if weekdays are valid, False otherwise\n :rtype: bool\n " ]
Please provide a description of the function:def get_start_and_end_time(self, ref=None): now = time.localtime(ref) self.syear = now.tm_year self.month = now.tm_mon self.wday = now.tm_wday day_id = Daterange.get_weekday_id(self.day) today_morning = get_start_of_da...
[ "Specific function to get start time and end time for StandardDaterange\n\n :param ref: time in seconds\n :type ref: int\n :return: tuple with start and end time\n :rtype: tuple (int, int)\n " ]
Please provide a description of the function:def is_correct(self): valid = True valid &= self.swday in range(7) if not valid: logger.error("Error: %s is not a valid day", self.swday) valid &= self.ewday in range(7) if not valid: logger.error("Err...
[ "Check if the Daterange is correct : weekdays are valid\n\n :return: True if weekdays are valid, False otherwise\n :rtype: bool\n " ]
Please provide a description of the function:def get_start_and_end_time(self, ref=None): now = time.localtime(ref) if self.syear == 0: self.syear = now.tm_year day_start = find_day_by_weekday_offset(self.syear, self.smon, self.swday, self.swday_offset) start_time = ...
[ "Specific function to get start time and end time for MonthWeekDayDaterange\n\n :param ref: time in seconds\n :type ref: int | None\n :return: tuple with start and end time\n :rtype: tuple\n " ]
Please provide a description of the function:def get_start_and_end_time(self, ref=None): now = time.localtime(ref) if self.syear == 0: self.syear = now.tm_year day_start = find_day_by_offset(self.syear, self.smon, self.smday) start_time = get_start_of_day(self.syear,...
[ "Specific function to get start time and end time for MonthDateDaterange\n\n :param ref: time in seconds\n :type ref: int\n :return: tuple with start and end time\n :rtype: tuple (int, int)\n " ]
Please provide a description of the function:def get_start_and_end_time(self, ref=None): now = time.localtime(ref) # If no year, it's our year if self.syear == 0: self.syear = now.tm_year month_start_id = now.tm_mon day_start = find_day_by_weekday_offset(sel...
[ "Specific function to get start time and end time for WeekDayDaterange\n\n :param ref: time in seconds\n :type ref: int\n :return: tuple with start and end time\n :rtype: tuple (int, int)\n " ]
Please provide a description of the function:def get_start_and_end_time(self, ref=None): now = time.localtime(ref) if self.syear == 0: self.syear = now.tm_year month_start_id = now.tm_mon day_start = find_day_by_offset(self.syear, month_start_id, self.smday) ...
[ "Specific function to get start time and end time for MonthDayDaterange\n\n :param ref: time in seconds\n :type ref: int\n :return: tuple with start and end time\n :rtype: tuple (int, int)\n " ]
Please provide a description of the function:def send_an_element(self, element): # Comment this log because it raises an encoding exception on Travis CI with python 2.7! # logger.debug("Sending to %s for %s", self.daemon, element) if hasattr(self.daemon, "add"): func = getat...
[ "Send an element (Brok, Comment,...) to our daemon\n\n Use the daemon `add` function if it exists, else raise an error log\n\n :param element: elementto be sent\n :type: alignak.Brok, or Comment, or Downtime, ...\n :return:\n " ]
Please provide a description of the function:def resolve_command(self, excmd): # Maybe the command is invalid. Bailout try: command = excmd.cmd_line except AttributeError as exp: # pragma: no cover, simple protection logger.warning("resolve_command, error with c...
[ "Parse command and dispatch it (to schedulers for example) if necessary\n If the command is not global it will be executed.\n\n :param excmd: external command to handle\n :type excmd: alignak.external_command.ExternalCommand\n :return: result of command parsing. None for an invalid comma...
Please provide a description of the function:def search_host_and_dispatch(self, host_name, command, extcmd): # pylint: disable=too-many-branches logger.debug("Calling search_host_and_dispatch for %s", host_name) host_found = False # If we are a receiver, just look in the receiv...
[ "Try to dispatch a command for a specific host (so specific scheduler)\n because this command is related to a host (change notification interval for example)\n\n :param host_name: host name to search\n :type host_name: str\n :param command: command line\n :type command: str\n ...
Please provide a description of the function:def get_unknown_check_result_brok(cmd_line): match = re.match( r'^\[([0-9]{10})] PROCESS_(SERVICE)_CHECK_RESULT;' r'([^\;]*);([^\;]*);([^\;]*);([^\|]*)(?:\|(.*))?', cmd_line) if not match: match = re.match( ...
[ "Create unknown check result brok and fill it with command data\n\n :param cmd_line: command line to extract data\n :type cmd_line: str\n :return: unknown check result brok\n :rtype: alignak.objects.brok.Brok\n " ]
Please provide a description of the function:def get_command_and_args(self, command, extcmd=None): # pylint: disable=too-many-return-statements, too-many-nested-blocks # pylint: disable=too-many-locals,too-many-branches,too-many-statements # danger!!! passive check results with perfdata...
[ "Parse command and get args\n\n :param command: command line to parse\n :type command: str\n :param extcmd: external command object (used to dispatch)\n :type extcmd: None | object\n :return: Dict containing command and arg ::\n\n {'global': False, 'c_name': c_name, 'args':...
Please provide a description of the function:def change_contact_host_notification_timeperiod(self, contact, notification_timeperiod): # todo: deprecate this contact.modified_host_attributes |= DICT_MODATTR["MODATTR_NOTIFICATION_TIMEPERIOD"].value contact.host_notification_period = notif...
[ "Change contact host notification timeperiod value\n Format of the line that triggers function call::\n\n CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD;<contact_name>;<notification_timeperiod>\n\n :param contact: contact to edit\n :type contact: alignak.objects.contact.Contact\n :pa...
Please provide a description of the function:def add_svc_comment(self, service, author, comment): data = { 'author': author, 'comment': comment, 'comment_type': 2, 'entry_type': 1, 'source': 1, 'expires': False, 'ref': service.uuid } comm = Comment(data) ...
[ "Add a service comment\n Format of the line that triggers function call::\n\n ADD_SVC_COMMENT;<host_name>;<service_description>;<persistent:obsolete>;<author>;<comment>\n\n :param service: service to add the comment\n :type service: alignak.objects.service.Service\n :param author:...
Please provide a description of the function:def add_host_comment(self, host, author, comment): data = { 'author': author, 'comment': comment, 'comment_type': 1, 'entry_type': 1, 'source': 1, 'expires': False, 'ref': host.uuid } comm = Comment(data) host....
[ "Add a host comment\n Format of the line that triggers function call::\n\n ADD_HOST_COMMENT;<host_name>;<persistent:obsolete>;<author>;<comment>\n\n :param host: host to add the comment\n :type host: alignak.objects.host.Host\n :param author: author name\n :type author: str...
Please provide a description of the function:def acknowledge_svc_problem(self, service, sticky, notify, author, comment): notification_period = None if getattr(service, 'notification_period', None) is not None: notification_period = self.daemon.timeperiods[service.notification_perio...
[ "Acknowledge a service problem\n Format of the line that triggers function call::\n\n ACKNOWLEDGE_SVC_PROBLEM;<host_name>;<service_description>;<sticky>;<notify>;\n <persistent:obsolete>;<author>;<comment>\n\n :param service: service to acknowledge the problem\n :type service: ali...
Please provide a description of the function:def acknowledge_host_problem(self, host, sticky, notify, author, comment): notification_period = None if getattr(host, 'notification_period', None) is not None: notification_period = self.daemon.timeperiods[host.notification_period] ...
[ "Acknowledge a host problem\n Format of the line that triggers function call::\n\n ACKNOWLEDGE_HOST_PROBLEM;<host_name>;<sticky>;<notify>;<persistent:obsolete>;<author>;\n <comment>\n\n :param host: host to acknowledge the problem\n :type host: alignak.objects.host.Host\n :...
Please provide a description of the function:def change_contact_svc_notification_timeperiod(self, contact, notification_timeperiod): contact.modified_service_attributes |= \ DICT_MODATTR["MODATTR_NOTIFICATION_TIMEPERIOD"].value contact.service_notification_period = notification_time...
[ "Change contact service notification timeperiod value\n Format of the line that triggers function call::\n\n CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD;<contact_name>;<notification_timeperiod>\n\n :param contact: contact to edit\n :type contact: alignak.objects.contact.Contact\n :...
Please provide a description of the function:def change_custom_contact_var(self, contact, varname, varvalue): if varname.upper() in contact.customs: contact.modified_attributes |= DICT_MODATTR["MODATTR_CUSTOM_VARIABLE"].value contact.customs[varname.upper()] = varvalue ...
[ "Change custom contact variable\n Format of the line that triggers function call::\n\n CHANGE_CUSTOM_CONTACT_VAR;<contact_name>;<varname>;<varvalue>\n\n :param contact: contact to edit\n :type contact: alignak.objects.contact.Contact\n :param varname: variable name to change\n ...
Please provide a description of the function:def change_custom_host_var(self, host, varname, varvalue): if varname.upper() in host.customs: host.modified_attributes |= DICT_MODATTR["MODATTR_CUSTOM_VARIABLE"].value host.customs[varname.upper()] = varvalue self.send_a...
[ "Change custom host variable\n Format of the line that triggers function call::\n\n CHANGE_CUSTOM_HOST_VAR;<host_name>;<varname>;<varvalue>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :param varname: variable name to change\n :type varname: str\n...
Please provide a description of the function:def change_custom_svc_var(self, service, varname, varvalue): if varname.upper() in service.customs: service.modified_attributes |= DICT_MODATTR["MODATTR_CUSTOM_VARIABLE"].value service.customs[varname.upper()] = varvalue s...
[ "Change custom service variable\n Format of the line that triggers function call::\n\n CHANGE_CUSTOM_SVC_VAR;<host_name>;<service_description>;<varname>;<varvalue>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :param varname: variable name ...
Please provide a description of the function:def change_host_check_command(self, host, check_command): host.modified_attributes |= DICT_MODATTR["MODATTR_CHECK_COMMAND"].value data = {"commands": self.commands, "call": check_command, "poller_tag": host.poller_tag} host.change_check_comma...
[ "Modify host check command\n Format of the line that triggers function call::\n\n CHANGE_HOST_CHECK_COMMAND;<host_name>;<check_command>\n\n :param host: host to modify check command\n :type host: alignak.objects.host.Host\n :param check_command: command line\n :type check_c...
Please provide a description of the function:def change_host_check_timeperiod(self, host, timeperiod): host.modified_attributes |= DICT_MODATTR["MODATTR_CHECK_TIMEPERIOD"].value host.check_period = timeperiod self.send_an_element(host.get_update_status_brok())
[ "Modify host check timeperiod\n Format of the line that triggers function call::\n\n CHANGE_HOST_CHECK_TIMEPERIOD;<host_name>;<timeperiod>\n\n :param host: host to modify check timeperiod\n :type host: alignak.objects.host.Host\n :param timeperiod: timeperiod object\n :type...
Please provide a description of the function:def change_host_event_handler(self, host, event_handler_command): host.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_COMMAND"].value data = {"commands": self.commands, "call": event_handler_command} host.change_event_handler(data...
[ "Modify host event handler\n Format of the line that triggers function call::\n\n CHANGE_HOST_EVENT_HANDLER;<host_name>;<event_handler_command>\n\n :param host: host to modify event handler\n :type host: alignak.objects.host.Host\n :param event_handler_command: event handler comma...
Please provide a description of the function:def change_host_snapshot_command(self, host, snapshot_command): host.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_COMMAND"].value data = {"commands": self.commands, "call": snapshot_command} host.change_snapshot_command(data) ...
[ "Modify host snapshot command\n Format of the line that triggers function call::\n\n CHANGE_HOST_SNAPSHOT_COMMAND;<host_name>;<event_handler_command>\n\n :param host: host to modify snapshot command\n :type host: alignak.objects.host.Host\n :param snapshot_command: snapshot comman...
Please provide a description of the function:def change_host_modattr(self, host, value): # todo: deprecate this # We need to change each of the needed attributes. previous_value = host.modified_attributes changes = int(value) # For all boolean and non boolean attributes...
[ "Change host modified attributes\n Format of the line that triggers function call::\n\n CHANGE_HOST_MODATTR;<host_name>;<value>\n\n For boolean attributes, toggles the service attribute state (enable/disable)\n For non boolean attribute, only indicates that the corresponding attribute is...
Please provide a description of the function:def change_max_host_check_attempts(self, host, check_attempts): host.modified_attributes |= DICT_MODATTR["MODATTR_MAX_CHECK_ATTEMPTS"].value host.max_check_attempts = check_attempts if host.state_type == u'HARD' and host.state == u'UP' and ho...
[ "Modify max host check attempt\n Format of the line that triggers function call::\n\n CHANGE_MAX_HOST_CHECK_ATTEMPTS;<host_name>;<check_attempts>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :param check_attempts: new value to set\n :type check_at...
Please provide a description of the function:def change_max_svc_check_attempts(self, service, check_attempts): service.modified_attributes |= DICT_MODATTR["MODATTR_MAX_CHECK_ATTEMPTS"].value service.max_check_attempts = check_attempts if service.state_type == u'HARD' and service.state =...
[ "Modify max service check attempt\n Format of the line that triggers function call::\n\n CHANGE_MAX_SVC_CHECK_ATTEMPTS;<host_name>;<service_description>;<check_attempts>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :param check_attempts: n...
Please provide a description of the function:def change_normal_host_check_interval(self, host, check_interval): host.modified_attributes |= DICT_MODATTR["MODATTR_NORMAL_CHECK_INTERVAL"].value old_interval = host.check_interval host.check_interval = check_interval # If there were...
[ "Modify host check interval\n Format of the line that triggers function call::\n\n CHANGE_NORMAL_HOST_CHECK_INTERVAL;<host_name>;<check_interval>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :param check_interval: new value to set\n :type check_in...
Please provide a description of the function:def change_retry_host_check_interval(self, host, check_interval): host.modified_attributes |= DICT_MODATTR["MODATTR_RETRY_CHECK_INTERVAL"].value host.retry_interval = check_interval self.send_an_element(host.get_update_status_brok())
[ "Modify host retry interval\n Format of the line that triggers function call::\n\n CHANGE_RETRY_HOST_CHECK_INTERVAL;<host_name>;<check_interval>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :param check_interval: new value to set\n :type check_int...
Please provide a description of the function:def change_retry_svc_check_interval(self, service, check_interval): service.modified_attributes |= DICT_MODATTR["MODATTR_RETRY_CHECK_INTERVAL"].value service.retry_interval = check_interval self.send_an_element(service.get_update_status_brok(...
[ "Modify service retry interval\n Format of the line that triggers function call::\n\n CHANGE_RETRY_SVC_CHECK_INTERVAL;<host_name>;<service_description>;<check_interval>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :param check_interval: ne...
Please provide a description of the function:def change_svc_check_command(self, service, check_command): service.modified_attributes |= DICT_MODATTR["MODATTR_CHECK_COMMAND"].value data = {"commands": self.commands, "call": check_command, "poller_tag": service.poller_tag} service.change_...
[ "Modify service check command\n Format of the line that triggers function call::\n\n CHANGE_SVC_CHECK_COMMAND;<host_name>;<service_description>;<check_command>\n\n :param service: service to modify check command\n :type service: alignak.objects.service.Service\n :param check_comma...
Please provide a description of the function:def change_svc_check_timeperiod(self, service, check_timeperiod): service.modified_attributes |= DICT_MODATTR["MODATTR_CHECK_TIMEPERIOD"].value service.check_period = check_timeperiod self.send_an_element(service.get_update_status_brok())
[ "Modify service check timeperiod\n Format of the line that triggers function call::\n\n CHANGE_SVC_CHECK_TIMEPERIOD;<host_name>;<service_description>;<check_timeperiod>\n\n :param service: service to modify check timeperiod\n :type service: alignak.objects.service.Service\n :param...
Please provide a description of the function:def change_svc_event_handler(self, service, event_handler_command): service.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_COMMAND"].value data = {"commands": self.commands, "call": event_handler_command} service.change_event_hand...
[ "Modify service event handler\n Format of the line that triggers function call::\n\n CHANGE_SVC_EVENT_HANDLER;<host_name>;<service_description>;<event_handler_command>\n\n :param service: service to modify event handler\n :type service: alignak.objects.service.Service\n :param eve...
Please provide a description of the function:def change_svc_snapshot_command(self, service, snapshot_command): service.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_COMMAND"].value data = {"commands": self.commands, "call": snapshot_command} service.change_snapshot_command(...
[ "Modify host snapshot command\n Format of the line that triggers function call::\n\n CHANGE_HOST_SNAPSHOT_COMMAND;<host_name>;<event_handler_command>\n\n :param service: service to modify snapshot command\n :type service: alignak.objects.service.Service\n :param snapshot_command: ...
Please provide a description of the function:def change_svc_modattr(self, service, value): # todo: deprecate this # We need to change each of the needed attributes. previous_value = service.modified_attributes changes = int(value) # For all boolean and non boolean attri...
[ "Change service modified attributes\n Format of the line that triggers function call::\n\n CHANGE_SVC_MODATTR;<host_name>;<service_description>;<value>\n\n For boolean attributes, toggles the service attribute state (enable/disable)\n For non boolean attribute, only indicates that the co...
Please provide a description of the function:def change_svc_notification_timeperiod(self, service, notification_timeperiod): service.modified_attributes |= DICT_MODATTR["MODATTR_NOTIFICATION_TIMEPERIOD"].value service.notification_period = notification_timeperiod self.send_an_element(se...
[ "Change service notification timeperiod\n Format of the line that triggers function call::\n\n CHANGE_SVC_NOTIFICATION_TIMEPERIOD;<host_name>;<service_description>;\n <notification_timeperiod>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n ...
Please provide a description of the function:def delay_host_notification(self, host, notification_time): host.first_notification_delay = notification_time self.send_an_element(host.get_update_status_brok())
[ "Modify host first notification delay\n Format of the line that triggers function call::\n\n DELAY_HOST_NOTIFICATION;<host_name>;<notification_time>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :param notification_time: new value to set\n :type no...
Please provide a description of the function:def delay_svc_notification(self, service, notification_time): service.first_notification_delay = notification_time self.send_an_element(service.get_update_status_brok())
[ "Modify service first notification delay\n Format of the line that triggers function call::\n\n DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :param notification_t...
Please provide a description of the function:def del_all_host_comments(self, host): comments = list(host.comments.keys()) for uuid in comments: host.del_comment(uuid) self.send_an_element(host.get_update_status_brok())
[ "Delete all host comments\n Format of the line that triggers function call::\n\n DEL_ALL_HOST_COMMENTS;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def del_all_host_downtimes(self, host): for downtime in host.downtimes: self.del_host_downtime(downtime) self.send_an_element(host.get_update_status_brok())
[ "Delete all host downtimes\n Format of the line that triggers function call::\n\n DEL_ALL_HOST_DOWNTIMES;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def del_all_svc_comments(self, service): comments = list(service.comments.keys()) for uuid in comments: service.del_comment(uuid) self.send_an_element(service.get_update_status_brok())
[ "Delete all service comments\n Format of the line that triggers function call::\n\n DEL_ALL_SVC_COMMENTS;<host_name>;<service_description>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :return: None\n " ]
Please provide a description of the function:def del_all_svc_downtimes(self, service): for downtime in service.downtimes: self.del_svc_downtime(downtime) self.send_an_element(service.get_update_status_brok())
[ "Delete all service downtime\n Format of the line that triggers function call::\n\n DEL_ALL_SVC_DOWNTIMES;<host_name>;<service_description>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :return: None\n " ]
Please provide a description of the function:def del_contact_downtime(self, downtime_id): for item in self.daemon.contacts: if downtime_id in item.downtimes: item.downtimes[downtime_id].cancel(self.daemon.contacts) break else: self.send_an...
[ "Delete a contact downtime\n Format of the line that triggers function call::\n\n DEL_CONTACT_DOWNTIME;<downtime_id>\n\n :param downtime_id: downtime id to delete\n :type downtime_id: int\n :return: None\n " ]
Please provide a description of the function:def del_host_comment(self, comment_id): for item in self.daemon.hosts: if comment_id in item.comments: item.del_comment(comment_id) self.send_an_element(item.get_update_status_brok()) break ...
[ "Delete a host comment\n Format of the line that triggers function call::\n\n DEL_HOST_COMMENT;<comment_id>\n\n :param comment_id: comment id to delete\n :type comment_id: int\n :return: None\n " ]
Please provide a description of the function:def del_host_downtime(self, downtime_id): broks = [] for item in self.daemon.hosts: if downtime_id in item.downtimes: broks.extend(item.downtimes[downtime_id].cancel(self.daemon.timeperiods, ...
[ "Delete a host downtime\n Format of the line that triggers function call::\n\n DEL_HOST_DOWNTIME;<downtime_id>\n\n :param downtime_id: downtime id to delete\n :type downtime_id: int\n :return: None\n " ]
Please provide a description of the function:def del_svc_comment(self, comment_id): for svc in self.daemon.services: if comment_id in svc.comments: svc.del_comment(comment_id) self.send_an_element(svc.get_update_status_brok()) break el...
[ "Delete a service comment\n Format of the line that triggers function call::\n\n DEL_SVC_COMMENT;<comment_id>\n\n :param comment_id: comment id to delete\n :type comment_id: int\n :return: None\n " ]
Please provide a description of the function:def del_svc_downtime(self, downtime_id): broks = [] for svc in self.daemon.services: if downtime_id in svc.downtimes: broks.extend(svc.downtimes[downtime_id].cancel(self.daemon.timeperiods, ...
[ "Delete a service downtime\n Format of the line that triggers function call::\n\n DEL_SVC_DOWNTIME;<downtime_id>\n\n :param downtime_id: downtime id to delete\n :type downtime_id: int\n :return: None\n " ]
Please provide a description of the function:def disable_contactgroup_host_notifications(self, contactgroup): for contact_id in contactgroup.get_contacts(): self.disable_contact_host_notifications(self.daemon.contacts[contact_id])
[ "Disable host notifications for a contactgroup\n Format of the line that triggers function call::\n\n DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS;<contactgroup_name>\n\n :param contactgroup: contactgroup to disable\n :type contactgroup: alignak.objects.contactgroup.Contactgroup\n :ret...
Please provide a description of the function:def disable_contactgroup_svc_notifications(self, contactgroup): for contact_id in contactgroup.get_contacts(): self.disable_contact_svc_notifications(self.daemon.contacts[contact_id])
[ "Disable service notifications for a contactgroup\n Format of the line that triggers function call::\n\n DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS;<contactgroup_name>\n\n :param contactgroup: contactgroup to disable\n :type contactgroup: alignak.objects.contactgroup.Contactgroup\n :r...
Please provide a description of the function:def disable_contact_host_notifications(self, contact): if contact.host_notifications_enabled: contact.modified_attributes |= DICT_MODATTR["MODATTR_NOTIFICATIONS_ENABLED"].value contact.host_notifications_enabled = False se...
[ "Disable host notifications for a contact\n Format of the line that triggers function call::\n\n DISABLE_CONTACT_HOST_NOTIFICATIONS;<contact_name>\n\n :param contact: contact to disable\n :type contact: alignak.objects.contact.Contact\n :return: None\n " ]
Please provide a description of the function:def disable_contact_svc_notifications(self, contact): if contact.service_notifications_enabled: contact.modified_attributes |= DICT_MODATTR["MODATTR_NOTIFICATIONS_ENABLED"].value contact.service_notifications_enabled = False ...
[ "Disable service notifications for a contact\n Format of the line that triggers function call::\n\n DISABLE_CONTACT_SVC_NOTIFICATIONS;<contact_name>\n\n :param contact: contact to disable\n :type contact: alignak.objects.contact.Contact\n :return: None\n " ]
Please provide a description of the function:def disable_event_handlers(self): # todo: #783 create a dedicated brok for global parameters if self.my_conf.enable_event_handlers: self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_ENABLED"].value self.m...
[ "Disable event handlers (globally)\n Format of the line that triggers function call::\n\n DISABLE_EVENT_HANDLERS\n\n :return: None\n " ]
Please provide a description of the function:def disable_flap_detection(self): # todo: #783 create a dedicated brok for global parameters if self.my_conf.enable_flap_detection: self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_FLAP_DETECTION_ENABLED"].value self....
[ "Disable flap detection (globally)\n Format of the line that triggers function call::\n\n DISABLE_FLAP_DETECTION\n\n :return: None\n " ]
Please provide a description of the function:def disable_hostgroup_host_checks(self, hostgroup): for host_id in hostgroup.get_hosts(): if host_id in self.daemon.hosts: self.disable_host_check(self.daemon.hosts[host_id])
[ "Disable host checks for a hostgroup\n Format of the line that triggers function call::\n\n DISABLE_HOSTGROUP_HOST_CHECKS;<hostgroup_name>\n\n :param hostgroup: hostgroup to disable\n :type hostgroup: alignak.objects.hostgroup.Hostgroup\n :return: None\n " ]
Please provide a description of the function:def disable_hostgroup_host_notifications(self, hostgroup): for host_id in hostgroup.get_hosts(): if host_id in self.daemon.hosts: self.disable_host_notifications(self.daemon.hosts[host_id])
[ "Disable host notifications for a hostgroup\n Format of the line that triggers function call::\n\n DISABLE_HOSTGROUP_HOST_NOTIFICATIONS;<hostgroup_name>\n\n :param hostgroup: hostgroup to disable\n :type hostgroup: alignak.objects.hostgroup.Hostgroup\n :return: None\n " ]
Please provide a description of the function:def disable_hostgroup_passive_host_checks(self, hostgroup): for host_id in hostgroup.get_hosts(): if host_id in self.daemon.hosts: self.disable_passive_host_checks(self.daemon.hosts[host_id])
[ "Disable host passive checks for a hostgroup\n Format of the line that triggers function call::\n\n DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;<hostgroup_name>\n\n :param hostgroup: hostgroup to disable\n :type hostgroup: alignak.objects.hostgroup.Hostgroup\n :return: None\n " ]
Please provide a description of the function:def disable_hostgroup_passive_svc_checks(self, hostgroup): for host_id in hostgroup.get_hosts(): if host_id in self.daemon.hosts: for service_id in self.daemon.hosts[host_id].services: if service_id in self.dae...
[ "Disable service passive checks for a hostgroup\n Format of the line that triggers function call::\n\n DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;<hostgroup_name>\n\n :param hostgroup: hostgroup to disable\n :type hostgroup: alignak.objects.hostgroup.Hostgroup\n :return: None\n "...
Please provide a description of the function:def disable_hostgroup_svc_checks(self, hostgroup): for host_id in hostgroup.get_hosts(): if host_id in self.daemon.hosts: for service_id in self.daemon.hosts[host_id].services: if service_id in self.daemon.serv...
[ "Disable service checks for a hostgroup\n Format of the line that triggers function call::\n\n DISABLE_HOSTGROUP_SVC_CHECKS;<hostgroup_name>\n\n :param hostgroup: hostgroup to disable\n :type hostgroup: alignak.objects.hostgroup.Hostgroup\n :return: None\n " ]
Please provide a description of the function:def disable_hostgroup_svc_notifications(self, hostgroup): for host_id in hostgroup.get_hosts(): if host_id in self.daemon.hosts: for service_id in self.daemon.hosts[host_id].services: if service_id in self.daem...
[ "Disable service notifications for a hostgroup\n Format of the line that triggers function call::\n\n DISABLE_HOSTGROUP_SVC_NOTIFICATIONS;<hostgroup_name>\n\n :param hostgroup: hostgroup to disable\n :type hostgroup: alignak.objects.hostgroup.Hostgroup\n :return: None\n " ]
Please provide a description of the function:def disable_host_check(self, host): if host.active_checks_enabled: host.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value host.disable_active_checks(self.daemon.checks) self.send_an_element(host.ge...
[ "Disable checks for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_CHECK;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_host_event_handler(self, host): if host.event_handler_enabled: host.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_ENABLED"].value host.event_handler_enabled = False self.send_an_element(host.get_up...
[ "Disable event handlers for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_EVENT_HANDLER;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_host_flap_detection(self, host): if host.flap_detection_enabled: host.modified_attributes |= DICT_MODATTR["MODATTR_FLAP_DETECTION_ENABLED"].value host.flap_detection_enabled = False # Maybe the host was flappin...
[ "Disable flap detection for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_FLAP_DETECTION;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_host_freshness_check(self, host): if host.check_freshness: host.modified_attributes |= DICT_MODATTR["MODATTR_FRESHNESS_CHECKS_ENABLED"].value host.check_freshness = False self.send_an_element(host.get_update_st...
[ "Disable freshness check for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_FRESHNESS_CHECK;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_host_freshness_checks(self): if self.my_conf.check_host_freshness: self.my_conf.modified_attributes |= \ DICT_MODATTR["MODATTR_FRESHNESS_CHECKS_ENABLED"].value self.my_conf.check_host_freshness = False ...
[ "Disable freshness checks (globally)\n Format of the line that triggers function call::\n\n DISABLE_HOST_FRESHNESS_CHECKS\n\n :return: None\n " ]
Please provide a description of the function:def disable_host_notifications(self, host): if host.notifications_enabled: host.modified_attributes |= DICT_MODATTR["MODATTR_NOTIFICATIONS_ENABLED"].value host.notifications_enabled = False self.send_an_element(host.get_up...
[ "Disable notifications for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_NOTIFICATIONS;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_host_svc_checks(self, host): for service_id in host.services: if service_id in self.daemon.services: service = self.daemon.services[service_id] self.disable_svc_check(service) self.send_...
[ "Disable service checks for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_SVC_CHECKS;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_host_svc_notifications(self, host): for service_id in host.services: if service_id in self.daemon.services: service = self.daemon.services[service_id] self.disable_svc_notifications(service) ...
[ "Disable services notifications for a host\n Format of the line that triggers function call::\n\n DISABLE_HOST_SVC_NOTIFICATIONS;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_notifications(self): # todo: #783 create a dedicated brok for global parameters if self.my_conf.enable_notifications: self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_NOTIFICATIONS_ENABLED"].value self.my_...
[ "Disable notifications (globally)\n Format of the line that triggers function call::\n\n DISABLE_NOTIFICATIONS\n\n :return: None\n " ]
Please provide a description of the function:def disable_passive_host_checks(self, host): if host.passive_checks_enabled: host.modified_attributes |= DICT_MODATTR["MODATTR_PASSIVE_CHECKS_ENABLED"].value host.passive_checks_enabled = False self.send_an_element(host.ge...
[ "Disable passive checks for a host\n Format of the line that triggers function call::\n\n DISABLE_PASSIVE_HOST_CHECKS;<host_name>\n\n :param host: host to edit\n :type host: alignak.objects.host.Host\n :return: None\n " ]
Please provide a description of the function:def disable_passive_svc_checks(self, service): if service.passive_checks_enabled: service.modified_attributes |= DICT_MODATTR["MODATTR_PASSIVE_CHECKS_ENABLED"].value service.passive_checks_enabled = False self.send_an_elem...
[ "Disable passive checks for a service\n Format of the line that triggers function call::\n\n DISABLE_PASSIVE_SVC_CHECKS;<host_name>;<service_description>\n\n :param service: service to edit\n :type service: alignak.objects.service.Service\n :return: None\n " ]
Please provide a description of the function:def disable_performance_data(self): # todo: #783 create a dedicated brok for global parameters if self.my_conf.process_performance_data: self.my_conf.modified_attributes |= \ DICT_MODATTR["MODATTR_PERFORMANCE_DATA_ENABLED"...
[ "Disable performance data processing (globally)\n Format of the line that triggers function call::\n\n DISABLE_PERFORMANCE_DATA\n\n :return: None\n " ]
Please provide a description of the function:def disable_servicegroup_host_checks(self, servicegroup): for service_id in servicegroup.get_services(): if service_id in self.daemon.services: host_id = self.daemon.services[service_id].host self.disable_host_chec...
[ "Disable host checks for a servicegroup\n Format of the line that triggers function call::\n\n DISABLE_SERVICEGROUP_HOST_CHECKS;<servicegroup_name>\n\n :param servicegroup: servicegroup to disable\n :type servicegroup: alignak.objects.servicegroup.Servicegroup\n :return: None\n ...
Please provide a description of the function:def disable_servicegroup_host_notifications(self, servicegroup): for service_id in servicegroup.get_services(): if service_id in self.daemon.services: host_id = self.daemon.services[service_id].host self.disable_ho...
[ "Disable host notifications for a servicegroup\n Format of the line that triggers function call::\n\n DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS;<servicegroup_name>\n\n :param servicegroup: servicegroup to disable\n :type servicegroup: alignak.objects.servicegroup.Servicegroup\n :ret...