repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Alignak-monitoring/alignak | alignak/objects/servicedependency.py | Servicedependencies.linkify_sd_by_tp | def linkify_sd_by_tp(self, timeperiods):
"""Replace dependency_period by a real object in service dependency
:param timeperiods: list of timeperiod, used to look for a specific one
:type timeperiods: alignak.objects.timeperiod.Timeperiods
:return: None
"""
for servicedep... | python | def linkify_sd_by_tp(self, timeperiods):
"""Replace dependency_period by a real object in service dependency
:param timeperiods: list of timeperiod, used to look for a specific one
:type timeperiods: alignak.objects.timeperiod.Timeperiods
:return: None
"""
for servicedep... | [
"def",
"linkify_sd_by_tp",
"(",
"self",
",",
"timeperiods",
")",
":",
"for",
"servicedep",
"in",
"self",
":",
"try",
":",
"tp_name",
"=",
"servicedep",
".",
"dependency_period",
"timeperiod",
"=",
"timeperiods",
".",
"find_by_name",
"(",
"tp_name",
")",
"if",
... | Replace dependency_period by a real object in service dependency
:param timeperiods: list of timeperiod, used to look for a specific one
:type timeperiods: alignak.objects.timeperiod.Timeperiods
:return: None | [
"Replace",
"dependency_period",
"by",
"a",
"real",
"object",
"in",
"service",
"dependency"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/servicedependency.py#L381-L397 | train |
Alignak-monitoring/alignak | alignak/objects/servicedependency.py | Servicedependencies.linkify_s_by_sd | def linkify_s_by_sd(self, services):
"""Add dependency in service objects
:return: None
"""
for servicedep in self:
# Only used for debugging purpose when loops are detected
setattr(servicedep, "service_description_string", "undefined")
setattr(servic... | python | def linkify_s_by_sd(self, services):
"""Add dependency in service objects
:return: None
"""
for servicedep in self:
# Only used for debugging purpose when loops are detected
setattr(servicedep, "service_description_string", "undefined")
setattr(servic... | [
"def",
"linkify_s_by_sd",
"(",
"self",
",",
"services",
")",
":",
"for",
"servicedep",
"in",
"self",
":",
"setattr",
"(",
"servicedep",
",",
"\"service_description_string\"",
",",
"\"undefined\"",
")",
"setattr",
"(",
"servicedep",
",",
"\"dependent_service_descript... | Add dependency in service objects
:return: None | [
"Add",
"dependency",
"in",
"service",
"objects"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/servicedependency.py#L399-L429 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.init | def init(self): # pylint: disable=too-many-branches
"""Called by the daemon broker to initialize the module"""
if not self.enabled:
logger.info(" the module is disabled.")
return True
try:
connections = self.test_connection()
except Exception as exp:... | python | def init(self): # pylint: disable=too-many-branches
"""Called by the daemon broker to initialize the module"""
if not self.enabled:
logger.info(" the module is disabled.")
return True
try:
connections = self.test_connection()
except Exception as exp:... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"enabled",
":",
"logger",
".",
"info",
"(",
"\" the module is disabled.\"",
")",
"return",
"True",
"try",
":",
"connections",
"=",
"self",
".",
"test_connection",
"(",
")",
"except",
"Exceptio... | Called by the daemon broker to initialize the module | [
"Called",
"by",
"the",
"daemon",
"broker",
"to",
"initialize",
"the",
"module"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L235-L294 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.get_metrics_from_perfdata | def get_metrics_from_perfdata(self, service, perf_data):
"""Decode the performance data to build a metrics list"""
result = []
metrics = PerfDatas(perf_data)
for metric in metrics:
logger.debug("service: %s, metric: %s (%s)", service, metric, metric.__dict__)
if... | python | def get_metrics_from_perfdata(self, service, perf_data):
"""Decode the performance data to build a metrics list"""
result = []
metrics = PerfDatas(perf_data)
for metric in metrics:
logger.debug("service: %s, metric: %s (%s)", service, metric, metric.__dict__)
if... | [
"def",
"get_metrics_from_perfdata",
"(",
"self",
",",
"service",
",",
"perf_data",
")",
":",
"result",
"=",
"[",
"]",
"metrics",
"=",
"PerfDatas",
"(",
"perf_data",
")",
"for",
"metric",
"in",
"metrics",
":",
"logger",
".",
"debug",
"(",
"\"service: %s, metr... | Decode the performance data to build a metrics list | [
"Decode",
"the",
"performance",
"data",
"to",
"build",
"a",
"metrics",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L364-L402 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.send_to_tsdb | def send_to_tsdb(self, realm, host, service, metrics, ts, path):
"""Send performance data to time series database
Indeed this function stores metrics in the internal cache and checks if the flushing
is necessary and then flushes.
:param realm: concerned realm
:type: string
... | python | def send_to_tsdb(self, realm, host, service, metrics, ts, path):
"""Send performance data to time series database
Indeed this function stores metrics in the internal cache and checks if the flushing
is necessary and then flushes.
:param realm: concerned realm
:type: string
... | [
"def",
"send_to_tsdb",
"(",
"self",
",",
"realm",
",",
"host",
",",
"service",
",",
"metrics",
",",
"ts",
",",
"path",
")",
":",
"if",
"ts",
"is",
"None",
":",
"ts",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"data",
"=",
"{",
"\"meas... | Send performance data to time series database
Indeed this function stores metrics in the internal cache and checks if the flushing
is necessary and then flushes.
:param realm: concerned realm
:type: string
:param host: concerned host
:type: string
:param service... | [
"Send",
"performance",
"data",
"to",
"time",
"series",
"database"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L546-L592 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.manage_initial_service_status_brok | def manage_initial_service_status_brok(self, b):
"""Prepare the known services cache"""
host_name = b.data['host_name']
service_description = b.data['service_description']
service_id = host_name+"/"+service_description
logger.debug("got initial service status: %s", service_id)
... | python | def manage_initial_service_status_brok(self, b):
"""Prepare the known services cache"""
host_name = b.data['host_name']
service_description = b.data['service_description']
service_id = host_name+"/"+service_description
logger.debug("got initial service status: %s", service_id)
... | [
"def",
"manage_initial_service_status_brok",
"(",
"self",
",",
"b",
")",
":",
"host_name",
"=",
"b",
".",
"data",
"[",
"'host_name'",
"]",
"service_description",
"=",
"b",
".",
"data",
"[",
"'service_description'",
"]",
"service_id",
"=",
"host_name",
"+",
"\"... | Prepare the known services cache | [
"Prepare",
"the",
"known",
"services",
"cache"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L594-L611 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.manage_initial_host_status_brok | def manage_initial_host_status_brok(self, b):
"""Prepare the known hosts cache"""
host_name = b.data['host_name']
logger.debug("got initial host status: %s", host_name)
self.hosts_cache[host_name] = {
'realm_name':
sanitize_name(b.data.get('realm_name', b.dat... | python | def manage_initial_host_status_brok(self, b):
"""Prepare the known hosts cache"""
host_name = b.data['host_name']
logger.debug("got initial host status: %s", host_name)
self.hosts_cache[host_name] = {
'realm_name':
sanitize_name(b.data.get('realm_name', b.dat... | [
"def",
"manage_initial_host_status_brok",
"(",
"self",
",",
"b",
")",
":",
"host_name",
"=",
"b",
".",
"data",
"[",
"'host_name'",
"]",
"logger",
".",
"debug",
"(",
"\"got initial host status: %s\"",
",",
"host_name",
")",
"self",
".",
"hosts_cache",
"[",
"hos... | Prepare the known hosts cache | [
"Prepare",
"the",
"known",
"hosts",
"cache"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L613-L627 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.manage_service_check_result_brok | def manage_service_check_result_brok(self, b): # pylint: disable=too-many-branches
"""A service check result brok has just arrived ..."""
host_name = b.data.get('host_name', None)
service_description = b.data.get('service_description', None)
if not host_name or not service_description:
... | python | def manage_service_check_result_brok(self, b): # pylint: disable=too-many-branches
"""A service check result brok has just arrived ..."""
host_name = b.data.get('host_name', None)
service_description = b.data.get('service_description', None)
if not host_name or not service_description:
... | [
"def",
"manage_service_check_result_brok",
"(",
"self",
",",
"b",
")",
":",
"host_name",
"=",
"b",
".",
"data",
".",
"get",
"(",
"'host_name'",
",",
"None",
")",
"service_description",
"=",
"b",
".",
"data",
".",
"get",
"(",
"'service_description'",
",",
"... | A service check result brok has just arrived ... | [
"A",
"service",
"check",
"result",
"brok",
"has",
"just",
"arrived",
"..."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L629-L688 | train |
Alignak-monitoring/alignak | alignak/modules/inner_metrics.py | InnerMetrics.manage_host_check_result_brok | def manage_host_check_result_brok(self, b): # pylint: disable=too-many-branches
"""An host check result brok has just arrived..."""
host_name = b.data.get('host_name', None)
if not host_name:
return
logger.debug("host check result: %s", host_name)
# If host initial ... | python | def manage_host_check_result_brok(self, b): # pylint: disable=too-many-branches
"""An host check result brok has just arrived..."""
host_name = b.data.get('host_name', None)
if not host_name:
return
logger.debug("host check result: %s", host_name)
# If host initial ... | [
"def",
"manage_host_check_result_brok",
"(",
"self",
",",
"b",
")",
":",
"host_name",
"=",
"b",
".",
"data",
".",
"get",
"(",
"'host_name'",
",",
"None",
")",
"if",
"not",
"host_name",
":",
"return",
"logger",
".",
"debug",
"(",
"\"host check result: %s\"",
... | An host check result brok has just arrived... | [
"An",
"host",
"check",
"result",
"brok",
"has",
"just",
"arrived",
"..."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/modules/inner_metrics.py#L690-L740 | train |
Alignak-monitoring/alignak | alignak/comment.py | Comment.get_comment_brok | def get_comment_brok(self, host_name, service_name=''):
"""Get a comment brok
:param host_name:
:param service_name:
:return: brok with wanted data
:rtype: alignak.brok.Brok
"""
data = self.serialize()
data['host'] = host_name
if service_name:
... | python | def get_comment_brok(self, host_name, service_name=''):
"""Get a comment brok
:param host_name:
:param service_name:
:return: brok with wanted data
:rtype: alignak.brok.Brok
"""
data = self.serialize()
data['host'] = host_name
if service_name:
... | [
"def",
"get_comment_brok",
"(",
"self",
",",
"host_name",
",",
"service_name",
"=",
"''",
")",
":",
"data",
"=",
"self",
".",
"serialize",
"(",
")",
"data",
"[",
"'host'",
"]",
"=",
"host_name",
"if",
"service_name",
":",
"data",
"[",
"'service'",
"]",
... | Get a comment brok
:param host_name:
:param service_name:
:return: brok with wanted data
:rtype: alignak.brok.Brok | [
"Get",
"a",
"comment",
"brok"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/comment.py#L124-L137 | train |
Alignak-monitoring/alignak | alignak/objects/notificationway.py | NotificationWays.new_inner_member | def new_inner_member(self, name, params):
"""Create new instance of NotificationWay with given name and parameters
and add it to the item list
:param name: notification way name
:type name: str
:param params: notification wat parameters
:type params: dict
:return... | python | def new_inner_member(self, name, params):
"""Create new instance of NotificationWay with given name and parameters
and add it to the item list
:param name: notification way name
:type name: str
:param params: notification wat parameters
:type params: dict
:return... | [
"def",
"new_inner_member",
"(",
"self",
",",
"name",
",",
"params",
")",
":",
"params",
"[",
"'notificationway_name'",
"]",
"=",
"name",
"self",
".",
"add_item",
"(",
"NotificationWay",
"(",
"params",
")",
")"
] | Create new instance of NotificationWay with given name and parameters
and add it to the item list
:param name: notification way name
:type name: str
:param params: notification wat parameters
:type params: dict
:return: None | [
"Create",
"new",
"instance",
"of",
"NotificationWay",
"with",
"given",
"name",
"and",
"parameters",
"and",
"add",
"it",
"to",
"the",
"item",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/notificationway.py#L389-L400 | train |
Alignak-monitoring/alignak | alignak/misc/serialization.py | serialize | def serialize(obj, no_dump=False):
"""
Serialize an object.
Returns a dict containing an `_error` property if a MemoryError happens during the
object serialization. See #369.
:param obj: the object to serialize
:type obj: alignak.objects.item.Item | dict | list | str
:param no_dump: if Tru... | python | def serialize(obj, no_dump=False):
"""
Serialize an object.
Returns a dict containing an `_error` property if a MemoryError happens during the
object serialization. See #369.
:param obj: the object to serialize
:type obj: alignak.objects.item.Item | dict | list | str
:param no_dump: if Tru... | [
"def",
"serialize",
"(",
"obj",
",",
"no_dump",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"\"serialize\"",
")",
"and",
"isinstance",
"(",
"obj",
".",
"serialize",
",",
"collections",
".",
"Callable",
")",
":",
"o_dict",
"=",
"{",
"'__sy... | Serialize an object.
Returns a dict containing an `_error` property if a MemoryError happens during the
object serialization. See #369.
:param obj: the object to serialize
:type obj: alignak.objects.item.Item | dict | list | str
:param no_dump: if True return dict, otherwise return a json
:typ... | [
"Serialize",
"an",
"object",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/misc/serialization.py#L31-L78 | train |
Alignak-monitoring/alignak | alignak/brok.py | Brok.get_event | def get_event(self):
"""This function returns an Event from a Brok
If the type is monitoring_log then the Brok contains a monitoring event
(alert, notification, ...) information. This function will return a tuple
with the creation time, the level and message information
:return... | python | def get_event(self):
"""This function returns an Event from a Brok
If the type is monitoring_log then the Brok contains a monitoring event
(alert, notification, ...) information. This function will return a tuple
with the creation time, the level and message information
:return... | [
"def",
"get_event",
"(",
"self",
")",
":",
"self",
".",
"prepare",
"(",
")",
"return",
"(",
"self",
".",
"creation_time",
",",
"self",
".",
"data",
"[",
"'level'",
"]",
",",
"self",
".",
"data",
"[",
"'message'",
"]",
")"
] | This function returns an Event from a Brok
If the type is monitoring_log then the Brok contains a monitoring event
(alert, notification, ...) information. This function will return a tuple
with the creation time, the level and message information
:return: tuple with date, level and mes... | [
"This",
"function",
"returns",
"an",
"Event",
"from",
"a",
"Brok"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/brok.py#L116-L127 | train |
Alignak-monitoring/alignak | alignak/brok.py | Brok.prepare | def prepare(self):
"""Un-serialize data from data attribute and add instance_id key if necessary
:return: None
"""
# Maybe the Brok is a old daemon one or was already prepared
# if so, the data is already ok
if hasattr(self, 'prepared') and not self.prepared:
... | python | def prepare(self):
"""Un-serialize data from data attribute and add instance_id key if necessary
:return: None
"""
# Maybe the Brok is a old daemon one or was already prepared
# if so, the data is already ok
if hasattr(self, 'prepared') and not self.prepared:
... | [
"def",
"prepare",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'prepared'",
")",
"and",
"not",
"self",
".",
"prepared",
":",
"self",
".",
"data",
"=",
"unserialize",
"(",
"self",
".",
"data",
")",
"if",
"self",
".",
"instance_id",
":",
... | Un-serialize data from data attribute and add instance_id key if necessary
:return: None | [
"Un",
"-",
"serialize",
"data",
"from",
"data",
"attribute",
"and",
"add",
"instance_id",
"key",
"if",
"necessary"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/brok.py#L144-L155 | train |
Alignak-monitoring/alignak | alignak/complexexpression.py | ComplexExpressionNode.resolve_elements | def resolve_elements(self):
"""Get element of this node recursively
Compute rules with OR or AND rule then NOT rules.
:return: set of element
:rtype: set
"""
# If it's a leaf, we just need to dump a set with the content of the node
if self.leaf:
if no... | python | def resolve_elements(self):
"""Get element of this node recursively
Compute rules with OR or AND rule then NOT rules.
:return: set of element
:rtype: set
"""
# If it's a leaf, we just need to dump a set with the content of the node
if self.leaf:
if no... | [
"def",
"resolve_elements",
"(",
"self",
")",
":",
"if",
"self",
".",
"leaf",
":",
"if",
"not",
"self",
".",
"content",
":",
"return",
"set",
"(",
")",
"return",
"set",
"(",
"self",
".",
"content",
")",
"not_nodes",
"=",
"[",
"s",
"for",
"s",
"in",
... | Get element of this node recursively
Compute rules with OR or AND rule then NOT rules.
:return: set of element
:rtype: set | [
"Get",
"element",
"of",
"this",
"node",
"recursively",
"Compute",
"rules",
"with",
"OR",
"or",
"AND",
"rule",
"then",
"NOT",
"rules",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/complexexpression.py#L72-L114 | train |
Alignak-monitoring/alignak | alignak/complexexpression.py | ComplexExpressionFactory.eval_cor_pattern | def eval_cor_pattern(self, pattern): # pylint:disable=too-many-branches
"""Parse and build recursively a tree of ComplexExpressionNode from pattern
:param pattern: pattern to parse
:type pattern: str
:return: root node of parsed tree
:type: alignak.complexexpression.ComplexExpr... | python | def eval_cor_pattern(self, pattern): # pylint:disable=too-many-branches
"""Parse and build recursively a tree of ComplexExpressionNode from pattern
:param pattern: pattern to parse
:type pattern: str
:return: root node of parsed tree
:type: alignak.complexexpression.ComplexExpr... | [
"def",
"eval_cor_pattern",
"(",
"self",
",",
"pattern",
")",
":",
"pattern",
"=",
"pattern",
".",
"strip",
"(",
")",
"complex_node",
"=",
"False",
"for",
"char",
"in",
"'()+&|,'",
":",
"if",
"char",
"in",
"pattern",
":",
"complex_node",
"=",
"True",
"nod... | Parse and build recursively a tree of ComplexExpressionNode from pattern
:param pattern: pattern to parse
:type pattern: str
:return: root node of parsed tree
:type: alignak.complexexpression.ComplexExpressionNode | [
"Parse",
"and",
"build",
"recursively",
"a",
"tree",
"of",
"ComplexExpressionNode",
"from",
"pattern"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/complexexpression.py#L147-L261 | train |
Alignak-monitoring/alignak | alignak/complexexpression.py | ComplexExpressionFactory.find_object | def find_object(self, pattern):
"""Get a list of host corresponding to the pattern regarding the context
:param pattern: pattern to find
:type pattern: str
:return: Host list matching pattern (hostgroup name, template, all)
:rtype: list[alignak.objects.host.Host]
"""
... | python | def find_object(self, pattern):
"""Get a list of host corresponding to the pattern regarding the context
:param pattern: pattern to find
:type pattern: str
:return: Host list matching pattern (hostgroup name, template, all)
:rtype: list[alignak.objects.host.Host]
"""
... | [
"def",
"find_object",
"(",
"self",
",",
"pattern",
")",
":",
"obj",
"=",
"None",
"error",
"=",
"None",
"pattern",
"=",
"pattern",
".",
"strip",
"(",
")",
"if",
"pattern",
"==",
"'*'",
":",
"obj",
"=",
"[",
"h",
".",
"host_name",
"for",
"h",
"in",
... | Get a list of host corresponding to the pattern regarding the context
:param pattern: pattern to find
:type pattern: str
:return: Host list matching pattern (hostgroup name, template, all)
:rtype: list[alignak.objects.host.Host] | [
"Get",
"a",
"list",
"of",
"host",
"corresponding",
"to",
"the",
"pattern",
"regarding",
"the",
"context"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/complexexpression.py#L263-L303 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.all_my_hosts_and_services | def all_my_hosts_and_services(self):
"""Create an iterator for all my known hosts and services
:return: None
"""
for what in (self.hosts, self.services):
for item in what:
yield item | python | def all_my_hosts_and_services(self):
"""Create an iterator for all my known hosts and services
:return: None
"""
for what in (self.hosts, self.services):
for item in what:
yield item | [
"def",
"all_my_hosts_and_services",
"(",
"self",
")",
":",
"for",
"what",
"in",
"(",
"self",
".",
"hosts",
",",
"self",
".",
"services",
")",
":",
"for",
"item",
"in",
"what",
":",
"yield",
"item"
] | Create an iterator for all my known hosts and services
:return: None | [
"Create",
"an",
"iterator",
"for",
"all",
"my",
"known",
"hosts",
"and",
"services"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L265-L272 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.load_conf | def load_conf(self, instance_id, instance_name, conf):
"""Load configuration received from Arbiter and pushed by our Scheduler daemon
:param instance_name: scheduler instance name
:type instance_name: str
:param instance_id: scheduler instance id
:type instance_id: str
:... | python | def load_conf(self, instance_id, instance_name, conf):
"""Load configuration received from Arbiter and pushed by our Scheduler daemon
:param instance_name: scheduler instance name
:type instance_name: str
:param instance_id: scheduler instance id
:type instance_id: str
:... | [
"def",
"load_conf",
"(",
"self",
",",
"instance_id",
",",
"instance_name",
",",
"conf",
")",
":",
"self",
".",
"pushed_conf",
"=",
"conf",
"logger",
".",
"info",
"(",
"\"loading my configuration (%s / %s):\"",
",",
"instance_id",
",",
"self",
".",
"pushed_conf",... | Load configuration received from Arbiter and pushed by our Scheduler daemon
:param instance_name: scheduler instance name
:type instance_name: str
:param instance_id: scheduler instance id
:type instance_id: str
:param conf: configuration to load
:type conf: alignak.obje... | [
"Load",
"configuration",
"received",
"from",
"Arbiter",
"and",
"pushed",
"by",
"our",
"Scheduler",
"daemon"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L274-L329 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.update_recurrent_works_tick | def update_recurrent_works_tick(self, conf):
"""Modify the tick value for the scheduler recurrent work
A tick is an amount of loop of the scheduler before executing the recurrent work
The provided configuration may contain some tick-function_name keys that contain
a tick value to be up... | python | def update_recurrent_works_tick(self, conf):
"""Modify the tick value for the scheduler recurrent work
A tick is an amount of loop of the scheduler before executing the recurrent work
The provided configuration may contain some tick-function_name keys that contain
a tick value to be up... | [
"def",
"update_recurrent_works_tick",
"(",
"self",
",",
"conf",
")",
":",
"for",
"key",
"in",
"self",
".",
"recurrent_works",
":",
"(",
"name",
",",
"fun",
",",
"_",
")",
"=",
"self",
".",
"recurrent_works",
"[",
"key",
"]",
"if",
"isinstance",
"(",
"c... | Modify the tick value for the scheduler recurrent work
A tick is an amount of loop of the scheduler before executing the recurrent work
The provided configuration may contain some tick-function_name keys that contain
a tick value to be updated. Those parameters are defined in the alignak envir... | [
"Modify",
"the",
"tick",
"value",
"for",
"the",
"scheduler",
"recurrent",
"work"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L331-L364 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.dump_config | def dump_config(self):
"""Dump scheduler configuration into a temporary file
The dumped content is JSON formatted
:return: None
"""
path = os.path.join(tempfile.gettempdir(),
'dump-cfg-scheduler-%s-%d.json' % (self.name, int(time.time())))
t... | python | def dump_config(self):
"""Dump scheduler configuration into a temporary file
The dumped content is JSON formatted
:return: None
"""
path = os.path.join(tempfile.gettempdir(),
'dump-cfg-scheduler-%s-%d.json' % (self.name, int(time.time())))
t... | [
"def",
"dump_config",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"gettempdir",
"(",
")",
",",
"'dump-cfg-scheduler-%s-%d.json'",
"%",
"(",
"self",
".",
"name",
",",
"int",
"(",
"time",
".",
"time",
"(",
... | Dump scheduler configuration into a temporary file
The dumped content is JSON formatted
:return: None | [
"Dump",
"scheduler",
"configuration",
"into",
"a",
"temporary",
"file"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L421-L435 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.add_notification | def add_notification(self, notification):
"""Add a notification into actions list
:param notification: notification to add
:type notification: alignak.notification.Notification
:return: None
"""
if notification.uuid in self.actions:
logger.warning("Already ex... | python | def add_notification(self, notification):
"""Add a notification into actions list
:param notification: notification to add
:type notification: alignak.notification.Notification
:return: None
"""
if notification.uuid in self.actions:
logger.warning("Already ex... | [
"def",
"add_notification",
"(",
"self",
",",
"notification",
")",
":",
"if",
"notification",
".",
"uuid",
"in",
"self",
".",
"actions",
":",
"logger",
".",
"warning",
"(",
"\"Already existing notification: %s\"",
",",
"notification",
")",
"return",
"logger",
"."... | Add a notification into actions list
:param notification: notification to add
:type notification: alignak.notification.Notification
:return: None | [
"Add",
"a",
"notification",
"into",
"actions",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L503-L520 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.add_check | def add_check(self, check):
"""Add a check into the scheduler checks list
:param check: check to add
:type check: alignak.check.Check
:return: None
"""
if check is None:
return
if check.uuid in self.checks:
logger.debug("Already existing c... | python | def add_check(self, check):
"""Add a check into the scheduler checks list
:param check: check to add
:type check: alignak.check.Check
:return: None
"""
if check is None:
return
if check.uuid in self.checks:
logger.debug("Already existing c... | [
"def",
"add_check",
"(",
"self",
",",
"check",
")",
":",
"if",
"check",
"is",
"None",
":",
"return",
"if",
"check",
".",
"uuid",
"in",
"self",
".",
"checks",
":",
"logger",
".",
"debug",
"(",
"\"Already existing check: %s\"",
",",
"check",
")",
"return",... | Add a check into the scheduler checks list
:param check: check to add
:type check: alignak.check.Check
:return: None | [
"Add",
"a",
"check",
"into",
"the",
"scheduler",
"checks",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L522-L544 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.add_event_handler | def add_event_handler(self, action):
"""Add a event handler into actions list
:param action: event handler to add
:type action: alignak.eventhandler.EventHandler
:return: None
"""
if action.uuid in self.actions:
logger.info("Already existing event handler: %s... | python | def add_event_handler(self, action):
"""Add a event handler into actions list
:param action: event handler to add
:type action: alignak.eventhandler.EventHandler
:return: None
"""
if action.uuid in self.actions:
logger.info("Already existing event handler: %s... | [
"def",
"add_event_handler",
"(",
"self",
",",
"action",
")",
":",
"if",
"action",
".",
"uuid",
"in",
"self",
".",
"actions",
":",
"logger",
".",
"info",
"(",
"\"Already existing event handler: %s\"",
",",
"action",
")",
"return",
"self",
".",
"actions",
"[",... | Add a event handler into actions list
:param action: event handler to add
:type action: alignak.eventhandler.EventHandler
:return: None | [
"Add",
"a",
"event",
"handler",
"into",
"actions",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L546-L558 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.hook_point | def hook_point(self, hook_name):
"""Generic function to call modules methods if such method is avalaible
:param hook_name: function name to call
:type hook_name: str
:return:None
"""
self.my_daemon.hook_point(hook_name=hook_name, handle=self) | python | def hook_point(self, hook_name):
"""Generic function to call modules methods if such method is avalaible
:param hook_name: function name to call
:type hook_name: str
:return:None
"""
self.my_daemon.hook_point(hook_name=hook_name, handle=self) | [
"def",
"hook_point",
"(",
"self",
",",
"hook_name",
")",
":",
"self",
".",
"my_daemon",
".",
"hook_point",
"(",
"hook_name",
"=",
"hook_name",
",",
"handle",
"=",
"self",
")"
] | Generic function to call modules methods if such method is avalaible
:param hook_name: function name to call
:type hook_name: str
:return:None | [
"Generic",
"function",
"to",
"call",
"modules",
"methods",
"if",
"such",
"method",
"is",
"avalaible"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L600-L607 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.clean_queues | def clean_queues(self):
# pylint: disable=too-many-locals
"""Reduces internal list size to max allowed
* checks and broks : 5 * length of hosts + services
* actions : 5 * length of hosts + services + contacts
:return: None
"""
# If we set the interval at 0, we b... | python | def clean_queues(self):
# pylint: disable=too-many-locals
"""Reduces internal list size to max allowed
* checks and broks : 5 * length of hosts + services
* actions : 5 * length of hosts + services + contacts
:return: None
"""
# If we set the interval at 0, we b... | [
"def",
"clean_queues",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
".",
"pushed_conf",
",",
"'tick_clean_queues'",
",",
"0",
")",
"==",
"0",
":",
"logger",
".",
"debug",
"(",
"\"No queues cleaning...\"",
")",
"return",
"max_checks",
"=",
"MULTIPLIER... | Reduces internal list size to max allowed
* checks and broks : 5 * length of hosts + services
* actions : 5 * length of hosts + services + contacts
:return: None | [
"Reduces",
"internal",
"list",
"size",
"to",
"max",
"allowed"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L609-L680 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.update_business_values | def update_business_values(self):
"""Iter over host and service and update business_impact
:return: None
"""
for elt in self.all_my_hosts_and_services():
if not elt.is_problem:
was = elt.business_impact
elt.update_business_impact_value(self.ho... | python | def update_business_values(self):
"""Iter over host and service and update business_impact
:return: None
"""
for elt in self.all_my_hosts_and_services():
if not elt.is_problem:
was = elt.business_impact
elt.update_business_impact_value(self.ho... | [
"def",
"update_business_values",
"(",
"self",
")",
":",
"for",
"elt",
"in",
"self",
".",
"all_my_hosts_and_services",
"(",
")",
":",
"if",
"not",
"elt",
".",
"is_problem",
":",
"was",
"=",
"elt",
".",
"business_impact",
"elt",
".",
"update_business_impact_valu... | Iter over host and service and update business_impact
:return: None | [
"Iter",
"over",
"host",
"and",
"service",
"and",
"update",
"business_impact"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L716-L744 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.scatter_master_notifications | def scatter_master_notifications(self):
"""Generate children notifications from a master notification
Also update notification number
Master notification are raised when a notification must be sent out. They are not
launched by reactionners (only children are) but they are used to build... | python | def scatter_master_notifications(self):
"""Generate children notifications from a master notification
Also update notification number
Master notification are raised when a notification must be sent out. They are not
launched by reactionners (only children are) but they are used to build... | [
"def",
"scatter_master_notifications",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"notifications",
"=",
"[",
"a",
"for",
"a",
"in",
"self",
".",
"actions",
".",
"values",
"(",
")",
"if",
"a",
".",
"is_a",
"==",
"u'notification'",... | Generate children notifications from a master notification
Also update notification number
Master notification are raised when a notification must be sent out. They are not
launched by reactionners (only children are) but they are used to build the
children notifications.
From ... | [
"Generate",
"children",
"notifications",
"from",
"a",
"master",
"notification",
"Also",
"update",
"notification",
"number"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L746-L828 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.manage_internal_checks | def manage_internal_checks(self):
"""Run internal checks
:return: None
"""
if os.getenv('ALIGNAK_MANAGE_INTERNAL', '1') != '1':
return
now = time.time()
for chk in list(self.checks.values()):
if not chk.internal:
# Exclude checks t... | python | def manage_internal_checks(self):
"""Run internal checks
:return: None
"""
if os.getenv('ALIGNAK_MANAGE_INTERNAL', '1') != '1':
return
now = time.time()
for chk in list(self.checks.values()):
if not chk.internal:
# Exclude checks t... | [
"def",
"manage_internal_checks",
"(",
"self",
")",
":",
"if",
"os",
".",
"getenv",
"(",
"'ALIGNAK_MANAGE_INTERNAL'",
",",
"'1'",
")",
"!=",
"'1'",
":",
"return",
"now",
"=",
"time",
".",
"time",
"(",
")",
"for",
"chk",
"in",
"list",
"(",
"self",
".",
... | Run internal checks
:return: None | [
"Run",
"internal",
"checks"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1190-L1222 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.reset_topology_change_flag | def reset_topology_change_flag(self):
"""Set topology_change attribute to False in all hosts and services
:return: None
"""
for i in self.hosts:
i.topology_change = False
for i in self.services:
i.topology_change = False | python | def reset_topology_change_flag(self):
"""Set topology_change attribute to False in all hosts and services
:return: None
"""
for i in self.hosts:
i.topology_change = False
for i in self.services:
i.topology_change = False | [
"def",
"reset_topology_change_flag",
"(",
"self",
")",
":",
"for",
"i",
"in",
"self",
".",
"hosts",
":",
"i",
".",
"topology_change",
"=",
"False",
"for",
"i",
"in",
"self",
".",
"services",
":",
"i",
".",
"topology_change",
"=",
"False"
] | Set topology_change attribute to False in all hosts and services
:return: None | [
"Set",
"topology_change",
"attribute",
"to",
"False",
"in",
"all",
"hosts",
"and",
"services"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1224-L1232 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.log_initial_states | def log_initial_states(self):
"""Raise hosts and services initial status logs
First, raise hosts status and then services. This to allow the events log
to be a little sorted.
:return: None
"""
# Raise hosts initial status broks
for elt in self.hosts:
... | python | def log_initial_states(self):
"""Raise hosts and services initial status logs
First, raise hosts status and then services. This to allow the events log
to be a little sorted.
:return: None
"""
# Raise hosts initial status broks
for elt in self.hosts:
... | [
"def",
"log_initial_states",
"(",
"self",
")",
":",
"for",
"elt",
"in",
"self",
".",
"hosts",
":",
"elt",
".",
"raise_initial_state",
"(",
")",
"for",
"elt",
"in",
"self",
".",
"services",
":",
"elt",
".",
"raise_initial_state",
"(",
")"
] | Raise hosts and services initial status logs
First, raise hosts status and then services. This to allow the events log
to be a little sorted.
:return: None | [
"Raise",
"hosts",
"and",
"services",
"initial",
"status",
"logs"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1276-L1290 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.get_retention_data | def get_retention_data(self): # pylint: disable=too-many-branches,too-many-statements
# pylint: disable=too-many-locals
"""Get all hosts and services data to be sent to the retention storage.
This function only prepares the data because a module is in charge of making
the data survive ... | python | def get_retention_data(self): # pylint: disable=too-many-branches,too-many-statements
# pylint: disable=too-many-locals
"""Get all hosts and services data to be sent to the retention storage.
This function only prepares the data because a module is in charge of making
the data survive ... | [
"def",
"get_retention_data",
"(",
"self",
")",
":",
"retention_data",
"=",
"{",
"'hosts'",
":",
"{",
"}",
",",
"'services'",
":",
"{",
"}",
"}",
"for",
"host",
"in",
"self",
".",
"hosts",
":",
"h_dict",
"=",
"{",
"}",
"properties",
"=",
"host",
".",
... | Get all hosts and services data to be sent to the retention storage.
This function only prepares the data because a module is in charge of making
the data survive to the scheduler restart.
todo: Alignak scheduler creates two separate dictionaries: hosts and services
It would be better ... | [
"Get",
"all",
"hosts",
"and",
"services",
"data",
"to",
"be",
"sent",
"to",
"the",
"retention",
"storage",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1292-L1349 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.restore_retention_data | def restore_retention_data(self, data):
"""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
:param data: data from retention
... | python | def restore_retention_data(self, data):
"""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
:param data: data from retention
... | [
"def",
"restore_retention_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"'hosts'",
"not",
"in",
"data",
":",
"logger",
".",
"warning",
"(",
"\"Retention data are not correct, no 'hosts' property!\"",
")",
"return",
"for",
"host_name",
"in",
"data",
"[",
"'hosts... | 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
:param data: data from retention
:type data: dict
:return: None | [
"Restore",
"retention",
"data"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1351-L1382 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.restore_retention_data_item | def restore_retention_data_item(self, data, item):
# pylint: disable=too-many-branches, too-many-locals
"""
Restore data in item
:param data: retention data of the item
:type data: dict
:param item: host or service item
:type item: alignak.objects.host.Host | ali... | python | def restore_retention_data_item(self, data, item):
# pylint: disable=too-many-branches, too-many-locals
"""
Restore data in item
:param data: retention data of the item
:type data: dict
:param item: host or service item
:type item: alignak.objects.host.Host | ali... | [
"def",
"restore_retention_data_item",
"(",
"self",
",",
"data",
",",
"item",
")",
":",
"properties",
"=",
"item",
".",
"__class__",
".",
"properties",
"properties",
".",
"update",
"(",
"item",
".",
"__class__",
".",
"running_properties",
")",
"for",
"prop",
... | Restore data in item
:param data: retention data of the item
:type data: dict
:param item: host or service item
:type item: alignak.objects.host.Host | alignak.objects.service.Service
:return: None | [
"Restore",
"data",
"in",
"item"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1384-L1468 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.fill_initial_broks | def fill_initial_broks(self, broker_name):
# pylint: disable=too-many-branches
"""Create initial broks for a specific broker
:param broker_name: broker name
:type broker_name: str
:return: number of created broks
"""
broker_uuid = None
logger.debug("My br... | python | def fill_initial_broks(self, broker_name):
# pylint: disable=too-many-branches
"""Create initial broks for a specific broker
:param broker_name: broker name
:type broker_name: str
:return: number of created broks
"""
broker_uuid = None
logger.debug("My br... | [
"def",
"fill_initial_broks",
"(",
"self",
",",
"broker_name",
")",
":",
"broker_uuid",
"=",
"None",
"logger",
".",
"debug",
"(",
"\"My brokers: %s\"",
",",
"self",
".",
"my_daemon",
".",
"brokers",
")",
"for",
"broker_link",
"in",
"list",
"(",
"self",
".",
... | Create initial broks for a specific broker
:param broker_name: broker name
:type broker_name: str
:return: number of created broks | [
"Create",
"initial",
"broks",
"for",
"a",
"specific",
"broker"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1470-L1547 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.get_program_status_brok | def get_program_status_brok(self, brok_type='program_status'):
"""Create a program status brok
Initially builds the running properties and then, if initial status brok,
get the properties from the Config class where an entry exist for the brok
'full_status'
:return: Brok with p... | python | def get_program_status_brok(self, brok_type='program_status'):
"""Create a program status brok
Initially builds the running properties and then, if initial status brok,
get the properties from the Config class where an entry exist for the brok
'full_status'
:return: Brok with p... | [
"def",
"get_program_status_brok",
"(",
"self",
",",
"brok_type",
"=",
"'program_status'",
")",
":",
"data",
"=",
"{",
"\"is_running\"",
":",
"True",
",",
"\"instance_id\"",
":",
"self",
".",
"instance_id",
",",
"\"instance_name\"",
":",
"self",
".",
"name",
",... | Create a program status brok
Initially builds the running properties and then, if initial status brok,
get the properties from the Config class where an entry exist for the brok
'full_status'
:return: Brok with program status data
:rtype: alignak.brok.Brok | [
"Create",
"a",
"program",
"status",
"brok"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1563-L1606 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.consume_results | def consume_results(self): # pylint: disable=too-many-branches
"""Handle results waiting in waiting_results list.
Check ref will call consume result and update their status
:return: None
"""
# All results are in self.waiting_results
# We need to get them first
q... | python | def consume_results(self): # pylint: disable=too-many-branches
"""Handle results waiting in waiting_results list.
Check ref will call consume result and update their status
:return: None
"""
# All results are in self.waiting_results
# We need to get them first
q... | [
"def",
"consume_results",
"(",
"self",
")",
":",
"queue_size",
"=",
"self",
".",
"waiting_results",
".",
"qsize",
"(",
")",
"for",
"_",
"in",
"range",
"(",
"queue_size",
")",
":",
"self",
".",
"manage_results",
"(",
"self",
".",
"waiting_results",
".",
"... | Handle results waiting in waiting_results list.
Check ref will call consume result and update their status
:return: None | [
"Handle",
"results",
"waiting",
"in",
"waiting_results",
"list",
".",
"Check",
"ref",
"will",
"call",
"consume",
"result",
"and",
"update",
"their",
"status"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1608-L1675 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.get_new_actions | def get_new_actions(self):
"""Call 'get_new_actions' hook point
Iter over all hosts and services to add new actions in internal lists
:return: None
"""
_t0 = time.time()
self.hook_point('get_new_actions')
statsmgr.timer('hook.get-new-actions', time.time() - _t0)
... | python | def get_new_actions(self):
"""Call 'get_new_actions' hook point
Iter over all hosts and services to add new actions in internal lists
:return: None
"""
_t0 = time.time()
self.hook_point('get_new_actions')
statsmgr.timer('hook.get-new-actions', time.time() - _t0)
... | [
"def",
"get_new_actions",
"(",
"self",
")",
":",
"_t0",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"hook_point",
"(",
"'get_new_actions'",
")",
"statsmgr",
".",
"timer",
"(",
"'hook.get-new-actions'",
",",
"time",
".",
"time",
"(",
")",
"-",
"_t0",... | Call 'get_new_actions' hook point
Iter over all hosts and services to add new actions in internal lists
:return: None | [
"Call",
"get_new_actions",
"hook",
"point",
"Iter",
"over",
"all",
"hosts",
"and",
"services",
"to",
"add",
"new",
"actions",
"in",
"internal",
"lists"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1805-L1820 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.get_new_broks | def get_new_broks(self):
"""Iter over all hosts and services to add new broks in internal lists
:return: None
"""
# ask for service and hosts their broks waiting
# be eaten
for elt in self.all_my_hosts_and_services():
for brok in elt.broks:
se... | python | def get_new_broks(self):
"""Iter over all hosts and services to add new broks in internal lists
:return: None
"""
# ask for service and hosts their broks waiting
# be eaten
for elt in self.all_my_hosts_and_services():
for brok in elt.broks:
se... | [
"def",
"get_new_broks",
"(",
"self",
")",
":",
"for",
"elt",
"in",
"self",
".",
"all_my_hosts_and_services",
"(",
")",
":",
"for",
"brok",
"in",
"elt",
".",
"broks",
":",
"self",
".",
"add",
"(",
"brok",
")",
"elt",
".",
"broks",
"=",
"[",
"]",
"fo... | Iter over all hosts and services to add new broks in internal lists
:return: None | [
"Iter",
"over",
"all",
"hosts",
"and",
"services",
"to",
"add",
"new",
"broks",
"in",
"internal",
"lists"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1822-L1840 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.send_broks_to_modules | def send_broks_to_modules(self):
"""Put broks into module queues
Only broks without sent_to_externals to True are sent
Only modules that ask for broks will get some
:return: None
"""
t00 = time.time()
nb_sent = 0
broks = []
for broker_link in list... | python | def send_broks_to_modules(self):
"""Put broks into module queues
Only broks without sent_to_externals to True are sent
Only modules that ask for broks will get some
:return: None
"""
t00 = time.time()
nb_sent = 0
broks = []
for broker_link in list... | [
"def",
"send_broks_to_modules",
"(",
"self",
")",
":",
"t00",
"=",
"time",
".",
"time",
"(",
")",
"nb_sent",
"=",
"0",
"broks",
"=",
"[",
"]",
"for",
"broker_link",
"in",
"list",
"(",
"self",
".",
"my_daemon",
".",
"brokers",
".",
"values",
"(",
")",... | Put broks into module queues
Only broks without sent_to_externals to True are sent
Only modules that ask for broks will get some
:return: None | [
"Put",
"broks",
"into",
"module",
"queues",
"Only",
"broks",
"without",
"sent_to_externals",
"to",
"True",
"are",
"sent",
"Only",
"modules",
"that",
"ask",
"for",
"broks",
"will",
"get",
"some"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L1978-L2011 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.find_item_by_id | 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 | 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... | [
"def",
"find_item_by_id",
"(",
"self",
",",
"object_id",
")",
":",
"if",
"isinstance",
"(",
"object_id",
",",
"Item",
")",
":",
"return",
"object_id",
"if",
"not",
"isinstance",
"(",
"object_id",
",",
"string_types",
")",
":",
"logger",
".",
"debug",
"(",
... | Get item based on its id or uuid
:param object_id:
:type object_id: int | str
:return:
:rtype: alignak.objects.item.Item | None | [
"Get",
"item",
"based",
"on",
"its",
"id",
"or",
"uuid"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L2203-L2227 | train |
Alignak-monitoring/alignak | alignak/scheduler.py | Scheduler.before_run | 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 | 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 =... | [
"def",
"before_run",
"(",
"self",
")",
":",
"self",
".",
"nb_checks",
"=",
"0",
"self",
".",
"nb_internal_checks",
"=",
"0",
"self",
".",
"nb_checks_launched",
"=",
"0",
"self",
".",
"nb_actions_launched",
"=",
"0",
"self",
".",
"nb_checks_results",
"=",
"... | Initialize the scheduling process | [
"Initialize",
"the",
"scheduling",
"process"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/scheduler.py#L2230-L2257 | train |
Alignak-monitoring/alignak | alignak/daemons/receiverdaemon.py | Receiver.setup_new_conf | 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 | 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
"""
#... | [
"def",
"setup_new_conf",
"(",
"self",
")",
":",
"super",
"(",
"Receiver",
",",
"self",
")",
".",
"setup_new_conf",
"(",
")",
"with",
"self",
".",
"conf_lock",
":",
"logger",
".",
"debug",
"(",
"\"Got config: %s\"",
",",
"self",
".",
"cur_conf",
")",
"if"... | 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 | [
"Receiver",
"custom",
"setup_new_conf",
"method"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/receiverdaemon.py#L147-L210 | train |
Alignak-monitoring/alignak | alignak/daemons/receiverdaemon.py | Receiver.get_external_commands_from_arbiters | 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 | 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
"""
... | [
"def",
"get_external_commands_from_arbiters",
"(",
"self",
")",
":",
"for",
"arbiter_link_uuid",
"in",
"self",
".",
"arbiters",
":",
"link",
"=",
"self",
".",
"arbiters",
"[",
"arbiter_link_uuid",
"]",
"if",
"not",
"link",
".",
"active",
":",
"logger",
".",
... | 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 | [
"Get",
"external",
"commands",
"from",
"our",
"arbiters"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/receiverdaemon.py#L212-L242 | train |
Alignak-monitoring/alignak | alignak/daemons/receiverdaemon.py | Receiver.push_external_commands_to_schedulers | 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 | 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_... | [
"def",
"push_external_commands_to_schedulers",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"unprocessed_external_commands",
":",
"return",
"commands_to_process",
"=",
"self",
".",
"unprocessed_external_commands",
"self",
".",
"unprocessed_external_commands",
"=",
"["... | Push received external commands to the schedulers
:return: None | [
"Push",
"received",
"external",
"commands",
"to",
"the",
"schedulers"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/receiverdaemon.py#L244-L305 | train |
Alignak-monitoring/alignak | alignak/daemons/receiverdaemon.py | Receiver.do_loop_turn | 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 | 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 ... | [
"def",
"do_loop_turn",
"(",
"self",
")",
":",
"self",
".",
"check_and_del_zombie_modules",
"(",
")",
"if",
"self",
".",
"watch_for_new_conf",
"(",
"timeout",
"=",
"0.05",
")",
":",
"logger",
".",
"info",
"(",
"\"I got a new configuration...\"",
")",
"self",
".... | Receiver daemon main loop
:return: None | [
"Receiver",
"daemon",
"main",
"loop"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/receiverdaemon.py#L307-L341 | train |
Alignak-monitoring/alignak | alignak/check.py | Check.serialize | 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 | 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... | [
"def",
"serialize",
"(",
"self",
")",
":",
"res",
"=",
"super",
"(",
"Check",
",",
"self",
")",
".",
"serialize",
"(",
")",
"if",
"'depend_on'",
"in",
"res",
":",
"del",
"res",
"[",
"'depend_on'",
"]",
"if",
"'depend_on_me'",
"in",
"res",
":",
"del",... | 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 | [
"This",
"function",
"serializes",
"into",
"a",
"simple",
"dict",
"object",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/check.py#L136-L150 | train |
Alignak-monitoring/alignak | alignak/alignakobject.py | AlignakObject.serialize | 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 | 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... | [
"def",
"serialize",
"(",
"self",
")",
":",
"res",
"=",
"{",
"'uuid'",
":",
"self",
".",
"uuid",
"}",
"for",
"prop",
"in",
"self",
".",
"__class__",
".",
"properties",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"prop",
")",
":",
"continue",
"res... | This function serializes into a simple dictionary object.
It is used when transferring data to other daemons over the network (http)
Here is the generic function that simply export attributes declared in the
properties dictionary of the object.
Note that a SetProp property will be ser... | [
"This",
"function",
"serializes",
"into",
"a",
"simple",
"dictionary",
"object",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/alignakobject.py#L92-L117 | train |
Alignak-monitoring/alignak | alignak/alignakobject.py | AlignakObject.fill_default | 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 | 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... | [
"def",
"fill_default",
"(",
"self",
")",
":",
"for",
"prop",
",",
"entry",
"in",
"self",
".",
"__class__",
".",
"properties",
".",
"items",
"(",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"prop",
")",
":",
"continue",
"if",
"not",
"hasattr",
"(",
... | Define the object properties with a default value when the property is not yet defined
:return: None | [
"Define",
"the",
"object",
"properties",
"with",
"a",
"default",
"value",
"when",
"the",
"property",
"is",
"not",
"yet",
"defined"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/alignakobject.py#L119-L134 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.fill_predictive_missing_parameters | 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 | 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... | [
"def",
"fill_predictive_missing_parameters",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'host_name'",
")",
"and",
"not",
"hasattr",
"(",
"self",
",",
"'address'",
")",
":",
"self",
".",
"address",
"=",
"self",
".",
"host_name",
"if",
"hasat... | Fill address with host_name if not already set
and define state with initial_state
:return: None | [
"Fill",
"address",
"with",
"host_name",
"if",
"not",
"already",
"set",
"and",
"define",
"state",
"with",
"initial_state"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L304-L317 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.get_groupnames | 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 | 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]
... | [
"def",
"get_groupnames",
"(",
"self",
",",
"hostgroups",
")",
":",
"group_names",
"=",
"[",
"]",
"for",
"hostgroup_id",
"in",
"self",
".",
"hostgroups",
":",
"hostgroup",
"=",
"hostgroups",
"[",
"hostgroup_id",
"]",
"group_names",
".",
"append",
"(",
"hostgr... | Get names of the host's hostgroups
:return: comma separated names of hostgroups alphabetically sorted
:rtype: str | [
"Get",
"names",
"of",
"the",
"host",
"s",
"hostgroups"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L408-L418 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.get_groupaliases | 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 | 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]
... | [
"def",
"get_groupaliases",
"(",
"self",
",",
"hostgroups",
")",
":",
"group_aliases",
"=",
"[",
"]",
"for",
"hostgroup_id",
"in",
"self",
".",
"hostgroups",
":",
"hostgroup",
"=",
"hostgroups",
"[",
"hostgroup_id",
"]",
"group_aliases",
".",
"append",
"(",
"... | Get aliases of the host's hostgroups
:return: comma separated aliases of hostgroups alphabetically sorted
:rtype: str | [
"Get",
"aliases",
"of",
"the",
"host",
"s",
"hostgroups"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L420-L430 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.set_state_from_exit_status | 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 | 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()
... | [
"def",
"set_state_from_exit_status",
"(",
"self",
",",
"status",
",",
"notif_period",
",",
"hosts",
",",
"services",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"cls",
"=",
"self",
".",
"__class__",
"if",
"(",
"cls",
".",
"enable_problem_impacts_s... | 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 | [
"Set",
"the",
"state",
"in",
"UP",
"DOWN",
"or",
"UNREACHABLE",
"according",
"to",
"the",
"status",
"of",
"a",
"check",
"result",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L492-L548 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.is_state | 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 | 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 ... | [
"def",
"is_state",
"(",
"self",
",",
"status",
")",
":",
"if",
"status",
"==",
"self",
".",
"state",
":",
"return",
"True",
"if",
"status",
"==",
"'o'",
"and",
"self",
".",
"state",
"==",
"u'UP'",
":",
"return",
"True",
"if",
"status",
"==",
"'d'",
... | 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 | [
"Return",
"if",
"status",
"match",
"the",
"current",
"host",
"status"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L550-L567 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.last_time_non_ok_or_up | 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 | 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... | [
"def",
"last_time_non_ok_or_up",
"(",
"self",
")",
":",
"non_ok_times",
"=",
"[",
"x",
"for",
"x",
"in",
"[",
"self",
".",
"last_time_down",
"]",
"if",
"x",
">",
"self",
".",
"last_time_up",
"]",
"if",
"not",
"non_ok_times",
":",
"last_time_non_ok",
"=",
... | 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 | [
"Get",
"the",
"last",
"time",
"the",
"host",
"was",
"in",
"a",
"non",
"-",
"OK",
"state"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L569-L581 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.notification_is_blocked_by_contact | 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 | 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... | [
"def",
"notification_is_blocked_by_contact",
"(",
"self",
",",
"notifways",
",",
"timeperiods",
",",
"notif",
",",
"contact",
")",
":",
"return",
"not",
"contact",
".",
"want_host_notification",
"(",
"notifways",
",",
"timeperiods",
",",
"self",
".",
"last_chk",
... | 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
:type notif: alignak.objects.contact.Contact
:return: True if the notification is blocked, Fa... | [
"Check",
"if",
"the",
"notification",
"is",
"blocked",
"by",
"this",
"contact",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L914-L926 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host._tot_services_by_state | 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 | 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
... | [
"def",
"_tot_services_by_state",
"(",
"self",
",",
"services",
",",
"state",
")",
":",
"return",
"str",
"(",
"sum",
"(",
"1",
"for",
"s",
"in",
"self",
".",
"services",
"if",
"services",
"[",
"s",
"]",
".",
"state_id",
"==",
"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 | [
"Get",
"the",
"number",
"of",
"service",
"in",
"the",
"specified",
"state"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L1095-L1104 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Host.get_overall_state | 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 | 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)... | [
"def",
"get_overall_state",
"(",
"self",
",",
"services",
")",
":",
"overall_state",
"=",
"0",
"if",
"not",
"self",
".",
"monitored",
":",
"overall_state",
"=",
"5",
"elif",
"self",
".",
"acknowledged",
":",
"overall_state",
"=",
"1",
"elif",
"self",
".",
... | 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):
- an host not monitored (5)
- an... | [
"Get",
"the",
"host",
"overall",
"state",
"including",
"the",
"host",
"self",
"status",
"and",
"the",
"status",
"of",
"its",
"services"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L1236-L1298 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Hosts.linkify_h_by_h | 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 | 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... | [
"def",
"linkify_h_by_h",
"(",
"self",
")",
":",
"for",
"host",
"in",
"self",
":",
"new_parents",
"=",
"[",
"]",
"for",
"parent",
"in",
"getattr",
"(",
"host",
",",
"'parents'",
",",
"[",
"]",
")",
":",
"parent",
"=",
"parent",
".",
"strip",
"(",
")... | Link hosts with their parents
:return: None | [
"Link",
"hosts",
"with",
"their",
"parents"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L1372-L1390 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Hosts.linkify_h_by_hg | 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 | 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... | [
"def",
"linkify_h_by_hg",
"(",
"self",
",",
"hostgroups",
")",
":",
"for",
"host",
"in",
"self",
":",
"new_hostgroups",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"host",
",",
"'hostgroups'",
")",
"and",
"host",
".",
"hostgroups",
"!=",
"[",
"]",
":",
"hgs",... | Link hosts with hostgroups
:param hostgroups: hostgroups object to link with
:type hostgroups: alignak.objects.hostgroup.Hostgroups
:return: None | [
"Link",
"hosts",
"with",
"hostgroups"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L1415-L1436 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Hosts.apply_dependencies | 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 | 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:
... | [
"def",
"apply_dependencies",
"(",
"self",
")",
":",
"for",
"host",
"in",
"self",
":",
"for",
"parent_id",
"in",
"getattr",
"(",
"host",
",",
"'parents'",
",",
"[",
"]",
")",
":",
"if",
"parent_id",
"is",
"None",
":",
"continue",
"parent",
"=",
"self",
... | Loop on hosts and register dependency between parent and son
call Host.fill_parents_dependency()
:return: None | [
"Loop",
"on",
"hosts",
"and",
"register",
"dependency",
"between",
"parent",
"and",
"son"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L1466-L1487 | train |
Alignak-monitoring/alignak | alignak/objects/host.py | Hosts.find_hosts_that_use_template | 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 | 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[... | [
"def",
"find_hosts_that_use_template",
"(",
"self",
",",
"tpl_name",
")",
":",
"return",
"[",
"h",
".",
"host_name",
"for",
"h",
"in",
"self",
"if",
"tpl_name",
"in",
"h",
".",
"tags",
"if",
"hasattr",
"(",
"h",
",",
"\"host_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[str] | [
"Find",
"hosts",
"that",
"use",
"the",
"template",
"defined",
"in",
"argument",
"tpl_name"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/host.py#L1489-L1497 | train |
Alignak-monitoring/alignak | alignak/objects/arbiterlink.py | ArbiterLink.is_me | 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 | 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... | [
"def",
"is_me",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"And arbiter is launched with the hostname:%s \"",
"\"from an arbiter point of view of addr:%s\"",
",",
"self",
".",
"host_name",
",",
"socket",
".",
"getfqdn",
"(",
")",
")",
"return",
"self",
"."... | 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 | [
"Check",
"if",
"parameter",
"name",
"if",
"same",
"than",
"name",
"of",
"this",
"object"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/arbiterlink.py#L79-L89 | train |
Alignak-monitoring/alignak | alignak/objects/arbiterlink.py | ArbiterLink.do_not_run | 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 | 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... | [
"def",
"do_not_run",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"[%s] do_not_run\"",
",",
"self",
".",
"name",
")",
"try",
":",
"self",
".",
"con",
".",
"get",
"(",
"'_do_not_run'",
")",
"return",
"True",
"except",
"HTTPClientConnectionException",... | Check if satellite running or not
If not, try to run
:return: true if satellite not running
:rtype: bool | [
"Check",
"if",
"satellite",
"running",
"or",
"not",
"If",
"not",
"try",
"to",
"run"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/arbiterlink.py#L91-L114 | train |
Alignak-monitoring/alignak | alignak/daemons/schedulerdaemon.py | Alignak.get_broks | 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 | 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... | [
"def",
"get_broks",
"(",
"self",
",",
"broker_name",
")",
":",
"logger",
".",
"debug",
"(",
"\"Broker %s requests my broks list\"",
",",
"broker_name",
")",
"res",
"=",
"[",
"]",
"if",
"not",
"broker_name",
":",
"return",
"res",
"for",
"broker_link",
"in",
"... | 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] | [
"Send",
"broks",
"to",
"a",
"specific",
"broker"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/schedulerdaemon.py#L127-L153 | train |
Alignak-monitoring/alignak | alignak/daemons/schedulerdaemon.py | Alignak.do_loop_turn | 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 | 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... | [
"def",
"do_loop_turn",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"first_scheduling",
":",
"logger",
".",
"info",
"(",
"\"First scheduling launched\"",
")",
"_t0",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"sched",
".",
"initial_program_status",... | 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 | [
"Scheduler",
"loop",
"turn"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/schedulerdaemon.py#L238-L282 | train |
Alignak-monitoring/alignak | alignak/daemons/schedulerdaemon.py | Alignak.get_managed_configurations | 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 | 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... | [
"def",
"get_managed_configurations",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"if",
"self",
".",
"sched",
".",
"pushed_conf",
"and",
"self",
".",
"cur_conf",
"and",
"'instance_id'",
"in",
"self",
".",
"cur_conf",
":",
"res",
"[",
"self",
".",
"cur_co... | 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_flavor and configuration identifier as values
... | [
"Get",
"the",
"configurations",
"managed",
"by",
"this",
"scheduler"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/schedulerdaemon.py#L284-L309 | train |
Alignak-monitoring/alignak | alignak/daemons/schedulerdaemon.py | Alignak.clean_previous_run | 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 | 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... | [
"def",
"clean_previous_run",
"(",
"self",
")",
":",
"super",
"(",
"Alignak",
",",
"self",
")",
".",
"clean_previous_run",
"(",
")",
"self",
".",
"pollers",
".",
"clear",
"(",
")",
"self",
".",
"reactionners",
".",
"clear",
"(",
")",
"self",
".",
"broke... | Clean variables from previous configuration
:return: None | [
"Clean",
"variables",
"from",
"previous",
"configuration"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/schedulerdaemon.py#L503-L514 | train |
Alignak-monitoring/alignak | alignak/daemons/schedulerdaemon.py | Alignak.get_monitoring_problems | 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 | 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... | [
"def",
"get_monitoring_problems",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"if",
"not",
"self",
".",
"sched",
":",
"return",
"res",
"scheduler_stats",
"=",
"self",
".",
"sched",
".",
"get_scheduler_stats",
"(",
"details",
"=",
"True",
")",
"if",
"'li... | Get the current scheduler livesynthesis
:return: live synthesis and problems dictionary
:rtype: dict | [
"Get",
"the",
"current",
"scheduler",
"livesynthesis"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/schedulerdaemon.py#L553-L570 | train |
Alignak-monitoring/alignak | alignak/objects/serviceextinfo.py | ServicesExtInfo.merge_extinfo | 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 | 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... | [
"def",
"merge_extinfo",
"(",
"service",
",",
"extinfo",
")",
":",
"properties",
"=",
"[",
"'notes'",
",",
"'notes_url'",
",",
"'icon_image'",
",",
"'icon_image_alt'",
"]",
"for",
"prop",
"in",
"properties",
":",
"if",
"getattr",
"(",
"service",
",",
"prop",
... | 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.ServiceExtInfo
:return: None | [
"Merge",
"extended",
"host",
"information",
"into",
"a",
"service"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/serviceextinfo.py#L144-L157 | train |
Alignak-monitoring/alignak | alignak/commandcall.py | CommandCall.get_command_and_args | 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 | 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... | [
"def",
"get_command_and_args",
"(",
"self",
")",
":",
"r",
"p_call",
"=",
"self",
".",
"call",
".",
"replace",
"(",
"r'\\!'",
",",
"'",
"PROTECT_EXCLAMATION",
"'",
")",
"tab",
"=",
"p_call",
".",
"split",
"(",
"'!'",
")",
"return",
"tab",
"[",
"0",
"... | 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 | [
"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"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/commandcall.py#L157-L169 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.get_a_satellite_link | 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 | 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' %... | [
"def",
"get_a_satellite_link",
"(",
"sat_type",
",",
"sat_dict",
")",
":",
"cls",
"=",
"get_alignak_class",
"(",
"'alignak.objects.%slink.%sLink'",
"%",
"(",
"sat_type",
",",
"sat_type",
".",
"capitalize",
"(",
")",
")",
")",
"return",
"cls",
"(",
"params",
"=... | 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: | [
"Get",
"a",
"SatelliteLink",
"object",
"for",
"a",
"given",
"satellite",
"type",
"and",
"a",
"dictionary"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L306-L314 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.get_livestate | 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 | 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... | [
"def",
"get_livestate",
"(",
"self",
")",
":",
"livestate",
"=",
"0",
"if",
"self",
".",
"active",
":",
"if",
"not",
"self",
".",
"reachable",
":",
"livestate",
"=",
"1",
"elif",
"not",
"self",
".",
"alive",
":",
"livestate",
"=",
"2",
"else",
":",
... | 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 is dead
- 3 else (not a... | [
"Get",
"the",
"SatelliteLink",
"live",
"state",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L316-L344 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.get_and_clear_context | 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 | 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 = []
... | [
"def",
"get_and_clear_context",
"(",
"self",
")",
":",
"res",
"=",
"(",
"self",
".",
"broks",
",",
"self",
".",
"actions",
",",
"self",
".",
"wait_homerun",
",",
"self",
".",
"pushed_commands",
")",
"self",
".",
"broks",
"=",
"[",
"]",
"self",
".",
"... | Get and clean all of our broks, actions, external commands and homerun
:return: list of all broks of the satellite link
:rtype: list | [
"Get",
"and",
"clean",
"all",
"of",
"our",
"broks",
"actions",
"external",
"commands",
"and",
"homerun"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L363-L374 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.prepare_for_conf | 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 | 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(... | [
"def",
"prepare_for_conf",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"- preparing: %s\"",
",",
"self",
")",
"self",
".",
"cfg",
"=",
"{",
"'self_conf'",
":",
"self",
".",
"give_satellite_cfg",
"(",
")",
",",
"'schedulers'",
":",
"{",
"}",
","... | Initialize the pushed configuration dictionary
with the inner properties that are to be propagated to the satellite link.
:return: None | [
"Initialize",
"the",
"pushed",
"configuration",
"dictionary",
"with",
"the",
"inner",
"properties",
"that",
"are",
"to",
"be",
"propagated",
"to",
"the",
"satellite",
"link",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L386-L398 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.give_satellite_cfg | 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 | 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 ... | [
"def",
"give_satellite_cfg",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"properties",
"=",
"self",
".",
"__class__",
".",
"properties",
"for",
"prop",
",",
"entry",
"in",
"list",
"(",
"properties",
".",
"items",
"(",
")",
")",
":",
"if",
"hasattr",
... | Get the default information for a satellite.
Overridden by the specific satellites links
:return: dictionary of information common to all the links
:rtype: dict | [
"Get",
"the",
"default",
"information",
"for",
"a",
"satellite",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L400-L415 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.give_satellite_json | 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 | 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... | [
"def",
"give_satellite_json",
"(",
"self",
")",
":",
"daemon_properties",
"=",
"[",
"'type'",
",",
"'name'",
",",
"'uri'",
",",
"'spare'",
",",
"'configuration_sent'",
",",
"'realm_name'",
",",
"'manage_sub_realms'",
",",
"'active'",
",",
"'reachable'",
",",
"'a... | 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 | [
"Get",
"the",
"json",
"information",
"for",
"a",
"satellite",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L417-L437 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.manages | 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 | 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',
... | [
"def",
"manages",
"(",
"self",
",",
"cfg_part",
")",
":",
"logger",
".",
"debug",
"(",
"\"Do I (%s/%s) manage: %s, my managed configuration(s): %s\"",
",",
"self",
".",
"type",
",",
"self",
".",
"name",
",",
"cfg_part",
",",
"self",
".",
"cfg_managed",
")",
"i... | 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',
u'push_flavor': u'4d08630a3483e1eac78... | [
"Tell",
"if",
"the",
"satellite",
"is",
"managing",
"this",
"configuration",
"part"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L439-L480 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.set_alive | 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 | 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... | [
"def",
"set_alive",
"(",
"self",
")",
":",
"was_alive",
"=",
"self",
".",
"alive",
"self",
".",
"alive",
"=",
"True",
"self",
".",
"reachable",
"=",
"True",
"self",
".",
"attempt",
"=",
"0",
"if",
"not",
"was_alive",
":",
"logger",
".",
"info",
"(",
... | 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, thus, we assume it is alive!
... | [
"Set",
"alive",
"reachable",
"and",
"reset",
"attempts",
".",
"If",
"we",
"change",
"state",
"raise",
"a",
"status",
"brok",
"update"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L504-L523 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.add_failed_check_attempt | 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 | 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
"""
... | [
"def",
"add_failed_check_attempt",
"(",
"self",
",",
"reason",
"=",
"''",
")",
":",
"self",
".",
"reachable",
"=",
"False",
"self",
".",
"attempt",
"=",
"self",
".",
"attempt",
"+",
"1",
"logger",
".",
"debug",
"(",
"\"Failed attempt for %s (%d/%d), reason: %s... | 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 | [
"Set",
"the",
"daemon",
"as",
"unreachable",
"and",
"add",
"a",
"failed",
"attempt",
"if",
"we",
"reach",
"the",
"maximum",
"attempts",
"set",
"the",
"daemon",
"as",
"dead"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L543-L575 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.valid_connection | 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 | 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-... | [
"def",
"valid_connection",
"(",
"*",
"outer_args",
",",
"**",
"outer_kwargs",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"def",
"decorated",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"link",
"=",
"args",
"[",
"0",
"]",
"if",
"not",
... | Check if the daemon connection is established and valid | [
"Check",
"if",
"the",
"daemon",
"connection",
"is",
"established",
"and",
"valid"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L577-L592 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.communicate | 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 | 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... | [
"def",
"communicate",
"(",
"*",
"outer_args",
",",
"**",
"outer_kwargs",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"def",
"decorated",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"fn_name",
"=",
"func",
".",
"__name__",
"link",
"=",
"... | Check if the daemon connection is authorized and valid | [
"Check",
"if",
"the",
"daemon",
"connection",
"is",
"authorized",
"and",
"valid"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L594-L642 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.stop_request | 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 | 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)
... | [
"def",
"stop_request",
"(",
"self",
",",
"stop_now",
"=",
"False",
")",
":",
"logger",
".",
"debug",
"(",
"\"Sending stop request to %s, stop now: %s\"",
",",
"self",
".",
"name",
",",
"stop_now",
")",
"res",
"=",
"self",
".",
"con",
".",
"get",
"(",
"'sto... | 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) | [
"Send",
"a",
"stop",
"request",
"to",
"the",
"daemon"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L689-L699 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.update_infos | 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 | 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
... | [
"def",
"update_infos",
"(",
"self",
",",
"forced",
"=",
"False",
",",
"test",
"=",
"False",
")",
":",
"logger",
".",
"debug",
"(",
"\"Update informations, forced: %s\"",
",",
"forced",
")",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"not",
"forced"... | 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
has not yet been dispatched to the Arbiter satellites.... | [
"Update",
"satellite",
"info",
"each",
"self",
".",
"polling_interval",
"seconds",
"so",
"we",
"smooth",
"arbiter",
"actions",
"for",
"just",
"useful",
"actions",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L703-L740 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLink.push_actions | 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 | 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... | [
"def",
"push_actions",
"(",
"self",
",",
"actions",
",",
"scheduler_instance_id",
")",
":",
"logger",
".",
"debug",
"(",
"\"Pushing %d actions from %s\"",
",",
"len",
"(",
"actions",
")",
",",
"scheduler_instance_id",
")",
"return",
"self",
".",
"con",
".",
"p... | 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: Scheduler instance identifier
:type scheduler_instance_id: uuid
... | [
"Post",
"the",
"actions",
"to",
"execute",
"to",
"the",
"satellite",
".",
"Indeed",
"a",
"scheduler",
"post",
"its",
"checks",
"to",
"a",
"poller",
"and",
"its",
"actions",
"to",
"a",
"reactionner",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L874-L888 | train |
Alignak-monitoring/alignak | alignak/objects/satellitelink.py | SatelliteLinks.linkify | 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 | 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) | [
"def",
"linkify",
"(",
"self",
",",
"modules",
")",
":",
"logger",
".",
"debug",
"(",
"\"Linkify %s with %s\"",
",",
"self",
",",
"modules",
")",
"self",
".",
"linkify_s_by_module",
"(",
"modules",
")"
] | Link modules and Satellite links
:param modules: Module object list
:type modules: alignak.objects.module.Modules
:return: None | [
"Link",
"modules",
"and",
"Satellite",
"links"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/satellitelink.py#L1005-L1013 | train |
Alignak-monitoring/alignak | alignak/notification.py | Notification.get_return_from | 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 | 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.... | [
"def",
"get_return_from",
"(",
"self",
",",
"notif",
")",
":",
"self",
".",
"exit_status",
"=",
"notif",
".",
"exit_status",
"self",
".",
"execution_time",
"=",
"notif",
".",
"execution_time"
] | Setter of exit_status and execution_time attributes
:param notif: notification to get data from
:type notif: alignak.notification.Notification
:return: None | [
"Setter",
"of",
"exit_status",
"and",
"execution_time",
"attributes"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/notification.py#L164-L172 | train |
Alignak-monitoring/alignak | alignak/notification.py | Notification.get_initial_status_brok | 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 | 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}) | [
"def",
"get_initial_status_brok",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'uuid'",
":",
"self",
".",
"uuid",
"}",
"self",
".",
"fill_data_brok_from",
"(",
"data",
",",
"'full_status'",
")",
"return",
"Brok",
"(",
"{",
"'type'",
":",
"'notification_raise'",... | Get a initial status brok
:return: brok with wanted data
:rtype: alignak.brok.Brok | [
"Get",
"a",
"initial",
"status",
"brok"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/notification.py#L191-L199 | train |
Alignak-monitoring/alignak | alignak/daemons/brokerdaemon.py | Broker.manage_brok | 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 | 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... | [
"def",
"manage_brok",
"(",
"self",
",",
"brok",
")",
":",
"brok",
".",
"prepare",
"(",
")",
"for",
"module",
"in",
"self",
".",
"modules_manager",
".",
"get_internal_instances",
"(",
")",
":",
"try",
":",
"_t0",
"=",
"time",
".",
"time",
"(",
")",
"m... | Get a brok.
We put brok data to the modules
:param brok: object with data
:type brok: object
:return: None | [
"Get",
"a",
"brok",
".",
"We",
"put",
"brok",
"data",
"to",
"the",
"modules"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/brokerdaemon.py#L189-L209 | train |
Alignak-monitoring/alignak | alignak/daemons/brokerdaemon.py | Broker.get_internal_broks | 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 | 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... | [
"def",
"get_internal_broks",
"(",
"self",
")",
":",
"statsmgr",
".",
"gauge",
"(",
"'get-new-broks-count.broker'",
",",
"len",
"(",
"self",
".",
"internal_broks",
")",
")",
"self",
".",
"external_broks",
".",
"extend",
"(",
"self",
".",
"internal_broks",
")",
... | Get all broks from self.broks_internal_raised and append them to our broks
to manage
:return: None | [
"Get",
"all",
"broks",
"from",
"self",
".",
"broks_internal_raised",
"and",
"append",
"them",
"to",
"our",
"broks",
"to",
"manage"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/brokerdaemon.py#L211-L220 | train |
Alignak-monitoring/alignak | alignak/daemons/brokerdaemon.py | Broker.get_arbiter_broks | 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 | 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:... | [
"def",
"get_arbiter_broks",
"(",
"self",
")",
":",
"with",
"self",
".",
"arbiter_broks_lock",
":",
"statsmgr",
".",
"gauge",
"(",
"'get-new-broks-count.arbiter'",
",",
"len",
"(",
"self",
".",
"arbiter_broks",
")",
")",
"self",
".",
"external_broks",
".",
"ext... | 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 | [
"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"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/brokerdaemon.py#L222-L235 | train |
Alignak-monitoring/alignak | alignak/daemons/brokerdaemon.py | Broker.get_new_broks | 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 | 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... | [
"def",
"get_new_broks",
"(",
"self",
")",
":",
"for",
"satellites",
"in",
"[",
"self",
".",
"schedulers",
",",
"self",
".",
"pollers",
",",
"self",
".",
"reactionners",
",",
"self",
".",
"receivers",
"]",
":",
"for",
"satellite_link",
"in",
"list",
"(",
... | Get new broks from our satellites
:return: None | [
"Get",
"new",
"broks",
"from",
"our",
"satellites"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/brokerdaemon.py#L237-L264 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realm.add_group_members | 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 | 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):
... | [
"def",
"add_group_members",
"(",
"self",
",",
"members",
")",
":",
"if",
"not",
"isinstance",
"(",
"members",
",",
"list",
")",
":",
"members",
"=",
"[",
"members",
"]",
"if",
"not",
"getattr",
"(",
"self",
",",
"'group_members'",
",",
"None",
")",
":"... | Add a new group member to the groups list
:param members: member name
:type members: str
:return: None | [
"Add",
"a",
"new",
"group",
"member",
"to",
"the",
"groups",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L221-L234 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realm.get_realms_by_explosion | 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 | 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... | [
"def",
"get_realms_by_explosion",
"(",
"self",
",",
"realms",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'rec_tag'",
",",
"False",
")",
":",
"self",
".",
"add_error",
"(",
"\"Error: there is a loop in the realm definition %s\"",
"%",
"self",
".",
"get_name",
... | 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 attribute
:rtype: list | [
"Get",
"all",
"members",
"of",
"this",
"realm",
"including",
"members",
"of",
"sub",
"-",
"realms",
"on",
"multi",
"-",
"levels"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L274-L306 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realm.set_level | 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 | 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())
... | [
"def",
"set_level",
"(",
"self",
",",
"level",
",",
"realms",
")",
":",
"self",
".",
"level",
"=",
"level",
"if",
"not",
"self",
".",
"level",
":",
"logger",
".",
"info",
"(",
"\"- %s\"",
",",
"self",
".",
"get_name",
"(",
")",
")",
"else",
":",
... | Set the realm level in the realms hierarchy
:return: None | [
"Set",
"the",
"realm",
"level",
"in",
"the",
"realms",
"hierarchy"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L308-L335 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realm.get_all_subs_satellites_by_type | 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 | 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... | [
"def",
"get_all_subs_satellites_by_type",
"(",
"self",
",",
"sat_type",
",",
"realms",
")",
":",
"res",
"=",
"copy",
".",
"copy",
"(",
"getattr",
"(",
"self",
",",
"sat_type",
")",
")",
"for",
"member",
"in",
"self",
".",
"all_sub_members",
":",
"res",
"... | 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
:return: list of satellite in this realm
:rtype: list | [
"Get",
"all",
"satellites",
"of",
"the",
"wanted",
"type",
"in",
"this",
"realm",
"recursively"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L337-L350 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realm.get_links_for_a_broker | 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 | 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... | [
"def",
"get_links_for_a_broker",
"(",
"self",
",",
"pollers",
",",
"reactionners",
",",
"receivers",
",",
"realms",
",",
"manage_sub_realms",
"=",
"False",
")",
":",
"cfg",
"=",
"{",
"'pollers'",
":",
"{",
"}",
",",
"'reactionners'",
":",
"{",
"}",
",",
... | Get a configuration dictionary with pollers, reactionners and receivers links
for a broker
:param pollers: pollers
:type pollers:
:param reactionners: reactionners
:type reactionners:
:param receivers: receivers
:type receivers:
:param realms: realms
... | [
"Get",
"a",
"configuration",
"dictionary",
"with",
"pollers",
"reactionners",
"and",
"receivers",
"links",
"for",
"a",
"broker"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L415-L472 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realm.get_links_for_a_scheduler | 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 | 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
"""
# ... | [
"def",
"get_links_for_a_scheduler",
"(",
"self",
",",
"pollers",
",",
"reactionners",
",",
"brokers",
")",
":",
"cfg",
"=",
"{",
"'pollers'",
":",
"{",
"}",
",",
"'reactionners'",
":",
"{",
"}",
",",
"'brokers'",
":",
"{",
"}",
",",
"}",
"try",
":",
... | 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 | [
"Get",
"a",
"configuration",
"dictionary",
"with",
"pollers",
"reactionners",
"and",
"brokers",
"links",
"for",
"a",
"scheduler"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L474-L519 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realms.explode | 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 | 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... | [
"def",
"explode",
"(",
"self",
")",
":",
"for",
"realm",
"in",
"[",
"tmp_realm",
"for",
"tmp_realm",
"in",
"self",
"if",
"tmp_realm",
".",
"higher_realms",
"]",
":",
"for",
"parent",
"in",
"realm",
".",
"higher_realms",
":",
"higher_realm",
"=",
"self",
... | Explode realms with each realm_members and higher_realms to get all the
realms sub realms.
:return: None | [
"Explode",
"realms",
"with",
"each",
"realm_members",
"and",
"higher_realms",
"to",
"get",
"all",
"the",
"realms",
"sub",
"realms",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L565-L587 | train |
Alignak-monitoring/alignak | alignak/objects/realm.py | Realms.get_default | 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 | 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=... | [
"def",
"get_default",
"(",
"self",
",",
"check",
"=",
"False",
")",
":",
"found",
"=",
"[",
"]",
"for",
"realm",
"in",
"sorted",
"(",
"self",
",",
"key",
"=",
"lambda",
"r",
":",
"r",
".",
"level",
")",
":",
"if",
"getattr",
"(",
"realm",
",",
... | 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 | [
"Get",
"the",
"default",
"realm"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/realm.py#L589-L637 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.