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/http/arbiter_interface.py | ArbiterInterface.reload_configuration | def reload_configuration(self):
"""Ask to the arbiter to reload the monitored configuration
**Note** tha the arbiter will not reload its main configuration file (eg. alignak.ini)
but it will reload the monitored objects from the Nagios legacy files or from the
Alignak backend!
... | python | def reload_configuration(self):
"""Ask to the arbiter to reload the monitored configuration
**Note** tha the arbiter will not reload its main configuration file (eg. alignak.ini)
but it will reload the monitored objects from the Nagios legacy files or from the
Alignak backend!
... | [
"def",
"reload_configuration",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"app",
".",
"is_master",
":",
"message",
"=",
"u\"I received a request to reload the monitored configuration. \"",
"u\"I am not the Master arbiter, I ignore and continue to run.\"",
"logger",
".",
... | Ask to the arbiter to reload the monitored configuration
**Note** tha the arbiter will not reload its main configuration file (eg. alignak.ini)
but it will reload the monitored objects from the Nagios legacy files or from the
Alignak backend!
In case of any error, this function returns... | [
"Ask",
"to",
"the",
"arbiter",
"to",
"reload",
"the",
"monitored",
"configuration"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L52-L79 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.command | def command(self, command=None,
timestamp=None, element=None, host=None, service=None, user=None, parameters=None):
# pylint: disable=too-many-branches
""" Request to execute an external command
Allowed parameters are:
`command`: mandatory parameter containing the whole ... | python | def command(self, command=None,
timestamp=None, element=None, host=None, service=None, user=None, parameters=None):
# pylint: disable=too-many-branches
""" Request to execute an external command
Allowed parameters are:
`command`: mandatory parameter containing the whole ... | [
"def",
"command",
"(",
"self",
",",
"command",
"=",
"None",
",",
"timestamp",
"=",
"None",
",",
"element",
"=",
"None",
",",
"host",
"=",
"None",
",",
"service",
"=",
"None",
",",
"user",
"=",
"None",
",",
"parameters",
"=",
"None",
")",
":",
"if",... | Request to execute an external command
Allowed parameters are:
`command`: mandatory parameter containing the whole command line or only the command name
`timestamp`: optional parameter containing the timestamp. If not present, the
current timestamp is added in the command line
... | [
"Request",
"to",
"execute",
"an",
"external",
"command"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L138-L224 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.monitoring_problems | def monitoring_problems(self):
"""Get Alignak detailed monitoring status
This will return an object containing the properties of the `identity`, plus a `problems`
object which contains 2 properties for each known scheduler:
- _freshness, which is the timestamp when the provided data wer... | python | def monitoring_problems(self):
"""Get Alignak detailed monitoring status
This will return an object containing the properties of the `identity`, plus a `problems`
object which contains 2 properties for each known scheduler:
- _freshness, which is the timestamp when the provided data wer... | [
"def",
"monitoring_problems",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"identity",
"(",
")",
"res",
"[",
"'problems'",
"]",
"=",
"{",
"}",
"for",
"scheduler_link",
"in",
"self",
".",
"app",
".",
"conf",
".",
"schedulers",
":",
"sched_res",
"=",
... | Get Alignak detailed monitoring status
This will return an object containing the properties of the `identity`, plus a `problems`
object which contains 2 properties for each known scheduler:
- _freshness, which is the timestamp when the provided data were fetched
- problems, which is an ... | [
"Get",
"Alignak",
"detailed",
"monitoring",
"status"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L234-L295 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.livesynthesis | def livesynthesis(self):
"""Get Alignak live synthesis
This will return an object containing the properties of the `identity`, plus a
`livesynthesis`
object which contains 2 properties for each known scheduler:
- _freshness, which is the timestamp when the provided data were fet... | python | def livesynthesis(self):
"""Get Alignak live synthesis
This will return an object containing the properties of the `identity`, plus a
`livesynthesis`
object which contains 2 properties for each known scheduler:
- _freshness, which is the timestamp when the provided data were fet... | [
"def",
"livesynthesis",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"identity",
"(",
")",
"res",
".",
"update",
"(",
"self",
".",
"app",
".",
"get_livesynthesis",
"(",
")",
")",
"return",
"res"
] | Get Alignak live synthesis
This will return an object containing the properties of the `identity`, plus a
`livesynthesis`
object which contains 2 properties for each known scheduler:
- _freshness, which is the timestamp when the provided data were fetched
- livesynthesis, which ... | [
"Get",
"Alignak",
"live",
"synthesis"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L299-L392 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.object | def object(self, o_type, o_name=None):
"""Get a monitored object from the arbiter.
Indeed, the arbiter requires the object from its schedulers. It will iterate in
its schedulers list until a matching object is found. Else it will return a Json
structure containing _status and _message p... | python | def object(self, o_type, o_name=None):
"""Get a monitored object from the arbiter.
Indeed, the arbiter requires the object from its schedulers. It will iterate in
its schedulers list until a matching object is found. Else it will return a Json
structure containing _status and _message p... | [
"def",
"object",
"(",
"self",
",",
"o_type",
",",
"o_name",
"=",
"None",
")",
":",
"for",
"scheduler_link",
"in",
"self",
".",
"app",
".",
"conf",
".",
"schedulers",
":",
"sched_res",
"=",
"scheduler_link",
".",
"con",
".",
"get",
"(",
"'object'",
",",... | Get a monitored object from the arbiter.
Indeed, the arbiter requires the object from its schedulers. It will iterate in
its schedulers list until a matching object is found. Else it will return a Json
structure containing _status and _message properties.
When found, the result is a se... | [
"Get",
"a",
"monitored",
"object",
"from",
"the",
"arbiter",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L397-L468 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.status | def status(self, details=False):
"""Get the overall alignak status
Returns a list of the satellites as in:
{
services: [
{
livestate: {
perf_data: "",
timestamp: 1532106561,
s... | python | def status(self, details=False):
"""Get the overall alignak status
Returns a list of the satellites as in:
{
services: [
{
livestate: {
perf_data: "",
timestamp: 1532106561,
s... | [
"def",
"status",
"(",
"self",
",",
"details",
"=",
"False",
")",
":",
"if",
"details",
"is",
"not",
"False",
":",
"details",
"=",
"bool",
"(",
"details",
")",
"return",
"self",
".",
"app",
".",
"get_alignak_status",
"(",
"details",
"=",
"details",
")"
... | Get the overall alignak status
Returns a list of the satellites as in:
{
services: [
{
livestate: {
perf_data: "",
timestamp: 1532106561,
state: "ok",
long_out... | [
"Get",
"the",
"overall",
"alignak",
"status"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L586-L660 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.events_log | def events_log(self, details=False, count=0, timestamp=0):
"""Get the most recent Alignak events
If count is specifies it is the maximum number of events to return.
If timestamp is specified, events older than this timestamp will not be returned
The arbiter maintains a list of the mos... | python | def events_log(self, details=False, count=0, timestamp=0):
"""Get the most recent Alignak events
If count is specifies it is the maximum number of events to return.
If timestamp is specified, events older than this timestamp will not be returned
The arbiter maintains a list of the mos... | [
"def",
"events_log",
"(",
"self",
",",
"details",
"=",
"False",
",",
"count",
"=",
"0",
",",
"timestamp",
"=",
"0",
")",
":",
"if",
"not",
"count",
":",
"count",
"=",
"1",
"+",
"int",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'ALIGNAK_EVENTS_LOG... | Get the most recent Alignak events
If count is specifies it is the maximum number of events to return.
If timestamp is specified, events older than this timestamp will not be returned
The arbiter maintains a list of the most recent Alignak events. This endpoint
provides this list.
... | [
"Get",
"the",
"most",
"recent",
"Alignak",
"events"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L664-L760 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.satellites_list | def satellites_list(self, daemon_type=''):
"""Get the arbiter satellite names sorted by type
Returns a list of the satellites as in:
{
reactionner: [
"reactionner-master"
],
broker: [
"broker-master"
],
... | python | def satellites_list(self, daemon_type=''):
"""Get the arbiter satellite names sorted by type
Returns a list of the satellites as in:
{
reactionner: [
"reactionner-master"
],
broker: [
"broker-master"
],
... | [
"def",
"satellites_list",
"(",
"self",
",",
"daemon_type",
"=",
"''",
")",
":",
"with",
"self",
".",
"app",
".",
"conf_lock",
":",
"res",
"=",
"{",
"}",
"for",
"s_type",
"in",
"[",
"'arbiter'",
",",
"'scheduler'",
",",
"'poller'",
",",
"'reactionner'",
... | Get the arbiter satellite names sorted by type
Returns a list of the satellites as in:
{
reactionner: [
"reactionner-master"
],
broker: [
"broker-master"
],
arbiter: [
"arbiter-master"
... | [
"Get",
"the",
"arbiter",
"satellite",
"names",
"sorted",
"by",
"type"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L764-L816 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.satellites_configuration | def satellites_configuration(self):
"""Return all the configuration data of satellites
:return: dict containing satellites data
Output looks like this ::
{'arbiter' : [{'property1':'value1' ..}, {'property2', 'value11' ..}, ..],
'scheduler': [..],
'poller': [..],
... | python | def satellites_configuration(self):
"""Return all the configuration data of satellites
:return: dict containing satellites data
Output looks like this ::
{'arbiter' : [{'property1':'value1' ..}, {'property2', 'value11' ..}, ..],
'scheduler': [..],
'poller': [..],
... | [
"def",
"satellites_configuration",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"for",
"s_type",
"in",
"[",
"'arbiter'",
",",
"'scheduler'",
",",
"'poller'",
",",
"'reactionner'",
",",
"'receiver'",
",",
"'broker'",
"]",
":",
"lst",
"=",
"[",
"]",
"res",... | Return all the configuration data of satellites
:return: dict containing satellites data
Output looks like this ::
{'arbiter' : [{'property1':'value1' ..}, {'property2', 'value11' ..}, ..],
'scheduler': [..],
'poller': [..],
'reactionner': [..],
'receiver': [..]... | [
"Return",
"all",
"the",
"configuration",
"data",
"of",
"satellites"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1098-L1139 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.external_commands | def external_commands(self):
"""Get the external commands from the daemon
Use a lock for this function to protect
:return: serialized external command list
:rtype: str
"""
res = []
with self.app.external_commands_lock:
for cmd in self.app.get_externa... | python | def external_commands(self):
"""Get the external commands from the daemon
Use a lock for this function to protect
:return: serialized external command list
:rtype: str
"""
res = []
with self.app.external_commands_lock:
for cmd in self.app.get_externa... | [
"def",
"external_commands",
"(",
"self",
")",
":",
"res",
"=",
"[",
"]",
"with",
"self",
".",
"app",
".",
"external_commands_lock",
":",
"for",
"cmd",
"in",
"self",
".",
"app",
".",
"get_external_commands",
"(",
")",
":",
"res",
".",
"append",
"(",
"cm... | Get the external commands from the daemon
Use a lock for this function to protect
:return: serialized external command list
:rtype: str | [
"Get",
"the",
"external",
"commands",
"from",
"the",
"daemon"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1143-L1155 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface.search | def search(self): # pylint: disable=no-self-use
"""
Request available queries
Posted data: {u'target': u''}
Return the list of available target queries
:return: See upper comment
:rtype: list
"""
logger.debug("Grafana search... %s", cherrypy.request.me... | python | def search(self): # pylint: disable=no-self-use
"""
Request available queries
Posted data: {u'target': u''}
Return the list of available target queries
:return: See upper comment
:rtype: list
"""
logger.debug("Grafana search... %s", cherrypy.request.me... | [
"def",
"search",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Grafana search... %s\"",
",",
"cherrypy",
".",
"request",
".",
"method",
")",
"if",
"cherrypy",
".",
"request",
".",
"method",
"==",
"'OPTIONS'",
":",
"cherrypy",
".",
"response",
".",... | Request available queries
Posted data: {u'target': u''}
Return the list of available target queries
:return: See upper comment
:rtype: list | [
"Request",
"available",
"queries"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1169-L1192 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface._build_host_livestate | def _build_host_livestate(self, host_name, livestate):
# pylint: disable=no-self-use, too-many-locals
"""Build and notify the external command for an host livestate
PROCESS_HOST_CHECK_RESULT;<host_name>;<status_code>;<plugin_output>
:param host_name: the concerned host name
:pa... | python | def _build_host_livestate(self, host_name, livestate):
# pylint: disable=no-self-use, too-many-locals
"""Build and notify the external command for an host livestate
PROCESS_HOST_CHECK_RESULT;<host_name>;<status_code>;<plugin_output>
:param host_name: the concerned host name
:pa... | [
"def",
"_build_host_livestate",
"(",
"self",
",",
"host_name",
",",
"livestate",
")",
":",
"state",
"=",
"livestate",
".",
"get",
"(",
"'state'",
",",
"'UP'",
")",
".",
"upper",
"(",
")",
"output",
"=",
"livestate",
".",
"get",
"(",
"'output'",
",",
"'... | Build and notify the external command for an host livestate
PROCESS_HOST_CHECK_RESULT;<host_name>;<status_code>;<plugin_output>
:param host_name: the concerned host name
:param livestate: livestate dictionary
:return: external command line | [
"Build",
"and",
"notify",
"the",
"external",
"command",
"for",
"an",
"host",
"livestate"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1390-L1428 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface._build_service_livestate | def _build_service_livestate(self, host_name, service_name, livestate):
# pylint: disable=no-self-use, too-many-locals
"""Build and notify the external command for a service livestate
PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<return_code>;<plugin_output>
Create an... | python | def _build_service_livestate(self, host_name, service_name, livestate):
# pylint: disable=no-self-use, too-many-locals
"""Build and notify the external command for a service livestate
PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<return_code>;<plugin_output>
Create an... | [
"def",
"_build_service_livestate",
"(",
"self",
",",
"host_name",
",",
"service_name",
",",
"livestate",
")",
":",
"state",
"=",
"livestate",
".",
"get",
"(",
"'state'",
",",
"'OK'",
")",
".",
"upper",
"(",
")",
"output",
"=",
"livestate",
".",
"get",
"(... | Build and notify the external command for a service livestate
PROCESS_SERVICE_CHECK_RESULT;<host_name>;<service_description>;<return_code>;<plugin_output>
Create and post a logcheckresult to the backend for the livestate
:param host_name: the concerned host name
:param service_name: t... | [
"Build",
"and",
"notify",
"the",
"external",
"command",
"for",
"a",
"service",
"livestate"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1430-L1474 | train |
Alignak-monitoring/alignak | alignak/http/arbiter_interface.py | ArbiterInterface._do_not_run | def _do_not_run(self):
"""The master arbiter tells to its spare arbiters to not run.
A master arbiter will ignore this request and it will return an object
containing some properties:
'_status': 'ERR' because of the error
`_message`: some more explanations about the error
... | python | def _do_not_run(self):
"""The master arbiter tells to its spare arbiters to not run.
A master arbiter will ignore this request and it will return an object
containing some properties:
'_status': 'ERR' because of the error
`_message`: some more explanations about the error
... | [
"def",
"_do_not_run",
"(",
"self",
")",
":",
"if",
"self",
".",
"app",
".",
"is_master",
":",
"message",
"=",
"\"Received message to not run. \"",
"\"I am the Master arbiter, ignore and continue to run.\"",
"logger",
".",
"warning",
"(",
"message",
")",
"return",
"{",... | The master arbiter tells to its spare arbiters to not run.
A master arbiter will ignore this request and it will return an object
containing some properties:
'_status': 'ERR' because of the error
`_message`: some more explanations about the error
:return: None | [
"The",
"master",
"arbiter",
"tells",
"to",
"its",
"spare",
"arbiters",
"to",
"not",
"run",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1663-L1684 | train |
Alignak-monitoring/alignak | alignak/objects/commandcallitem.py | CommandCallItems.create_commandcall | def create_commandcall(prop, commands, command):
"""
Create CommandCall object with command
:param prop: property
:type prop: str
:param commands: all commands
:type commands: alignak.objects.command.Commands
:param command: a command object
:type command... | python | def create_commandcall(prop, commands, command):
"""
Create CommandCall object with command
:param prop: property
:type prop: str
:param commands: all commands
:type commands: alignak.objects.command.Commands
:param command: a command object
:type command... | [
"def",
"create_commandcall",
"(",
"prop",
",",
"commands",
",",
"command",
")",
":",
"cc",
"=",
"{",
"'commands'",
":",
"commands",
",",
"'call'",
":",
"command",
"}",
"if",
"hasattr",
"(",
"prop",
",",
"'enable_environment_macros'",
")",
":",
"cc",
"[",
... | Create CommandCall object with command
:param prop: property
:type prop: str
:param commands: all commands
:type commands: alignak.objects.command.Commands
:param command: a command object
:type command: str
:return: a commandCall object
:rtype: alignak.o... | [
"Create",
"CommandCall",
"object",
"with",
"command"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/commandcallitem.py#L79-L105 | train |
Alignak-monitoring/alignak | alignak/http/broker_interface.py | BrokerInterface._push_broks | def _push_broks(self):
"""Push the provided broks objects to the broker daemon
Only used on a Broker daemon by the Arbiter
:param: broks
:type: list
:return: None
"""
data = cherrypy.request.json
with self.app.arbiter_broks_lock:
logger.debug... | python | def _push_broks(self):
"""Push the provided broks objects to the broker daemon
Only used on a Broker daemon by the Arbiter
:param: broks
:type: list
:return: None
"""
data = cherrypy.request.json
with self.app.arbiter_broks_lock:
logger.debug... | [
"def",
"_push_broks",
"(",
"self",
")",
":",
"data",
"=",
"cherrypy",
".",
"request",
".",
"json",
"with",
"self",
".",
"app",
".",
"arbiter_broks_lock",
":",
"logger",
".",
"debug",
"(",
"\"Pushing %d broks\"",
",",
"len",
"(",
"data",
"[",
"'broks'",
"... | Push the provided broks objects to the broker daemon
Only used on a Broker daemon by the Arbiter
:param: broks
:type: list
:return: None | [
"Push",
"the",
"provided",
"broks",
"objects",
"to",
"the",
"broker",
"daemon"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/broker_interface.py#L44-L56 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.load_params | def load_params(self, params):
"""Load parameters from main configuration file
:param params: parameters list (converted right at the beginning)
:type params:
:return: None
"""
logger.debug("Alignak parameters:")
for key, value in sorted(self.clean_params(params)... | python | def load_params(self, params):
"""Load parameters from main configuration file
:param params: parameters list (converted right at the beginning)
:type params:
:return: None
"""
logger.debug("Alignak parameters:")
for key, value in sorted(self.clean_params(params)... | [
"def",
"load_params",
"(",
"self",
",",
"params",
")",
":",
"logger",
".",
"debug",
"(",
"\"Alignak parameters:\"",
")",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"self",
".",
"clean_params",
"(",
"params",
")",
".",
"items",
"(",
")",
")",
":",... | Load parameters from main configuration file
:param params: parameters list (converted right at the beginning)
:type params:
:return: None | [
"Load",
"parameters",
"from",
"main",
"configuration",
"file"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1000-L1050 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config._cut_line | def _cut_line(line):
"""Split the line on whitespaces and remove empty chunks
:param line: the line to split
:type line: str
:return: list of strings
:rtype: list
"""
# punct = '"#$%&\'()*+/<=>?@[\\]^`{|}~'
if re.search("([\t\n\r]+|[\x0b\x0c ]{3,})+", lin... | python | def _cut_line(line):
"""Split the line on whitespaces and remove empty chunks
:param line: the line to split
:type line: str
:return: list of strings
:rtype: list
"""
# punct = '"#$%&\'()*+/<=>?@[\\]^`{|}~'
if re.search("([\t\n\r]+|[\x0b\x0c ]{3,})+", lin... | [
"def",
"_cut_line",
"(",
"line",
")",
":",
"if",
"re",
".",
"search",
"(",
"\"([\\t\\n\\r]+|[\\x0b\\x0c ]{3,})+\"",
",",
"line",
")",
":",
"tmp",
"=",
"re",
".",
"split",
"(",
"\"([\\t\\n\\r]+|[\\x0b\\x0c ]{3,})+\"",
",",
"line",
",",
"1",
")",
"else",
":",
... | Split the line on whitespaces and remove empty chunks
:param line: the line to split
:type line: str
:return: list of strings
:rtype: list | [
"Split",
"the",
"line",
"on",
"whitespaces",
"and",
"remove",
"empty",
"chunks"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1053-L1067 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.add_self_defined_objects | def add_self_defined_objects(raw_objects):
"""Add self defined command objects for internal processing ;
bp_rule, _internal_host_up, _echo, _internal_host_check, _interna_service_check
:param raw_objects: Raw config objects dict
:type raw_objects: dict
:return: raw_objects with ... | python | def add_self_defined_objects(raw_objects):
"""Add self defined command objects for internal processing ;
bp_rule, _internal_host_up, _echo, _internal_host_check, _interna_service_check
:param raw_objects: Raw config objects dict
:type raw_objects: dict
:return: raw_objects with ... | [
"def",
"add_self_defined_objects",
"(",
"raw_objects",
")",
":",
"logger",
".",
"info",
"(",
"\"- creating internally defined commands...\"",
")",
"if",
"'command'",
"not",
"in",
"raw_objects",
":",
"raw_objects",
"[",
"'command'",
"]",
"=",
"[",
"]",
"raw_objects",... | Add self defined command objects for internal processing ;
bp_rule, _internal_host_up, _echo, _internal_host_check, _interna_service_check
:param raw_objects: Raw config objects dict
:type raw_objects: dict
:return: raw_objects with some more commands
:rtype: dict | [
"Add",
"self",
"defined",
"command",
"objects",
"for",
"internal",
"processing",
";",
"bp_rule",
"_internal_host_up",
"_echo",
"_internal_host_check",
"_interna_service_check"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1374-L1415 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.early_create_objects | def early_create_objects(self, raw_objects):
"""Create the objects needed for the post configuration file initialization
:param raw_objects: dict with all object with str values
:type raw_objects: dict
:return: None
"""
types_creations = self.__class__.types_creations
... | python | def early_create_objects(self, raw_objects):
"""Create the objects needed for the post configuration file initialization
:param raw_objects: dict with all object with str values
:type raw_objects: dict
:return: None
"""
types_creations = self.__class__.types_creations
... | [
"def",
"early_create_objects",
"(",
"self",
",",
"raw_objects",
")",
":",
"types_creations",
"=",
"self",
".",
"__class__",
".",
"types_creations",
"early_created_types",
"=",
"self",
".",
"__class__",
".",
"early_created_types",
"logger",
".",
"info",
"(",
"\"Cre... | Create the objects needed for the post configuration file initialization
:param raw_objects: dict with all object with str values
:type raw_objects: dict
:return: None | [
"Create",
"the",
"objects",
"needed",
"for",
"the",
"post",
"configuration",
"file",
"initialization"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1417-L1431 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.create_objects | def create_objects(self, raw_objects):
"""Create all the objects got after the post configuration file initialization
:param raw_objects: dict with all object with str values
:type raw_objects: dict
:return: None
"""
types_creations = self.__class__.types_creations
... | python | def create_objects(self, raw_objects):
"""Create all the objects got after the post configuration file initialization
:param raw_objects: dict with all object with str values
:type raw_objects: dict
:return: None
"""
types_creations = self.__class__.types_creations
... | [
"def",
"create_objects",
"(",
"self",
",",
"raw_objects",
")",
":",
"types_creations",
"=",
"self",
".",
"__class__",
".",
"types_creations",
"early_created_types",
"=",
"self",
".",
"__class__",
".",
"early_created_types",
"logger",
".",
"info",
"(",
"\"Creating ... | Create all the objects got after the post configuration file initialization
:param raw_objects: dict with all object with str values
:type raw_objects: dict
:return: None | [
"Create",
"all",
"the",
"objects",
"got",
"after",
"the",
"post",
"configuration",
"file",
"initialization"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1433-L1452 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.create_objects_for_type | def create_objects_for_type(self, raw_objects, o_type):
"""Generic function to create objects regarding the o_type
This function create real Alignak objects from the raw data got from the configuration.
:param raw_objects: Raw objects
:type raw_objects: dict
:param o_type: the ... | python | def create_objects_for_type(self, raw_objects, o_type):
"""Generic function to create objects regarding the o_type
This function create real Alignak objects from the raw data got from the configuration.
:param raw_objects: Raw objects
:type raw_objects: dict
:param o_type: the ... | [
"def",
"create_objects_for_type",
"(",
"self",
",",
"raw_objects",
",",
"o_type",
")",
":",
"types_creations",
"=",
"self",
".",
"__class__",
".",
"types_creations",
"(",
"cls",
",",
"clss",
",",
"prop",
",",
"initial_index",
",",
"_",
")",
"=",
"types_creat... | Generic function to create objects regarding the o_type
This function create real Alignak objects from the raw data got from the configuration.
:param raw_objects: Raw objects
:type raw_objects: dict
:param o_type: the object type we want to create
:type o_type: object
... | [
"Generic",
"function",
"to",
"create",
"objects",
"regarding",
"the",
"o_type"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1454-L1491 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.early_arbiter_linking | def early_arbiter_linking(self, arbiter_name, params):
""" Prepare the arbiter for early operations
:param arbiter_name: default arbiter name if no arbiter exist in the configuration
:type arbiter_name: str
:return: None
"""
if not self.arbiters:
params.upda... | python | def early_arbiter_linking(self, arbiter_name, params):
""" Prepare the arbiter for early operations
:param arbiter_name: default arbiter name if no arbiter exist in the configuration
:type arbiter_name: str
:return: None
"""
if not self.arbiters:
params.upda... | [
"def",
"early_arbiter_linking",
"(",
"self",
",",
"arbiter_name",
",",
"params",
")",
":",
"if",
"not",
"self",
".",
"arbiters",
":",
"params",
".",
"update",
"(",
"{",
"'name'",
":",
"arbiter_name",
",",
"'arbiter_name'",
":",
"arbiter_name",
",",
"'host_na... | Prepare the arbiter for early operations
:param arbiter_name: default arbiter name if no arbiter exist in the configuration
:type arbiter_name: str
:return: None | [
"Prepare",
"the",
"arbiter",
"for",
"early",
"operations"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1493-L1518 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.linkify_one_command_with_commands | def linkify_one_command_with_commands(self, commands, prop):
"""
Link a command
:param commands: object commands
:type commands: object
:param prop: property name
:type prop: str
:return: None
"""
if not hasattr(self, prop):
return
... | python | def linkify_one_command_with_commands(self, commands, prop):
"""
Link a command
:param commands: object commands
:type commands: object
:param prop: property name
:type prop: str
:return: None
"""
if not hasattr(self, prop):
return
... | [
"def",
"linkify_one_command_with_commands",
"(",
"self",
",",
"commands",
",",
"prop",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"prop",
")",
":",
"return",
"command",
"=",
"getattr",
"(",
"self",
",",
"prop",
")",
".",
"strip",
"(",
")",
"if... | Link a command
:param commands: object commands
:type commands: object
:param prop: property name
:type prop: str
:return: None | [
"Link",
"a",
"command"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1520-L1545 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.linkify | def linkify(self):
""" Make 'links' between elements, like a host got a services list
with all its services in it
:return: None
"""
self.services.optimize_service_search(self.hosts)
# First linkify myself like for some global commands
self.linkify_one_command_w... | python | def linkify(self):
""" Make 'links' between elements, like a host got a services list
with all its services in it
:return: None
"""
self.services.optimize_service_search(self.hosts)
# First linkify myself like for some global commands
self.linkify_one_command_w... | [
"def",
"linkify",
"(",
"self",
")",
":",
"self",
".",
"services",
".",
"optimize_service_search",
"(",
"self",
".",
"hosts",
")",
"self",
".",
"linkify_one_command_with_commands",
"(",
"self",
".",
"commands",
",",
"'host_perfdata_command'",
")",
"self",
".",
... | Make 'links' between elements, like a host got a services list
with all its services in it
:return: None | [
"Make",
"links",
"between",
"elements",
"like",
"a",
"host",
"got",
"a",
"services",
"list",
"with",
"all",
"its",
"services",
"in",
"it"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1547-L1635 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.clean | def clean(self):
"""Wrapper for calling the clean method of services attribute
:return: None
"""
logger.debug("Cleaning configuration objects before configuration sending:")
types_creations = self.__class__.types_creations
for o_type in types_creations:
(_, _... | python | def clean(self):
"""Wrapper for calling the clean method of services attribute
:return: None
"""
logger.debug("Cleaning configuration objects before configuration sending:")
types_creations = self.__class__.types_creations
for o_type in types_creations:
(_, _... | [
"def",
"clean",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Cleaning configuration objects before configuration sending:\"",
")",
"types_creations",
"=",
"self",
".",
"__class__",
".",
"types_creations",
"for",
"o_type",
"in",
"types_creations",
":",
"(",
... | Wrapper for calling the clean method of services attribute
:return: None | [
"Wrapper",
"for",
"calling",
"the",
"clean",
"method",
"of",
"services",
"attribute"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1637-L1648 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.warn_about_unmanaged_parameters | def warn_about_unmanaged_parameters(self):
"""used to raise warning if the user got parameter
that we do not manage from now
:return: None
"""
properties = self.__class__.properties
unmanaged = []
for prop, entry in list(properties.items()):
if not en... | python | def warn_about_unmanaged_parameters(self):
"""used to raise warning if the user got parameter
that we do not manage from now
:return: None
"""
properties = self.__class__.properties
unmanaged = []
for prop, entry in list(properties.items()):
if not en... | [
"def",
"warn_about_unmanaged_parameters",
"(",
"self",
")",
":",
"properties",
"=",
"self",
".",
"__class__",
".",
"properties",
"unmanaged",
"=",
"[",
"]",
"for",
"prop",
",",
"entry",
"in",
"list",
"(",
"properties",
".",
"items",
"(",
")",
")",
":",
"... | used to raise warning if the user got parameter
that we do not manage from now
:return: None | [
"used",
"to",
"raise",
"warning",
"if",
"the",
"user",
"got",
"parameter",
"that",
"we",
"do",
"not",
"manage",
"from",
"now"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1650-L1674 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.apply_dependencies | def apply_dependencies(self):
"""Creates dependencies links between elements.
:return: None
"""
self.hosts.apply_dependencies()
self.services.apply_dependencies(self.hosts) | python | def apply_dependencies(self):
"""Creates dependencies links between elements.
:return: None
"""
self.hosts.apply_dependencies()
self.services.apply_dependencies(self.hosts) | [
"def",
"apply_dependencies",
"(",
"self",
")",
":",
"self",
".",
"hosts",
".",
"apply_dependencies",
"(",
")",
"self",
".",
"services",
".",
"apply_dependencies",
"(",
"self",
".",
"hosts",
")"
] | Creates dependencies links between elements.
:return: None | [
"Creates",
"dependencies",
"links",
"between",
"elements",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1715-L1721 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.fill_default_configuration | def fill_default_configuration(self):
"""Fill objects properties with default value if necessary
:return: None
"""
logger.debug("Filling the unset properties with their default value:")
types_creations = self.__class__.types_creations
for o_type in types_creations:
... | python | def fill_default_configuration(self):
"""Fill objects properties with default value if necessary
:return: None
"""
logger.debug("Filling the unset properties with their default value:")
types_creations = self.__class__.types_creations
for o_type in types_creations:
... | [
"def",
"fill_default_configuration",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Filling the unset properties with their default value:\"",
")",
"types_creations",
"=",
"self",
".",
"__class__",
".",
"types_creations",
"for",
"o_type",
"in",
"types_creations",
... | Fill objects properties with default value if necessary
:return: None | [
"Fill",
"objects",
"properties",
"with",
"default",
"value",
"if",
"necessary"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1767-L1810 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.log_daemons_list | def log_daemons_list(self):
"""Log Alignak daemons list
:return:
"""
daemons = [self.arbiters, self.schedulers, self.pollers,
self.brokers, self.reactionners, self.receivers]
for daemons_list in daemons:
if not daemons_list:
logger.... | python | def log_daemons_list(self):
"""Log Alignak daemons list
:return:
"""
daemons = [self.arbiters, self.schedulers, self.pollers,
self.brokers, self.reactionners, self.receivers]
for daemons_list in daemons:
if not daemons_list:
logger.... | [
"def",
"log_daemons_list",
"(",
"self",
")",
":",
"daemons",
"=",
"[",
"self",
".",
"arbiters",
",",
"self",
".",
"schedulers",
",",
"self",
".",
"pollers",
",",
"self",
".",
"brokers",
",",
"self",
".",
"reactionners",
",",
"self",
".",
"receivers",
"... | Log Alignak daemons list
:return: | [
"Log",
"Alignak",
"daemons",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L1830-L1842 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.got_broker_module_type_defined | def got_broker_module_type_defined(self, module_type):
"""Check if a module type is defined in one of the brokers
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
"""
for broker_link i... | python | def got_broker_module_type_defined(self, module_type):
"""Check if a module type is defined in one of the brokers
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
"""
for broker_link i... | [
"def",
"got_broker_module_type_defined",
"(",
"self",
",",
"module_type",
")",
":",
"for",
"broker_link",
"in",
"self",
".",
"brokers",
":",
"for",
"module",
"in",
"broker_link",
".",
"modules",
":",
"if",
"module",
".",
"is_a_module",
"(",
"module_type",
")",... | Check if a module type is defined in one of the brokers
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool | [
"Check",
"if",
"a",
"module",
"type",
"is",
"defined",
"in",
"one",
"of",
"the",
"brokers"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2083-L2095 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.got_scheduler_module_type_defined | def got_scheduler_module_type_defined(self, module_type):
"""Check if a module type is defined in one of the schedulers
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
TODO: Factorize it with... | python | def got_scheduler_module_type_defined(self, module_type):
"""Check if a module type is defined in one of the schedulers
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
TODO: Factorize it with... | [
"def",
"got_scheduler_module_type_defined",
"(",
"self",
",",
"module_type",
")",
":",
"for",
"scheduler_link",
"in",
"self",
".",
"schedulers",
":",
"for",
"module",
"in",
"scheduler_link",
".",
"modules",
":",
"if",
"module",
".",
"is_a_module",
"(",
"module_t... | Check if a module type is defined in one of the schedulers
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
TODO: Factorize it with got_broker_module_type_defined | [
"Check",
"if",
"a",
"module",
"type",
"is",
"defined",
"in",
"one",
"of",
"the",
"schedulers"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2097-L2110 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.got_arbiter_module_type_defined | def got_arbiter_module_type_defined(self, module_type):
"""Check if a module type is defined in one of the arbiters
Also check the module name
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
... | python | def got_arbiter_module_type_defined(self, module_type):
"""Check if a module type is defined in one of the arbiters
Also check the module name
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
... | [
"def",
"got_arbiter_module_type_defined",
"(",
"self",
",",
"module_type",
")",
":",
"for",
"arbiter",
"in",
"self",
".",
"arbiters",
":",
"for",
"module",
"in",
"getattr",
"(",
"arbiter",
",",
"'modules'",
",",
"[",
"]",
")",
":",
"module_name",
"=",
"mod... | Check if a module type is defined in one of the arbiters
Also check the module name
:param module_type: module type to search for
:type module_type: str
:return: True if mod_type is found else False
:rtype: bool
TODO: Factorize it with got_broker_module_type_defined: | [
"Check",
"if",
"a",
"module",
"type",
"is",
"defined",
"in",
"one",
"of",
"the",
"arbiters",
"Also",
"check",
"the",
"module",
"name"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2112-L2134 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.create_business_rules | def create_business_rules(self):
"""Create business rules for hosts and services
:return: None
"""
self.hosts.create_business_rules(self.hosts, self.services,
self.hostgroups, self.servicegroups,
self.macr... | python | def create_business_rules(self):
"""Create business rules for hosts and services
:return: None
"""
self.hosts.create_business_rules(self.hosts, self.services,
self.hostgroups, self.servicegroups,
self.macr... | [
"def",
"create_business_rules",
"(",
"self",
")",
":",
"self",
".",
"hosts",
".",
"create_business_rules",
"(",
"self",
".",
"hosts",
",",
"self",
".",
"services",
",",
"self",
".",
"hostgroups",
",",
"self",
".",
"servicegroups",
",",
"self",
".",
"macrom... | Create business rules for hosts and services
:return: None | [
"Create",
"business",
"rules",
"for",
"hosts",
"and",
"services"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2136-L2146 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.create_business_rules_dependencies | def create_business_rules_dependencies(self):
"""Create business rules dependencies for hosts and services
:return: None
"""
for item in itertools.chain(self.hosts, self.services):
if not item.got_business_rule:
continue
bp_items = item.business... | python | def create_business_rules_dependencies(self):
"""Create business rules dependencies for hosts and services
:return: None
"""
for item in itertools.chain(self.hosts, self.services):
if not item.got_business_rule:
continue
bp_items = item.business... | [
"def",
"create_business_rules_dependencies",
"(",
"self",
")",
":",
"for",
"item",
"in",
"itertools",
".",
"chain",
"(",
"self",
".",
"hosts",
",",
"self",
".",
"services",
")",
":",
"if",
"not",
"item",
".",
"got_business_rule",
":",
"continue",
"bp_items",... | Create business rules dependencies for hosts and services
:return: None | [
"Create",
"business",
"rules",
"dependencies",
"for",
"hosts",
"and",
"services"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2148-L2175 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.propagate_timezone_option | def propagate_timezone_option(self):
"""Set our timezone value and give it too to unset satellites
:return: None
"""
if self.use_timezone:
# first apply myself
os.environ['TZ'] = self.use_timezone
time.tzset()
tab = [self.schedulers, self... | python | def propagate_timezone_option(self):
"""Set our timezone value and give it too to unset satellites
:return: None
"""
if self.use_timezone:
# first apply myself
os.environ['TZ'] = self.use_timezone
time.tzset()
tab = [self.schedulers, self... | [
"def",
"propagate_timezone_option",
"(",
"self",
")",
":",
"if",
"self",
".",
"use_timezone",
":",
"os",
".",
"environ",
"[",
"'TZ'",
"]",
"=",
"self",
".",
"use_timezone",
"time",
".",
"tzset",
"(",
")",
"tab",
"=",
"[",
"self",
".",
"schedulers",
","... | Set our timezone value and give it too to unset satellites
:return: None | [
"Set",
"our",
"timezone",
"value",
"and",
"give",
"it",
"too",
"to",
"unset",
"satellites"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2291-L2305 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.linkify_templates | def linkify_templates(self):
""" Like for normal object, we link templates with each others
:return: None
"""
self.hosts.linkify_templates()
self.contacts.linkify_templates()
self.services.linkify_templates()
self.servicedependencies.linkify_templates()
s... | python | def linkify_templates(self):
""" Like for normal object, we link templates with each others
:return: None
"""
self.hosts.linkify_templates()
self.contacts.linkify_templates()
self.services.linkify_templates()
self.servicedependencies.linkify_templates()
s... | [
"def",
"linkify_templates",
"(",
"self",
")",
":",
"self",
".",
"hosts",
".",
"linkify_templates",
"(",
")",
"self",
".",
"contacts",
".",
"linkify_templates",
"(",
")",
"self",
".",
"services",
".",
"linkify_templates",
"(",
")",
"self",
".",
"servicedepend... | Like for normal object, we link templates with each others
:return: None | [
"Like",
"for",
"normal",
"object",
"we",
"link",
"templates",
"with",
"each",
"others"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2307-L2323 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.remove_templates | def remove_templates(self):
"""Clean useless elements like templates because they are not needed anymore
:return: None
"""
self.hosts.remove_templates()
self.contacts.remove_templates()
self.services.remove_templates()
self.servicedependencies.remove_templates()
... | python | def remove_templates(self):
"""Clean useless elements like templates because they are not needed anymore
:return: None
"""
self.hosts.remove_templates()
self.contacts.remove_templates()
self.services.remove_templates()
self.servicedependencies.remove_templates()
... | [
"def",
"remove_templates",
"(",
"self",
")",
":",
"self",
".",
"hosts",
".",
"remove_templates",
"(",
")",
"self",
".",
"contacts",
".",
"remove_templates",
"(",
")",
"self",
".",
"services",
".",
"remove_templates",
"(",
")",
"self",
".",
"servicedependenci... | Clean useless elements like templates because they are not needed anymore
:return: None | [
"Clean",
"useless",
"elements",
"like",
"templates",
"because",
"they",
"are",
"not",
"needed",
"anymore"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2566-L2576 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.show_errors | def show_errors(self):
"""
Loop over configuration warnings and log them as INFO log
Loop over configuration errors and log them as INFO log
Note that the warnings and errors are logged on the fly during the configuration parsing.
It is not necessary to log as WARNING and ERROR ... | python | def show_errors(self):
"""
Loop over configuration warnings and log them as INFO log
Loop over configuration errors and log them as INFO log
Note that the warnings and errors are logged on the fly during the configuration parsing.
It is not necessary to log as WARNING and ERROR ... | [
"def",
"show_errors",
"(",
"self",
")",
":",
"if",
"self",
".",
"configuration_warnings",
":",
"logger",
".",
"warning",
"(",
"\"Configuration warnings:\"",
")",
"for",
"msg",
"in",
"self",
".",
"configuration_warnings",
":",
"logger",
".",
"warning",
"(",
"ms... | Loop over configuration warnings and log them as INFO log
Loop over configuration errors and log them as INFO log
Note that the warnings and errors are logged on the fly during the configuration parsing.
It is not necessary to log as WARNING and ERROR in this function which is used as a sum-up
... | [
"Loop",
"over",
"configuration",
"warnings",
"and",
"log",
"them",
"as",
"INFO",
"log",
"Loop",
"over",
"configuration",
"errors",
"and",
"log",
"them",
"as",
"INFO",
"log"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L2578-L2596 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.prepare_for_sending | def prepare_for_sending(self):
"""The configuration needs to be serialized before being sent to a spare arbiter
:return: None
"""
if [arbiter_link for arbiter_link in self.arbiters if arbiter_link.spare]:
logger.info('Serializing the configuration for my spare arbiter...')
... | python | def prepare_for_sending(self):
"""The configuration needs to be serialized before being sent to a spare arbiter
:return: None
"""
if [arbiter_link for arbiter_link in self.arbiters if arbiter_link.spare]:
logger.info('Serializing the configuration for my spare arbiter...')
... | [
"def",
"prepare_for_sending",
"(",
"self",
")",
":",
"if",
"[",
"arbiter_link",
"for",
"arbiter_link",
"in",
"self",
".",
"arbiters",
"if",
"arbiter_link",
".",
"spare",
"]",
":",
"logger",
".",
"info",
"(",
"'Serializing the configuration for my spare arbiter...'",... | The configuration needs to be serialized before being sent to a spare arbiter
:return: None | [
"The",
"configuration",
"needs",
"to",
"be",
"serialized",
"before",
"being",
"sent",
"to",
"a",
"spare",
"arbiter"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L3042-L3051 | train |
Alignak-monitoring/alignak | alignak/objects/config.py | Config.dump | def dump(self, dump_file_name=None):
"""Dump configuration to a file in a JSON format
:param dump_file_name: the file to dump configuration to
:type dump_file_name: str
:return: None
"""
config_dump = {}
for _, _, category, _, _ in list(self.types_creations.valu... | python | def dump(self, dump_file_name=None):
"""Dump configuration to a file in a JSON format
:param dump_file_name: the file to dump configuration to
:type dump_file_name: str
:return: None
"""
config_dump = {}
for _, _, category, _, _ in list(self.types_creations.valu... | [
"def",
"dump",
"(",
"self",
",",
"dump_file_name",
"=",
"None",
")",
":",
"config_dump",
"=",
"{",
"}",
"for",
"_",
",",
"_",
",",
"category",
",",
"_",
",",
"_",
"in",
"list",
"(",
"self",
".",
"types_creations",
".",
"values",
"(",
")",
")",
":... | Dump configuration to a file in a JSON format
:param dump_file_name: the file to dump configuration to
:type dump_file_name: str
:return: None | [
"Dump",
"configuration",
"to",
"a",
"file",
"in",
"a",
"JSON",
"format"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L3053-L3090 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.push_broks_to_broker | def push_broks_to_broker(self): # pragma: no cover - not used!
"""Send all broks from arbiter internal list to broker
The arbiter get some broks and then pushes them to all the brokers.
:return: None
"""
someone_is_concerned = False
sent = False
for broker_link... | python | def push_broks_to_broker(self): # pragma: no cover - not used!
"""Send all broks from arbiter internal list to broker
The arbiter get some broks and then pushes them to all the brokers.
:return: None
"""
someone_is_concerned = False
sent = False
for broker_link... | [
"def",
"push_broks_to_broker",
"(",
"self",
")",
":",
"someone_is_concerned",
"=",
"False",
"sent",
"=",
"False",
"for",
"broker_link",
"in",
"self",
".",
"conf",
".",
"brokers",
":",
"if",
"not",
"broker_link",
".",
"manage_arbiters",
":",
"continue",
"someon... | Send all broks from arbiter internal list to broker
The arbiter get some broks and then pushes them to all the brokers.
:return: None | [
"Send",
"all",
"broks",
"from",
"arbiter",
"internal",
"list",
"to",
"broker"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L268-L291 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.push_external_commands_to_schedulers | def push_external_commands_to_schedulers(self): # pragma: no cover - not used!
"""Send external commands to schedulers
:return: None
"""
# Now get all external commands and push them to the schedulers
for external_command in self.external_commands:
self.external_com... | python | def push_external_commands_to_schedulers(self): # pragma: no cover - not used!
"""Send external commands to schedulers
:return: None
"""
# Now get all external commands and push them to the schedulers
for external_command in self.external_commands:
self.external_com... | [
"def",
"push_external_commands_to_schedulers",
"(",
"self",
")",
":",
"for",
"external_command",
"in",
"self",
".",
"external_commands",
":",
"self",
".",
"external_commands_manager",
".",
"resolve_command",
"(",
"external_command",
")",
"sent",
"=",
"False",
"for",
... | Send external commands to schedulers
:return: None | [
"Send",
"external",
"commands",
"to",
"schedulers"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L293-L314 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.get_broks_from_satellites | def get_broks_from_satellites(self): # pragma: no cover - not used!
"""Get broks from my all internal satellite links
The arbiter get the broks from ALL the known satellites
:return: None
"""
for satellites in [self.conf.brokers, self.conf.schedulers,
... | python | def get_broks_from_satellites(self): # pragma: no cover - not used!
"""Get broks from my all internal satellite links
The arbiter get the broks from ALL the known satellites
:return: None
"""
for satellites in [self.conf.brokers, self.conf.schedulers,
... | [
"def",
"get_broks_from_satellites",
"(",
"self",
")",
":",
"for",
"satellites",
"in",
"[",
"self",
".",
"conf",
".",
"brokers",
",",
"self",
".",
"conf",
".",
"schedulers",
",",
"self",
".",
"conf",
".",
"pollers",
",",
"self",
".",
"conf",
".",
"react... | Get broks from my all internal satellite links
The arbiter get the broks from ALL the known satellites
:return: None | [
"Get",
"broks",
"from",
"my",
"all",
"internal",
"satellite",
"links"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L327-L345 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.get_initial_broks_from_satellites | def get_initial_broks_from_satellites(self):
"""Get initial broks from my internal satellite links
:return: None
"""
for satellites in [self.conf.brokers, self.conf.schedulers,
self.conf.pollers, self.conf.reactionners, self.conf.receivers]:
for sa... | python | def get_initial_broks_from_satellites(self):
"""Get initial broks from my internal satellite links
:return: None
"""
for satellites in [self.conf.brokers, self.conf.schedulers,
self.conf.pollers, self.conf.reactionners, self.conf.receivers]:
for sa... | [
"def",
"get_initial_broks_from_satellites",
"(",
"self",
")",
":",
"for",
"satellites",
"in",
"[",
"self",
".",
"conf",
".",
"brokers",
",",
"self",
".",
"conf",
".",
"schedulers",
",",
"self",
".",
"conf",
".",
"pollers",
",",
"self",
".",
"conf",
".",
... | Get initial broks from my internal satellite links
:return: None | [
"Get",
"initial",
"broks",
"from",
"my",
"internal",
"satellite",
"links"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L347-L361 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.load_modules_configuration_objects | def load_modules_configuration_objects(self, raw_objects): # pragma: no cover,
# not yet with unit tests.
"""Load configuration objects from arbiter modules
If module implements get_objects arbiter will call it and add create
objects
:param raw_objects: raw objects we got from ... | python | def load_modules_configuration_objects(self, raw_objects): # pragma: no cover,
# not yet with unit tests.
"""Load configuration objects from arbiter modules
If module implements get_objects arbiter will call it and add create
objects
:param raw_objects: raw objects we got from ... | [
"def",
"load_modules_configuration_objects",
"(",
"self",
",",
"raw_objects",
")",
":",
"for",
"instance",
"in",
"self",
".",
"modules_manager",
".",
"instances",
":",
"logger",
".",
"debug",
"(",
"\"Getting objects from the module: %s\"",
",",
"instance",
".",
"nam... | Load configuration objects from arbiter modules
If module implements get_objects arbiter will call it and add create
objects
:param raw_objects: raw objects we got from reading config files
:type raw_objects: dict
:return: None | [
"Load",
"configuration",
"objects",
"from",
"arbiter",
"modules",
"If",
"module",
"implements",
"get_objects",
"arbiter",
"will",
"call",
"it",
"and",
"add",
"create",
"objects"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L821-L871 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.load_modules_alignak_configuration | def load_modules_alignak_configuration(self): # pragma: no cover, not yet with unit tests.
"""Load Alignak configuration from the arbiter modules
If module implements get_alignak_configuration, call this function
:param raw_objects: raw objects we got from reading config files
:type ra... | python | def load_modules_alignak_configuration(self): # pragma: no cover, not yet with unit tests.
"""Load Alignak configuration from the arbiter modules
If module implements get_alignak_configuration, call this function
:param raw_objects: raw objects we got from reading config files
:type ra... | [
"def",
"load_modules_alignak_configuration",
"(",
"self",
")",
":",
"alignak_cfg",
"=",
"{",
"}",
"for",
"instance",
"in",
"self",
".",
"modules_manager",
".",
"instances",
":",
"if",
"not",
"hasattr",
"(",
"instance",
",",
"'get_alignak_configuration'",
")",
":... | Load Alignak configuration from the arbiter modules
If module implements get_alignak_configuration, call this function
:param raw_objects: raw objects we got from reading config files
:type raw_objects: dict
:return: None | [
"Load",
"Alignak",
"configuration",
"from",
"the",
"arbiter",
"modules",
"If",
"module",
"implements",
"get_alignak_configuration",
"call",
"this",
"function"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L873-L919 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.request_stop | def request_stop(self, message='', exit_code=0):
"""Stop the Arbiter daemon
:return: None
"""
# Only a master arbiter can stop the daemons
if self.is_master:
# Stop the daemons
self.daemons_stop(timeout=self.conf.daemons_stop_timeout)
# Request t... | python | def request_stop(self, message='', exit_code=0):
"""Stop the Arbiter daemon
:return: None
"""
# Only a master arbiter can stop the daemons
if self.is_master:
# Stop the daemons
self.daemons_stop(timeout=self.conf.daemons_stop_timeout)
# Request t... | [
"def",
"request_stop",
"(",
"self",
",",
"message",
"=",
"''",
",",
"exit_code",
"=",
"0",
")",
":",
"if",
"self",
".",
"is_master",
":",
"self",
".",
"daemons_stop",
"(",
"timeout",
"=",
"self",
".",
"conf",
".",
"daemons_stop_timeout",
")",
"super",
... | Stop the Arbiter daemon
:return: None | [
"Stop",
"the",
"Arbiter",
"daemon"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L921-L932 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.start_daemon | def start_daemon(self, satellite):
"""Manage the list of detected missing daemons
If the daemon does not in exist `my_daemons`, then:
- prepare daemon start arguments (port, name and log file)
- start the daemon
- make sure it started correctly
:param satellite: ... | python | def start_daemon(self, satellite):
"""Manage the list of detected missing daemons
If the daemon does not in exist `my_daemons`, then:
- prepare daemon start arguments (port, name and log file)
- start the daemon
- make sure it started correctly
:param satellite: ... | [
"def",
"start_daemon",
"(",
"self",
",",
"satellite",
")",
":",
"logger",
".",
"info",
"(",
"\" launching a daemon for: %s/%s...\"",
",",
"satellite",
".",
"type",
",",
"satellite",
".",
"name",
")",
"daemon_script_location",
"=",
"getattr",
"(",
"self",
".",
... | Manage the list of detected missing daemons
If the daemon does not in exist `my_daemons`, then:
- prepare daemon start arguments (port, name and log file)
- start the daemon
- make sure it started correctly
:param satellite: the satellite for which a daemon is to be star... | [
"Manage",
"the",
"list",
"of",
"detected",
"missing",
"daemons"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L934-L984 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.daemons_start | def daemons_start(self, run_daemons=True):
"""Manage the list of the daemons in the configuration
Check if the daemon needs to be started by the Arbiter.
If so, starts the daemon if `run_daemons` is True
:param run_daemons: run the daemons or make a simple check
:type run_daem... | python | def daemons_start(self, run_daemons=True):
"""Manage the list of the daemons in the configuration
Check if the daemon needs to be started by the Arbiter.
If so, starts the daemon if `run_daemons` is True
:param run_daemons: run the daemons or make a simple check
:type run_daem... | [
"def",
"daemons_start",
"(",
"self",
",",
"run_daemons",
"=",
"True",
")",
":",
"result",
"=",
"True",
"if",
"run_daemons",
":",
"logger",
".",
"info",
"(",
"\"Alignak configured daemons start:\"",
")",
"else",
":",
"logger",
".",
"info",
"(",
"\"Alignak confi... | Manage the list of the daemons in the configuration
Check if the daemon needs to be started by the Arbiter.
If so, starts the daemon if `run_daemons` is True
:param run_daemons: run the daemons or make a simple check
:type run_daemons: bool
:return: True if all daemons are ru... | [
"Manage",
"the",
"list",
"of",
"the",
"daemons",
"in",
"the",
"configuration"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L986-L1043 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.daemons_stop | def daemons_stop(self, timeout=30, kill_children=False):
"""Stop the Alignak daemons
Iterate over the self-launched daemons and their children list to send a TERM
Wait for daemons to terminate and then send a KILL for those that are not yet stopped
As a default behavior, only the la... | python | def daemons_stop(self, timeout=30, kill_children=False):
"""Stop the Alignak daemons
Iterate over the self-launched daemons and their children list to send a TERM
Wait for daemons to terminate and then send a KILL for those that are not yet stopped
As a default behavior, only the la... | [
"def",
"daemons_stop",
"(",
"self",
",",
"timeout",
"=",
"30",
",",
"kill_children",
"=",
"False",
")",
":",
"def",
"on_terminate",
"(",
"proc",
")",
":",
"logger",
".",
"debug",
"(",
"\"process %s terminated with exit code %s\"",
",",
"proc",
".",
"pid",
",... | Stop the Alignak daemons
Iterate over the self-launched daemons and their children list to send a TERM
Wait for daemons to terminate and then send a KILL for those that are not yet stopped
As a default behavior, only the launched daemons are killed, not their children.
Each daemon ... | [
"Stop",
"the",
"Alignak",
"daemons"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1109-L1170 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.setup_new_conf | def setup_new_conf(self):
# pylint: disable=too-many-locals
""" Setup a new configuration received from a Master arbiter.
TODO: perharps we should not accept the configuration or raise an error if we do not
find our own configuration data in the data. Thus this should never happen...
... | python | def setup_new_conf(self):
# pylint: disable=too-many-locals
""" Setup a new configuration received from a Master arbiter.
TODO: perharps we should not accept the configuration or raise an error if we do not
find our own configuration data in the data. Thus this should never happen...
... | [
"def",
"setup_new_conf",
"(",
"self",
")",
":",
"super",
"(",
"Arbiter",
",",
"self",
")",
".",
"setup_new_conf",
"(",
")",
"with",
"self",
".",
"conf_lock",
":",
"logger",
".",
"info",
"(",
"\"I received a new configuration from my master\"",
")",
"self",
"."... | Setup a new configuration received from a Master arbiter.
TODO: perharps we should not accept the configuration or raise an error if we do not
find our own configuration data in the data. Thus this should never happen...
:return: None | [
"Setup",
"a",
"new",
"configuration",
"received",
"from",
"a",
"Master",
"arbiter",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1219-L1342 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.wait_for_master_death | def wait_for_master_death(self):
"""Wait for a master timeout and take the lead if necessary
:return: None
"""
logger.info("Waiting for master death")
timeout = 1.0
self.last_master_ping = time.time()
master_timeout = 300
for arbiter_link in self.conf.ar... | python | def wait_for_master_death(self):
"""Wait for a master timeout and take the lead if necessary
:return: None
"""
logger.info("Waiting for master death")
timeout = 1.0
self.last_master_ping = time.time()
master_timeout = 300
for arbiter_link in self.conf.ar... | [
"def",
"wait_for_master_death",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Waiting for master death\"",
")",
"timeout",
"=",
"1.0",
"self",
".",
"last_master_ping",
"=",
"time",
".",
"time",
"(",
")",
"master_timeout",
"=",
"300",
"for",
"arbiter_li... | Wait for a master timeout and take the lead if necessary
:return: None | [
"Wait",
"for",
"a",
"master",
"timeout",
"and",
"take",
"the",
"lead",
"if",
"necessary"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1344-L1382 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.manage_signal | def manage_signal(self, sig, frame):
"""Manage signals caught by the process
Specific behavior for the arbiter when it receives a sigkill or sigterm
:param sig: signal caught by the process
:type sig: str
:param frame: current stack frame
:type frame:
:return: No... | python | def manage_signal(self, sig, frame):
"""Manage signals caught by the process
Specific behavior for the arbiter when it receives a sigkill or sigterm
:param sig: signal caught by the process
:type sig: str
:param frame: current stack frame
:type frame:
:return: No... | [
"def",
"manage_signal",
"(",
"self",
",",
"sig",
",",
"frame",
")",
":",
"if",
"sig",
"in",
"[",
"signal",
".",
"SIGINT",
",",
"signal",
".",
"SIGTERM",
"]",
":",
"logger",
".",
"info",
"(",
"\"received a signal: %s\"",
",",
"SIGNALS_TO_NAMES_DICT",
"[",
... | Manage signals caught by the process
Specific behavior for the arbiter when it receives a sigkill or sigterm
:param sig: signal caught by the process
:type sig: str
:param frame: current stack frame
:type frame:
:return: None | [
"Manage",
"signals",
"caught",
"by",
"the",
"process",
"Specific",
"behavior",
"for",
"the",
"arbiter",
"when",
"it",
"receives",
"a",
"sigkill",
"or",
"sigterm"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1394-L1411 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.configuration_dispatch | def configuration_dispatch(self, not_configured=None):
"""Monitored configuration preparation and dispatch
:return: None
"""
if not not_configured:
self.dispatcher = Dispatcher(self.conf, self.link_to_myself)
# I set my own dispatched configuration as the provide... | python | def configuration_dispatch(self, not_configured=None):
"""Monitored configuration preparation and dispatch
:return: None
"""
if not not_configured:
self.dispatcher = Dispatcher(self.conf, self.link_to_myself)
# I set my own dispatched configuration as the provide... | [
"def",
"configuration_dispatch",
"(",
"self",
",",
"not_configured",
"=",
"None",
")",
":",
"if",
"not",
"not_configured",
":",
"self",
".",
"dispatcher",
"=",
"Dispatcher",
"(",
"self",
".",
"conf",
",",
"self",
".",
"link_to_myself",
")",
"self",
".",
"c... | Monitored configuration preparation and dispatch
:return: None | [
"Monitored",
"configuration",
"preparation",
"and",
"dispatch"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1413-L1504 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.do_before_loop | def do_before_loop(self):
"""Called before the main daemon loop.
:return: None
"""
logger.info("I am the arbiter: %s", self.link_to_myself.name)
# If I am a spare, I do not have anything to do here...
if not self.is_master:
logger.debug("Waiting for my maste... | python | def do_before_loop(self):
"""Called before the main daemon loop.
:return: None
"""
logger.info("I am the arbiter: %s", self.link_to_myself.name)
# If I am a spare, I do not have anything to do here...
if not self.is_master:
logger.debug("Waiting for my maste... | [
"def",
"do_before_loop",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"I am the arbiter: %s\"",
",",
"self",
".",
"link_to_myself",
".",
"name",
")",
"if",
"not",
"self",
".",
"is_master",
":",
"logger",
".",
"debug",
"(",
"\"Waiting for my master deat... | Called before the main daemon loop.
:return: None | [
"Called",
"before",
"the",
"main",
"daemon",
"loop",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1506-L1545 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.get_monitoring_problems | def get_monitoring_problems(self):
"""Get the schedulers satellites problems list
:return: problems dictionary
:rtype: dict
"""
res = self.get_id()
res['problems'] = {}
# Report our schedulers information, but only if a dispatcher exists
if getattr(self,... | python | def get_monitoring_problems(self):
"""Get the schedulers satellites problems list
:return: problems dictionary
:rtype: dict
"""
res = self.get_id()
res['problems'] = {}
# Report our schedulers information, but only if a dispatcher exists
if getattr(self,... | [
"def",
"get_monitoring_problems",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"get_id",
"(",
")",
"res",
"[",
"'problems'",
"]",
"=",
"{",
"}",
"if",
"getattr",
"(",
"self",
",",
"'dispatcher'",
",",
"None",
")",
"is",
"None",
":",
"return",
"res... | Get the schedulers satellites problems list
:return: problems dictionary
:rtype: dict | [
"Get",
"the",
"schedulers",
"satellites",
"problems",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1801-L1826 | train |
Alignak-monitoring/alignak | alignak/daemons/arbiterdaemon.py | Arbiter.get_livesynthesis | def get_livesynthesis(self):
"""Get the schedulers satellites live synthesis
:return: compiled livesynthesis dictionary
:rtype: dict
"""
res = self.get_id()
res['livesynthesis'] = {
'_overall': {
'_freshness': int(time.time()),
... | python | def get_livesynthesis(self):
"""Get the schedulers satellites live synthesis
:return: compiled livesynthesis dictionary
:rtype: dict
"""
res = self.get_id()
res['livesynthesis'] = {
'_overall': {
'_freshness': int(time.time()),
... | [
"def",
"get_livesynthesis",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"get_id",
"(",
")",
"res",
"[",
"'livesynthesis'",
"]",
"=",
"{",
"'_overall'",
":",
"{",
"'_freshness'",
":",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
",",
"'livesynt... | Get the schedulers satellites live synthesis
:return: compiled livesynthesis dictionary
:rtype: dict | [
"Get",
"the",
"schedulers",
"satellites",
"live",
"synthesis"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/arbiterdaemon.py#L1828-L1893 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.overall_state_id | def overall_state_id(self):
"""Get the service overall state.
The service overall state identifier is the service status including:
- the monitored state
- the acknowledged state
- the downtime state
The overall state is (prioritized):
- a service is not monitor... | python | def overall_state_id(self):
"""Get the service overall state.
The service overall state identifier is the service status including:
- the monitored state
- the acknowledged state
- the downtime state
The overall state is (prioritized):
- a service is not monitor... | [
"def",
"overall_state_id",
"(",
"self",
")",
":",
"overall_state",
"=",
"0",
"if",
"not",
"self",
".",
"monitored",
":",
"overall_state",
"=",
"5",
"elif",
"self",
".",
"acknowledged",
":",
"overall_state",
"=",
"1",
"elif",
"self",
".",
"downtimed",
":",
... | Get the service overall state.
The service overall state identifier is the service status including:
- the monitored state
- the acknowledged state
- the downtime state
The overall state is (prioritized):
- a service is not monitored (5)
- a service critical or ... | [
"Get",
"the",
"service",
"overall",
"state",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L255-L294 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.fill_predictive_missing_parameters | def fill_predictive_missing_parameters(self):
"""define state with initial_state
:return: None
"""
if self.initial_state == 'w':
self.state = u'WARNING'
elif self.initial_state == 'u':
self.state = u'UNKNOWN'
elif self.initial_state == 'c':
... | python | def fill_predictive_missing_parameters(self):
"""define state with initial_state
:return: None
"""
if self.initial_state == 'w':
self.state = u'WARNING'
elif self.initial_state == 'u':
self.state = u'UNKNOWN'
elif self.initial_state == 'c':
... | [
"def",
"fill_predictive_missing_parameters",
"(",
"self",
")",
":",
"if",
"self",
".",
"initial_state",
"==",
"'w'",
":",
"self",
".",
"state",
"=",
"u'WARNING'",
"elif",
"self",
".",
"initial_state",
"==",
"'u'",
":",
"self",
".",
"state",
"=",
"u'UNKNOWN'"... | define state with initial_state
:return: None | [
"define",
"state",
"with",
"initial_state"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L307-L319 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.get_name | def get_name(self):
"""Accessor to service_description attribute or name if first not defined
:return: service name
:rtype: str
"""
if hasattr(self, 'service_description'):
return self.service_description
if hasattr(self, 'name'):
return self.name... | python | def get_name(self):
"""Accessor to service_description attribute or name if first not defined
:return: service name
:rtype: str
"""
if hasattr(self, 'service_description'):
return self.service_description
if hasattr(self, 'name'):
return self.name... | [
"def",
"get_name",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'service_description'",
")",
":",
"return",
"self",
".",
"service_description",
"if",
"hasattr",
"(",
"self",
",",
"'name'",
")",
":",
"return",
"self",
".",
"name",
"return",
... | Accessor to service_description attribute or name if first not defined
:return: service name
:rtype: str | [
"Accessor",
"to",
"service_description",
"attribute",
"or",
"name",
"if",
"first",
"not",
"defined"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L351-L361 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.get_groupnames | def get_groupnames(self, sgs):
"""Get servicegroups list
:return: comma separated list of servicegroups
:rtype: str
"""
return ','.join([sgs[sg].get_name() for sg in self.servicegroups]) | python | def get_groupnames(self, sgs):
"""Get servicegroups list
:return: comma separated list of servicegroups
:rtype: str
"""
return ','.join([sgs[sg].get_name() for sg in self.servicegroups]) | [
"def",
"get_groupnames",
"(",
"self",
",",
"sgs",
")",
":",
"return",
"','",
".",
"join",
"(",
"[",
"sgs",
"[",
"sg",
"]",
".",
"get_name",
"(",
")",
"for",
"sg",
"in",
"self",
".",
"servicegroups",
"]",
")"
] | Get servicegroups list
:return: comma separated list of servicegroups
:rtype: str | [
"Get",
"servicegroups",
"list"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L383-L389 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.duplicate | def duplicate(self, host):
# pylint: disable=too-many-locals
"""For a given host, look for all copy we must create for for_each property
:param host: alignak host object
:type host: alignak.objects.host.Host
:return: list
:rtype: list
"""
duplicates = []... | python | def duplicate(self, host):
# pylint: disable=too-many-locals
"""For a given host, look for all copy we must create for for_each property
:param host: alignak host object
:type host: alignak.objects.host.Host
:return: list
:rtype: list
"""
duplicates = []... | [
"def",
"duplicate",
"(",
"self",
",",
"host",
")",
":",
"duplicates",
"=",
"[",
"]",
"prop",
"=",
"self",
".",
"duplicate_foreach",
".",
"strip",
"(",
")",
".",
"upper",
"(",
")",
"if",
"prop",
"not",
"in",
"host",
".",
"customs",
":",
"return",
"d... | For a given host, look for all copy we must create for for_each property
:param host: alignak host object
:type host: alignak.objects.host.Host
:return: list
:rtype: list | [
"For",
"a",
"given",
"host",
"look",
"for",
"all",
"copy",
"we",
"must",
"create",
"for",
"for_each",
"property"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L457-L537 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.set_state_from_exit_status | def set_state_from_exit_status(self, status, notif_period, hosts, services):
"""Set the state in UP, WARNING, CRITICAL, UNKNOWN or UNREACHABLE
according to the status of a check result.
:param status: integer between 0 and 4
:type status: int
:return: None
"""
no... | python | def set_state_from_exit_status(self, status, notif_period, hosts, services):
"""Set the state in UP, WARNING, CRITICAL, UNKNOWN or UNREACHABLE
according to the status of a check result.
:param status: integer between 0 and 4
:type status: int
:return: None
"""
no... | [
"def",
"set_state_from_exit_status",
"(",
"self",
",",
"status",
",",
"notif_period",
",",
"hosts",
",",
"services",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"cls",
"=",
"self",
".",
"__class__",
"if",
"cls",
".",
"enable_problem_impacts_states_c... | Set the state in UP, WARNING, CRITICAL, UNKNOWN or UNREACHABLE
according to the status of a check result.
:param status: integer between 0 and 4
:type status: int
:return: None | [
"Set",
"the",
"state",
"in",
"UP",
"WARNING",
"CRITICAL",
"UNKNOWN",
"or",
"UNREACHABLE",
"according",
"to",
"the",
"status",
"of",
"a",
"check",
"result",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L550-L619 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.is_state | def is_state(self, status):
# pylint: disable=too-many-return-statements
"""Return True if status match the current service status
:param status: status to compare ( "o", "c", "w", "u", "x"). Usually comes from config files
:type status: str
:return: True if status <=> self.stat... | python | def is_state(self, status):
# pylint: disable=too-many-return-statements
"""Return True if status match the current service status
:param status: status to compare ( "o", "c", "w", "u", "x"). Usually comes from config files
:type status: str
:return: True if status <=> self.stat... | [
"def",
"is_state",
"(",
"self",
",",
"status",
")",
":",
"if",
"status",
"==",
"self",
".",
"state",
":",
"return",
"True",
"if",
"status",
"==",
"'o'",
"and",
"self",
".",
"state",
"==",
"u'OK'",
":",
"return",
"True",
"if",
"status",
"==",
"'c'",
... | Return True if status match the current service status
:param status: status to compare ( "o", "c", "w", "u", "x"). Usually comes from config files
:type status: str
:return: True if status <=> self.status, otherwise False
:rtype: bool | [
"Return",
"True",
"if",
"status",
"match",
"the",
"current",
"service",
"status"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L621-L643 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.last_time_non_ok_or_up | def last_time_non_ok_or_up(self):
"""Get the last time the service was in a non-OK state
:return: the nearest last time the service was not ok
:rtype: int
"""
non_ok_times = [x for x in [self.last_time_warning,
self.last_time_critical,
... | python | def last_time_non_ok_or_up(self):
"""Get the last time the service was in a non-OK state
:return: the nearest last time the service was not ok
:rtype: int
"""
non_ok_times = [x for x in [self.last_time_warning,
self.last_time_critical,
... | [
"def",
"last_time_non_ok_or_up",
"(",
"self",
")",
":",
"non_ok_times",
"=",
"[",
"x",
"for",
"x",
"in",
"[",
"self",
".",
"last_time_warning",
",",
"self",
".",
"last_time_critical",
",",
"self",
".",
"last_time_unknown",
"]",
"if",
"x",
">",
"self",
".",... | Get the last time the service was in a non-OK state
:return: the nearest last time the service was not ok
:rtype: int | [
"Get",
"the",
"last",
"time",
"the",
"service",
"was",
"in",
"a",
"non",
"-",
"OK",
"state"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L645-L659 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.get_data_for_notifications | def get_data_for_notifications(self, contact, notif, host_ref):
"""Get data for a notification
:param contact: The contact to return
:type contact:
:param notif: the notification to return
:type notif:
:return: list containing the service, the host and the given paramete... | python | def get_data_for_notifications(self, contact, notif, host_ref):
"""Get data for a notification
:param contact: The contact to return
:type contact:
:param notif: the notification to return
:type notif:
:return: list containing the service, the host and the given paramete... | [
"def",
"get_data_for_notifications",
"(",
"self",
",",
"contact",
",",
"notif",
",",
"host_ref",
")",
":",
"if",
"not",
"host_ref",
":",
"return",
"[",
"self",
",",
"contact",
",",
"notif",
"]",
"return",
"[",
"host_ref",
",",
"self",
",",
"contact",
","... | Get data for a notification
:param contact: The contact to return
:type contact:
:param notif: the notification to return
:type notif:
:return: list containing the service, the host and the given parameters
:rtype: list | [
"Get",
"data",
"for",
"a",
"notification"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1028-L1040 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Service.get_short_status | def get_short_status(self, hosts, services):
"""Get the short status of this host
:return: "O", "W", "C", "U', or "n/a" based on service state_id or business_rule state
:rtype: str
"""
mapping = {
0: "O",
1: "W",
2: "C",
3: "U",
... | python | def get_short_status(self, hosts, services):
"""Get the short status of this host
:return: "O", "W", "C", "U', or "n/a" based on service state_id or business_rule state
:rtype: str
"""
mapping = {
0: "O",
1: "W",
2: "C",
3: "U",
... | [
"def",
"get_short_status",
"(",
"self",
",",
"hosts",
",",
"services",
")",
":",
"mapping",
"=",
"{",
"0",
":",
"\"O\"",
",",
"1",
":",
"\"W\"",
",",
"2",
":",
"\"C\"",
",",
"3",
":",
"\"U\"",
",",
"4",
":",
"\"N\"",
",",
"}",
"if",
"self",
"."... | Get the short status of this host
:return: "O", "W", "C", "U', or "n/a" based on service state_id or business_rule state
:rtype: str | [
"Get",
"the",
"short",
"status",
"of",
"this",
"host"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1257-L1273 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.add_template | def add_template(self, tpl):
"""
Adds and index a template into the `templates` container.
This implementation takes into account that a service has two naming
attribute: `host_name` and `service_description`.
:param tpl: The template to add
:type tpl:
:return: ... | python | def add_template(self, tpl):
"""
Adds and index a template into the `templates` container.
This implementation takes into account that a service has two naming
attribute: `host_name` and `service_description`.
:param tpl: The template to add
:type tpl:
:return: ... | [
"def",
"add_template",
"(",
"self",
",",
"tpl",
")",
":",
"objcls",
"=",
"self",
".",
"inner_class",
".",
"my_type",
"name",
"=",
"getattr",
"(",
"tpl",
",",
"'name'",
",",
"''",
")",
"sdesc",
"=",
"getattr",
"(",
"tpl",
",",
"'service_description'",
"... | Adds and index a template into the `templates` container.
This implementation takes into account that a service has two naming
attribute: `host_name` and `service_description`.
:param tpl: The template to add
:type tpl:
:return: None | [
"Adds",
"and",
"index",
"a",
"template",
"into",
"the",
"templates",
"container",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1312-L1344 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.find_srvs_by_hostname | def find_srvs_by_hostname(self, host_name):
"""Get all services from a host based on a host_name
:param host_name: the host name we want services
:type host_name: str
:return: list of services
:rtype: list[alignak.objects.service.Service]
"""
if hasattr(self, 'ho... | python | def find_srvs_by_hostname(self, host_name):
"""Get all services from a host based on a host_name
:param host_name: the host name we want services
:type host_name: str
:return: list of services
:rtype: list[alignak.objects.service.Service]
"""
if hasattr(self, 'ho... | [
"def",
"find_srvs_by_hostname",
"(",
"self",
",",
"host_name",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'hosts'",
")",
":",
"host",
"=",
"self",
".",
"hosts",
".",
"find_by_name",
"(",
"host_name",
")",
"if",
"host",
"is",
"None",
":",
"return",
"... | Get all services from a host based on a host_name
:param host_name: the host name we want services
:type host_name: str
:return: list of services
:rtype: list[alignak.objects.service.Service] | [
"Get",
"all",
"services",
"from",
"a",
"host",
"based",
"on",
"a",
"host_name"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1358-L1371 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.find_srv_by_name_and_hostname | def find_srv_by_name_and_hostname(self, host_name, sdescr):
"""Get a specific service based on a host_name and service_description
:param host_name: host name linked to needed service
:type host_name: str
:param sdescr: service name we need
:type sdescr: str
:return: th... | python | def find_srv_by_name_and_hostname(self, host_name, sdescr):
"""Get a specific service based on a host_name and service_description
:param host_name: host name linked to needed service
:type host_name: str
:param sdescr: service name we need
:type sdescr: str
:return: th... | [
"def",
"find_srv_by_name_and_hostname",
"(",
"self",
",",
"host_name",
",",
"sdescr",
")",
":",
"key",
"=",
"(",
"host_name",
",",
"sdescr",
")",
"return",
"self",
".",
"name_to_item",
".",
"get",
"(",
"key",
",",
"None",
")"
] | Get a specific service based on a host_name and service_description
:param host_name: host name linked to needed service
:type host_name: str
:param sdescr: service name we need
:type sdescr: str
:return: the service found or None
:rtype: alignak.objects.service.Service | [
"Get",
"a",
"specific",
"service",
"based",
"on",
"a",
"host_name",
"and",
"service_description"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1373-L1384 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.linkify_s_by_hst | def linkify_s_by_hst(self, hosts):
"""Link services with their parent host
:param hosts: Hosts to look for simple host
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for serv in self:
# If we do not have a host_name, we set it as
# a te... | python | def linkify_s_by_hst(self, hosts):
"""Link services with their parent host
:param hosts: Hosts to look for simple host
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for serv in self:
# If we do not have a host_name, we set it as
# a te... | [
"def",
"linkify_s_by_hst",
"(",
"self",
",",
"hosts",
")",
":",
"for",
"serv",
"in",
"self",
":",
"if",
"not",
"hasattr",
"(",
"serv",
",",
"'host_name'",
")",
":",
"serv",
".",
"host",
"=",
"None",
"continue",
"try",
":",
"hst_name",
"=",
"serv",
".... | Link services with their parent host
:param hosts: Hosts to look for simple host
:type hosts: alignak.objects.host.Hosts
:return: None | [
"Link",
"services",
"with",
"their",
"parent",
"host"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1487-L1514 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.linkify_s_by_sg | def linkify_s_by_sg(self, servicegroups):
"""Link services with servicegroups
:param servicegroups: Servicegroups
:type servicegroups: alignak.objects.servicegroup.Servicegroups
:return: None
"""
for serv in self:
new_servicegroups = []
if hasattr... | python | def linkify_s_by_sg(self, servicegroups):
"""Link services with servicegroups
:param servicegroups: Servicegroups
:type servicegroups: alignak.objects.servicegroup.Servicegroups
:return: None
"""
for serv in self:
new_servicegroups = []
if hasattr... | [
"def",
"linkify_s_by_sg",
"(",
"self",
",",
"servicegroups",
")",
":",
"for",
"serv",
"in",
"self",
":",
"new_servicegroups",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"serv",
",",
"'servicegroups'",
")",
"and",
"serv",
".",
"servicegroups",
"!=",
"''",
":",
... | Link services with servicegroups
:param servicegroups: Servicegroups
:type servicegroups: alignak.objects.servicegroup.Servicegroups
:return: None | [
"Link",
"services",
"with",
"servicegroups"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1516-L1535 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.clean | def clean(self):
"""Remove services without host object linked to
Note that this should not happen!
:return: None
"""
to_del = []
for serv in self:
if not serv.host:
to_del.append(serv.uuid)
for service_uuid in to_del:
del... | python | def clean(self):
"""Remove services without host object linked to
Note that this should not happen!
:return: None
"""
to_del = []
for serv in self:
if not serv.host:
to_del.append(serv.uuid)
for service_uuid in to_del:
del... | [
"def",
"clean",
"(",
"self",
")",
":",
"to_del",
"=",
"[",
"]",
"for",
"serv",
"in",
"self",
":",
"if",
"not",
"serv",
".",
"host",
":",
"to_del",
".",
"append",
"(",
"serv",
".",
"uuid",
")",
"for",
"service_uuid",
"in",
"to_del",
":",
"del",
"s... | Remove services without host object linked to
Note that this should not happen!
:return: None | [
"Remove",
"services",
"without",
"host",
"object",
"linked",
"to"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1586-L1598 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.explode_services_from_hosts | def explode_services_from_hosts(self, hosts, service, hnames):
"""
Explodes a service based on a list of hosts.
:param hosts: The hosts container
:type hosts:
:param service: The base service to explode
:type service:
:param hnames: The host_name list to explode... | python | def explode_services_from_hosts(self, hosts, service, hnames):
"""
Explodes a service based on a list of hosts.
:param hosts: The hosts container
:type hosts:
:param service: The base service to explode
:type service:
:param hnames: The host_name list to explode... | [
"def",
"explode_services_from_hosts",
"(",
"self",
",",
"hosts",
",",
"service",
",",
"hnames",
")",
":",
"duplicate_for_hosts",
"=",
"[",
"]",
"not_hosts",
"=",
"[",
"]",
"for",
"hname",
"in",
"hnames",
":",
"hname",
"=",
"hname",
".",
"strip",
"(",
")"... | Explodes a service based on a list of hosts.
:param hosts: The hosts container
:type hosts:
:param service: The base service to explode
:type service:
:param hnames: The host_name list to explode service on
:type hnames: str
:return: None | [
"Explodes",
"a",
"service",
"based",
"on",
"a",
"list",
"of",
"hosts",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1600-L1646 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services._local_create_service | def _local_create_service(self, hosts, host_name, service):
"""Create a new service based on a host_name and service instance.
:param hosts: The hosts items instance.
:type hosts: alignak.objects.host.Hosts
:param host_name: The host_name to create a new service.
:type host_name... | python | def _local_create_service(self, hosts, host_name, service):
"""Create a new service based on a host_name and service instance.
:param hosts: The hosts items instance.
:type hosts: alignak.objects.host.Hosts
:param host_name: The host_name to create a new service.
:type host_name... | [
"def",
"_local_create_service",
"(",
"self",
",",
"hosts",
",",
"host_name",
",",
"service",
")",
":",
"host",
"=",
"hosts",
".",
"find_by_name",
"(",
"host_name",
".",
"strip",
"(",
")",
")",
"if",
"host",
".",
"is_excluded_for",
"(",
"service",
")",
":... | Create a new service based on a host_name and service instance.
:param hosts: The hosts items instance.
:type hosts: alignak.objects.host.Hosts
:param host_name: The host_name to create a new service.
:type host_name: str
:param service: The service to be used as template.
... | [
"Create",
"a",
"new",
"service",
"based",
"on",
"a",
"host_name",
"and",
"service",
"instance",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1649-L1670 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.explode_services_from_templates | def explode_services_from_templates(self, hosts, service_template):
"""
Explodes services from templates. All hosts holding the specified
templates are bound with the service.
:param hosts: The hosts container.
:type hosts: alignak.objects.host.Hosts
:param service_templ... | python | def explode_services_from_templates(self, hosts, service_template):
"""
Explodes services from templates. All hosts holding the specified
templates are bound with the service.
:param hosts: The hosts container.
:type hosts: alignak.objects.host.Hosts
:param service_templ... | [
"def",
"explode_services_from_templates",
"(",
"self",
",",
"hosts",
",",
"service_template",
")",
":",
"hname",
"=",
"getattr",
"(",
"service_template",
",",
"\"host_name\"",
",",
"None",
")",
"if",
"not",
"hname",
":",
"logger",
".",
"debug",
"(",
"\"Service... | Explodes services from templates. All hosts holding the specified
templates are bound with the service.
:param hosts: The hosts container.
:type hosts: alignak.objects.host.Hosts
:param service_template: The service to explode.
:type service_template: alignak.objects.service.Ser... | [
"Explodes",
"services",
"from",
"templates",
".",
"All",
"hosts",
"holding",
"the",
"specified",
"templates",
"are",
"bound",
"with",
"the",
"service",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1672-L1701 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.explode_services_duplicates | def explode_services_duplicates(self, hosts, service):
"""
Explodes services holding a `duplicate_foreach` clause.
:param hosts: The hosts container
:type hosts: alignak.objects.host.Hosts
:param service: The service to explode
:type service: alignak.objects.service.Serv... | python | def explode_services_duplicates(self, hosts, service):
"""
Explodes services holding a `duplicate_foreach` clause.
:param hosts: The hosts container
:type hosts: alignak.objects.host.Hosts
:param service: The service to explode
:type service: alignak.objects.service.Serv... | [
"def",
"explode_services_duplicates",
"(",
"self",
",",
"hosts",
",",
"service",
")",
":",
"hname",
"=",
"getattr",
"(",
"service",
",",
"\"host_name\"",
",",
"None",
")",
"if",
"hname",
"is",
"None",
":",
"return",
"host",
"=",
"hosts",
".",
"find_by_name... | Explodes services holding a `duplicate_foreach` clause.
:param hosts: The hosts container
:type hosts: alignak.objects.host.Hosts
:param service: The service to explode
:type service: alignak.objects.service.Service | [
"Explodes",
"services",
"holding",
"a",
"duplicate_foreach",
"clause",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1703-L1729 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.register_service_into_servicegroups | def register_service_into_servicegroups(service, servicegroups):
"""
Registers a service into the service groups declared in its
`servicegroups` attribute.
:param service: The service to register
:type service:
:param servicegroups: The servicegroups container
:t... | python | def register_service_into_servicegroups(service, servicegroups):
"""
Registers a service into the service groups declared in its
`servicegroups` attribute.
:param service: The service to register
:type service:
:param servicegroups: The servicegroups container
:t... | [
"def",
"register_service_into_servicegroups",
"(",
"service",
",",
"servicegroups",
")",
":",
"if",
"hasattr",
"(",
"service",
",",
"'service_description'",
")",
":",
"sname",
"=",
"service",
".",
"service_description",
"shname",
"=",
"getattr",
"(",
"service",
",... | Registers a service into the service groups declared in its
`servicegroups` attribute.
:param service: The service to register
:type service:
:param servicegroups: The servicegroups container
:type servicegroups:
:return: None | [
"Registers",
"a",
"service",
"into",
"the",
"service",
"groups",
"declared",
"in",
"its",
"servicegroups",
"attribute",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1732-L1753 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.register_service_dependencies | def register_service_dependencies(service, servicedependencies):
"""
Registers a service dependencies.
:param service: The service to register
:type service:
:param servicedependencies: The servicedependencies container
:type servicedependencies:
:return: None
... | python | def register_service_dependencies(service, servicedependencies):
"""
Registers a service dependencies.
:param service: The service to register
:type service:
:param servicedependencies: The servicedependencies container
:type servicedependencies:
:return: None
... | [
"def",
"register_service_dependencies",
"(",
"service",
",",
"servicedependencies",
")",
":",
"sdeps",
"=",
"[",
"d",
".",
"strip",
"(",
")",
"for",
"d",
"in",
"getattr",
"(",
"service",
",",
"\"service_dependencies\"",
",",
"[",
"]",
")",
"]",
"i",
"=",
... | Registers a service dependencies.
:param service: The service to register
:type service:
:param servicedependencies: The servicedependencies container
:type servicedependencies:
:return: None | [
"Registers",
"a",
"service",
"dependencies",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1756-L1785 | train |
Alignak-monitoring/alignak | alignak/objects/service.py | Services.explode | def explode(self, hosts, hostgroups, contactgroups, servicegroups, servicedependencies):
# pylint: disable=too-many-locals
"""
Explodes services, from host, hostgroups, contactgroups, servicegroups and dependencies.
:param hosts: The hosts container
:type hosts: [alignak.object.... | python | def explode(self, hosts, hostgroups, contactgroups, servicegroups, servicedependencies):
# pylint: disable=too-many-locals
"""
Explodes services, from host, hostgroups, contactgroups, servicegroups and dependencies.
:param hosts: The hosts container
:type hosts: [alignak.object.... | [
"def",
"explode",
"(",
"self",
",",
"hosts",
",",
"hostgroups",
",",
"contactgroups",
",",
"servicegroups",
",",
"servicedependencies",
")",
":",
"itemkeys",
"=",
"list",
"(",
"self",
".",
"items",
".",
"keys",
"(",
")",
")",
"for",
"s_id",
"in",
"itemke... | Explodes services, from host, hostgroups, contactgroups, servicegroups and dependencies.
:param hosts: The hosts container
:type hosts: [alignak.object.host.Host]
:param hostgroups: The hosts goups container
:type hostgroups: [alignak.object.hostgroup.Hostgroup]
:param contactgr... | [
"Explodes",
"services",
"from",
"host",
"hostgroups",
"contactgroups",
"servicegroups",
"and",
"dependencies",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1788-L1856 | train |
Alignak-monitoring/alignak | alignak/objects/escalation.py | Escalation.get_next_notif_time | def get_next_notif_time(self, t_wished, status, creation_time, interval, escal_period):
"""Get the next notification time for the escalation
Only legit for time based escalation
:param t_wished: time we would like to send a new notification (usually now)
:type t_wished:
:param s... | python | def get_next_notif_time(self, t_wished, status, creation_time, interval, escal_period):
"""Get the next notification time for the escalation
Only legit for time based escalation
:param t_wished: time we would like to send a new notification (usually now)
:type t_wished:
:param s... | [
"def",
"get_next_notif_time",
"(",
"self",
",",
"t_wished",
",",
"status",
",",
"creation_time",
",",
"interval",
",",
"escal_period",
")",
":",
"short_states",
"=",
"{",
"u'WARNING'",
":",
"'w'",
",",
"u'UNKNOWN'",
":",
"'u'",
",",
"u'CRITICAL'",
":",
"'c'"... | Get the next notification time for the escalation
Only legit for time based escalation
:param t_wished: time we would like to send a new notification (usually now)
:type t_wished:
:param status: status of the host or service
:type status:
:param creation_time: time the n... | [
"Get",
"the",
"next",
"notification",
"time",
"for",
"the",
"escalation",
"Only",
"legit",
"for",
"time",
"based",
"escalation"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/escalation.py#L189-L228 | train |
Alignak-monitoring/alignak | alignak/objects/escalation.py | Escalations.linkify_es_by_s | def linkify_es_by_s(self, services):
"""Add each escalation object into service.escalation attribute
:param services: service list, used to look for a specific service
:type services: alignak.objects.service.Services
:return: None
"""
for escalation in self:
... | python | def linkify_es_by_s(self, services):
"""Add each escalation object into service.escalation attribute
:param services: service list, used to look for a specific service
:type services: alignak.objects.service.Services
:return: None
"""
for escalation in self:
... | [
"def",
"linkify_es_by_s",
"(",
"self",
",",
"services",
")",
":",
"for",
"escalation",
"in",
"self",
":",
"if",
"not",
"hasattr",
"(",
"escalation",
",",
"'host_name'",
")",
":",
"continue",
"es_hname",
",",
"sdesc",
"=",
"escalation",
".",
"host_name",
",... | Add each escalation object into service.escalation attribute
:param services: service list, used to look for a specific service
:type services: alignak.objects.service.Services
:return: None | [
"Add",
"each",
"escalation",
"object",
"into",
"service",
".",
"escalation",
"attribute"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/escalation.py#L320-L347 | train |
Alignak-monitoring/alignak | alignak/objects/escalation.py | Escalations.linkify_es_by_h | def linkify_es_by_h(self, hosts):
"""Add each escalation object into host.escalation attribute
:param hosts: host list, used to look for a specific host
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for escal in self:
# If no host, no hope of havi... | python | def linkify_es_by_h(self, hosts):
"""Add each escalation object into host.escalation attribute
:param hosts: host list, used to look for a specific host
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for escal in self:
# If no host, no hope of havi... | [
"def",
"linkify_es_by_h",
"(",
"self",
",",
"hosts",
")",
":",
"for",
"escal",
"in",
"self",
":",
"if",
"(",
"not",
"hasattr",
"(",
"escal",
",",
"'host_name'",
")",
"or",
"escal",
".",
"host_name",
".",
"strip",
"(",
")",
"==",
"''",
"or",
"(",
"h... | Add each escalation object into host.escalation attribute
:param hosts: host list, used to look for a specific host
:type hosts: alignak.objects.host.Hosts
:return: None | [
"Add",
"each",
"escalation",
"object",
"into",
"host",
".",
"escalation",
"attribute"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/escalation.py#L349-L366 | train |
Alignak-monitoring/alignak | alignak/objects/escalation.py | Escalations.explode | def explode(self, hosts, hostgroups, contactgroups):
"""Loop over all escalation and explode hostsgroups in host
and contactgroups in contacts
Call Item.explode_host_groups_into_hosts and Item.explode_contact_groups_into_contacts
:param hosts: host list to explode
:type hosts: ... | python | def explode(self, hosts, hostgroups, contactgroups):
"""Loop over all escalation and explode hostsgroups in host
and contactgroups in contacts
Call Item.explode_host_groups_into_hosts and Item.explode_contact_groups_into_contacts
:param hosts: host list to explode
:type hosts: ... | [
"def",
"explode",
"(",
"self",
",",
"hosts",
",",
"hostgroups",
",",
"contactgroups",
")",
":",
"for",
"i",
"in",
"self",
":",
"self",
".",
"explode_host_groups_into_hosts",
"(",
"i",
",",
"hosts",
",",
"hostgroups",
")",
"self",
".",
"explode_contact_groups... | Loop over all escalation and explode hostsgroups in host
and contactgroups in contacts
Call Item.explode_host_groups_into_hosts and Item.explode_contact_groups_into_contacts
:param hosts: host list to explode
:type hosts: alignak.objects.host.Hosts
:param hostgroups: hostgroup ... | [
"Loop",
"over",
"all",
"escalation",
"and",
"explode",
"hostsgroups",
"in",
"host",
"and",
"contactgroups",
"in",
"contacts"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/escalation.py#L368-L389 | train |
Alignak-monitoring/alignak | alignak/objects/hostgroup.py | Hostgroup.get_hosts_by_explosion | def get_hosts_by_explosion(self, hostgroups):
# pylint: disable=access-member-before-definition
"""
Get hosts of this group
:param hostgroups: Hostgroup object
:type hostgroups: alignak.objects.hostgroup.Hostgroups
:return: list of hosts of this group
:rtype: lis... | python | def get_hosts_by_explosion(self, hostgroups):
# pylint: disable=access-member-before-definition
"""
Get hosts of this group
:param hostgroups: Hostgroup object
:type hostgroups: alignak.objects.hostgroup.Hostgroups
:return: list of hosts of this group
:rtype: lis... | [
"def",
"get_hosts_by_explosion",
"(",
"self",
",",
"hostgroups",
")",
":",
"self",
".",
"already_exploded",
"=",
"True",
"if",
"self",
".",
"rec_tag",
":",
"logger",
".",
"error",
"(",
"\"[hostgroup::%s] got a loop in hostgroup definition\"",
",",
"self",
".",
"ge... | Get hosts of this group
:param hostgroups: Hostgroup object
:type hostgroups: alignak.objects.hostgroup.Hostgroups
:return: list of hosts of this group
:rtype: list | [
"Get",
"hosts",
"of",
"this",
"group"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostgroup.py#L134-L167 | train |
Alignak-monitoring/alignak | alignak/objects/hostgroup.py | Hostgroups.add_member | def add_member(self, host_name, hostgroup_name):
"""Add a host string to a hostgroup member
if the host group do not exist, create it
:param host_name: host name
:type host_name: str
:param hostgroup_name:hostgroup name
:type hostgroup_name: str
:return: None
... | python | def add_member(self, host_name, hostgroup_name):
"""Add a host string to a hostgroup member
if the host group do not exist, create it
:param host_name: host name
:type host_name: str
:param hostgroup_name:hostgroup name
:type hostgroup_name: str
:return: None
... | [
"def",
"add_member",
"(",
"self",
",",
"host_name",
",",
"hostgroup_name",
")",
":",
"hostgroup",
"=",
"self",
".",
"find_by_name",
"(",
"hostgroup_name",
")",
"if",
"not",
"hostgroup",
":",
"hostgroup",
"=",
"Hostgroup",
"(",
"{",
"'hostgroup_name'",
":",
"... | Add a host string to a hostgroup member
if the host group do not exist, create it
:param host_name: host name
:type host_name: str
:param hostgroup_name:hostgroup name
:type hostgroup_name: str
:return: None | [
"Add",
"a",
"host",
"string",
"to",
"a",
"hostgroup",
"member",
"if",
"the",
"host",
"group",
"do",
"not",
"exist",
"create",
"it"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostgroup.py#L178-L195 | train |
Alignak-monitoring/alignak | alignak/objects/hostgroup.py | Hostgroups.linkify | def linkify(self, hosts=None, realms=None, forced_realms_hostgroups=True):
"""Link hostgroups with hosts and realms
:param hosts: all Hosts
:type hosts: alignak.objects.host.Hosts
:param realms: all Realms
:type realms: alignak.objects.realm.Realms
:return: None
... | python | def linkify(self, hosts=None, realms=None, forced_realms_hostgroups=True):
"""Link hostgroups with hosts and realms
:param hosts: all Hosts
:type hosts: alignak.objects.host.Hosts
:param realms: all Realms
:type realms: alignak.objects.realm.Realms
:return: None
... | [
"def",
"linkify",
"(",
"self",
",",
"hosts",
"=",
"None",
",",
"realms",
"=",
"None",
",",
"forced_realms_hostgroups",
"=",
"True",
")",
":",
"self",
".",
"linkify_hostgroups_hosts",
"(",
"hosts",
")",
"self",
".",
"linkify_hostgroups_realms_hosts",
"(",
"real... | Link hostgroups with hosts and realms
:param hosts: all Hosts
:type hosts: alignak.objects.host.Hosts
:param realms: all Realms
:type realms: alignak.objects.realm.Realms
:return: None | [
"Link",
"hostgroups",
"with",
"hosts",
"and",
"realms"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostgroup.py#L210-L220 | train |
Alignak-monitoring/alignak | alignak/objects/hostgroup.py | Hostgroups.linkify_hostgroups_hosts | def linkify_hostgroups_hosts(self, hosts):
"""We just search for each hostgroup the id of the hosts
and replace the names by the found identifiers
:param hosts: object Hosts
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for hostgroup in self:
... | python | def linkify_hostgroups_hosts(self, hosts):
"""We just search for each hostgroup the id of the hosts
and replace the names by the found identifiers
:param hosts: object Hosts
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for hostgroup in self:
... | [
"def",
"linkify_hostgroups_hosts",
"(",
"self",
",",
"hosts",
")",
":",
"for",
"hostgroup",
"in",
"self",
":",
"members",
"=",
"hostgroup",
".",
"get_hosts",
"(",
")",
"new_members",
"=",
"[",
"]",
"for",
"member",
"in",
"members",
":",
"member",
"=",
"m... | We just search for each hostgroup the id of the hosts
and replace the names by the found identifiers
:param hosts: object Hosts
:type hosts: alignak.objects.host.Hosts
:return: None | [
"We",
"just",
"search",
"for",
"each",
"hostgroup",
"the",
"id",
"of",
"the",
"hosts",
"and",
"replace",
"the",
"names",
"by",
"the",
"found",
"identifiers"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostgroup.py#L222-L256 | train |
Alignak-monitoring/alignak | alignak/objects/hostgroup.py | Hostgroups.explode | def explode(self):
"""
Fill members with hostgroup_members
:return: None
"""
# We do not want a same hostgroup to be exploded again and again
# so we tag it
for tmp_hg in list(self.items.values()):
tmp_hg.already_exploded = False
for hostgrou... | python | def explode(self):
"""
Fill members with hostgroup_members
:return: None
"""
# We do not want a same hostgroup to be exploded again and again
# so we tag it
for tmp_hg in list(self.items.values()):
tmp_hg.already_exploded = False
for hostgrou... | [
"def",
"explode",
"(",
"self",
")",
":",
"for",
"tmp_hg",
"in",
"list",
"(",
"self",
".",
"items",
".",
"values",
"(",
")",
")",
":",
"tmp_hg",
".",
"already_exploded",
"=",
"False",
"for",
"hostgroup",
"in",
"list",
"(",
"self",
".",
"items",
".",
... | Fill members with hostgroup_members
:return: None | [
"Fill",
"members",
"with",
"hostgroup_members"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostgroup.py#L380-L405 | train |
Alignak-monitoring/alignak | alignak/http/daemon.py | HTTPDaemon.run | def run(self):
"""Wrapper to start the CherryPy server
This function throws a PortNotFree exception if any socket error is raised.
:return: None
"""
def _started_callback():
"""Callback function when Cherrypy Engine is started"""
cherrypy.log("CherryPy e... | python | def run(self):
"""Wrapper to start the CherryPy server
This function throws a PortNotFree exception if any socket error is raised.
:return: None
"""
def _started_callback():
"""Callback function when Cherrypy Engine is started"""
cherrypy.log("CherryPy e... | [
"def",
"run",
"(",
"self",
")",
":",
"def",
"_started_callback",
"(",
")",
":",
"cherrypy",
".",
"log",
"(",
"\"CherryPy engine started and listening...\"",
")",
"self",
".",
"cherrypy_thread",
"=",
"None",
"try",
":",
"cherrypy",
".",
"log",
"(",
"\"Starting ... | Wrapper to start the CherryPy server
This function throws a PortNotFree exception if any socket error is raised.
:return: None | [
"Wrapper",
"to",
"start",
"the",
"CherryPy",
"server"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/daemon.py#L163-L182 | train |
Alignak-monitoring/alignak | alignak/http/daemon.py | HTTPDaemon.stop | def stop(self): # pylint: disable=no-self-use
"""Wrapper to stop the CherryPy server
:return: None
"""
cherrypy.log("Stopping CherryPy engine (current state: %s)..." % cherrypy.engine.state)
try:
cherrypy.engine.exit()
except RuntimeWarning:
pass... | python | def stop(self): # pylint: disable=no-self-use
"""Wrapper to stop the CherryPy server
:return: None
"""
cherrypy.log("Stopping CherryPy engine (current state: %s)..." % cherrypy.engine.state)
try:
cherrypy.engine.exit()
except RuntimeWarning:
pass... | [
"def",
"stop",
"(",
"self",
")",
":",
"cherrypy",
".",
"log",
"(",
"\"Stopping CherryPy engine (current state: %s)...\"",
"%",
"cherrypy",
".",
"engine",
".",
"state",
")",
"try",
":",
"cherrypy",
".",
"engine",
".",
"exit",
"(",
")",
"except",
"RuntimeWarning... | Wrapper to stop the CherryPy server
:return: None | [
"Wrapper",
"to",
"stop",
"the",
"CherryPy",
"server"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/daemon.py#L184-L196 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.create_queues | def create_queues(self, manager=None):
"""
Create the shared queues that will be used by alignak daemon
process and this module process.
But clear queues if they were already set before recreating new one.
Note:
If manager is None, then we are running the unit tests for ... | python | def create_queues(self, manager=None):
"""
Create the shared queues that will be used by alignak daemon
process and this module process.
But clear queues if they were already set before recreating new one.
Note:
If manager is None, then we are running the unit tests for ... | [
"def",
"create_queues",
"(",
"self",
",",
"manager",
"=",
"None",
")",
":",
"self",
".",
"clear_queues",
"(",
"manager",
")",
"if",
"not",
"manager",
":",
"self",
".",
"from_q",
"=",
"Queue",
"(",
")",
"self",
".",
"to_q",
"=",
"Queue",
"(",
")",
"... | Create the shared queues that will be used by alignak daemon
process and this module process.
But clear queues if they were already set before recreating new one.
Note:
If manager is None, then we are running the unit tests for the modules and
we must create some queues for the ... | [
"Create",
"the",
"shared",
"queues",
"that",
"will",
"be",
"used",
"by",
"alignak",
"daemon",
"process",
"and",
"this",
"module",
"process",
".",
"But",
"clear",
"queues",
"if",
"they",
"were",
"already",
"set",
"before",
"recreating",
"new",
"one",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L189-L210 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.clear_queues | def clear_queues(self, manager):
"""Release the resources associated to the queues of this instance
:param manager: Manager() object
:type manager: None | object
:return: None
"""
for queue in (self.to_q, self.from_q):
if queue is None:
contin... | python | def clear_queues(self, manager):
"""Release the resources associated to the queues of this instance
:param manager: Manager() object
:type manager: None | object
:return: None
"""
for queue in (self.to_q, self.from_q):
if queue is None:
contin... | [
"def",
"clear_queues",
"(",
"self",
",",
"manager",
")",
":",
"for",
"queue",
"in",
"(",
"self",
".",
"to_q",
",",
"self",
".",
"from_q",
")",
":",
"if",
"queue",
"is",
"None",
":",
"continue",
"if",
"not",
"manager",
":",
"try",
":",
"queue",
".",... | Release the resources associated to the queues of this instance
:param manager: Manager() object
:type manager: None | object
:return: None | [
"Release",
"the",
"resources",
"associated",
"to",
"the",
"queues",
"of",
"this",
"instance"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L212-L232 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.start_module | def start_module(self):
"""Wrapper for _main function.
Catch and raise any exception occurring in the main function
:return: None
"""
try:
self._main()
except Exception as exp:
logger.exception('%s', traceback.format_exc())
raise Excep... | python | def start_module(self):
"""Wrapper for _main function.
Catch and raise any exception occurring in the main function
:return: None
"""
try:
self._main()
except Exception as exp:
logger.exception('%s', traceback.format_exc())
raise Excep... | [
"def",
"start_module",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_main",
"(",
")",
"except",
"Exception",
"as",
"exp",
":",
"logger",
".",
"exception",
"(",
"'%s'",
",",
"traceback",
".",
"format_exc",
"(",
")",
")",
"raise",
"Exception",
"(",
... | Wrapper for _main function.
Catch and raise any exception occurring in the main function
:return: None | [
"Wrapper",
"for",
"_main",
"function",
".",
"Catch",
"and",
"raise",
"any",
"exception",
"occurring",
"in",
"the",
"main",
"function"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L234-L244 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.start | def start(self, http_daemon=None): # pylint: disable=unused-argument
"""Actually restart the process if the module is external
Try first to stop the process and create a new Process instance
with target start_module.
Finally start process.
:param http_daemon: Not used here but ... | python | def start(self, http_daemon=None): # pylint: disable=unused-argument
"""Actually restart the process if the module is external
Try first to stop the process and create a new Process instance
with target start_module.
Finally start process.
:param http_daemon: Not used here but ... | [
"def",
"start",
"(",
"self",
",",
"http_daemon",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_external",
":",
"return",
"if",
"self",
".",
"process",
":",
"self",
".",
"stop_process",
"(",
")",
"logger",
".",
"info",
"(",
"\"Starting external pro... | Actually restart the process if the module is external
Try first to stop the process and create a new Process instance
with target start_module.
Finally start process.
:param http_daemon: Not used here but can be used in other modules
:type http_daemon: None | object
:re... | [
"Actually",
"restart",
"the",
"process",
"if",
"the",
"module",
"is",
"external",
"Try",
"first",
"to",
"stop",
"the",
"process",
"and",
"create",
"a",
"new",
"Process",
"instance",
"with",
"target",
"start_module",
".",
"Finally",
"start",
"process",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L246-L276 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.stop_process | def stop_process(self):
"""Request the module process to stop and release it
:return: None
"""
if not self.process:
return
logger.info("I'm stopping module %r (pid=%d)", self.name, self.process.pid)
self.kill()
# Clean inner process reference
... | python | def stop_process(self):
"""Request the module process to stop and release it
:return: None
"""
if not self.process:
return
logger.info("I'm stopping module %r (pid=%d)", self.name, self.process.pid)
self.kill()
# Clean inner process reference
... | [
"def",
"stop_process",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"process",
":",
"return",
"logger",
".",
"info",
"(",
"\"I'm stopping module %r (pid=%d)\"",
",",
"self",
".",
"name",
",",
"self",
".",
"process",
".",
"pid",
")",
"self",
".",
"kil... | Request the module process to stop and release it
:return: None | [
"Request",
"the",
"module",
"process",
"to",
"stop",
"and",
"release",
"it"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L303-L314 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.manage_brok | def manage_brok(self, brok):
"""Request the module to manage the given brok.
There are a lot of different possible broks to manage. The list is defined
in the Brok class.
An internal module may redefine this function or, easier, define only the function
for the brok it is intere... | python | def manage_brok(self, brok):
"""Request the module to manage the given brok.
There are a lot of different possible broks to manage. The list is defined
in the Brok class.
An internal module may redefine this function or, easier, define only the function
for the brok it is intere... | [
"def",
"manage_brok",
"(",
"self",
",",
"brok",
")",
":",
"manage",
"=",
"getattr",
"(",
"self",
",",
"'manage_'",
"+",
"brok",
".",
"type",
"+",
"'_brok'",
",",
"None",
")",
"if",
"not",
"manage",
":",
"return",
"False",
"brok",
".",
"prepare",
"(",... | Request the module to manage the given brok.
There are a lot of different possible broks to manage. The list is defined
in the Brok class.
An internal module may redefine this function or, easier, define only the function
for the brok it is interested with. Hence a module interested in ... | [
"Request",
"the",
"module",
"to",
"manage",
"the",
"given",
"brok",
".",
"There",
"are",
"a",
"lot",
"of",
"different",
"possible",
"broks",
"to",
"manage",
".",
"The",
"list",
"is",
"defined",
"in",
"the",
"Brok",
"class",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L327-L348 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule.manage_signal | def manage_signal(self, sig, frame): # pylint: disable=unused-argument
"""Generic function to handle signals
Only called when the module process received SIGINT or SIGKILL.
Set interrupted attribute to True, self.process to None and returns
:param sig: signal sent
:type sig:
... | python | def manage_signal(self, sig, frame): # pylint: disable=unused-argument
"""Generic function to handle signals
Only called when the module process received SIGINT or SIGKILL.
Set interrupted attribute to True, self.process to None and returns
:param sig: signal sent
:type sig:
... | [
"def",
"manage_signal",
"(",
"self",
",",
"sig",
",",
"frame",
")",
":",
"logger",
".",
"info",
"(",
"\"received a signal: %s\"",
",",
"SIGNALS_TO_NAMES_DICT",
"[",
"sig",
"]",
")",
"if",
"sig",
"==",
"signal",
".",
"SIGHUP",
":",
"logger",
".",
"info",
... | Generic function to handle signals
Only called when the module process received SIGINT or SIGKILL.
Set interrupted attribute to True, self.process to None and returns
:param sig: signal sent
:type sig:
:param frame: frame before catching signal
:type frame:
:re... | [
"Generic",
"function",
"to",
"handle",
"signals"
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L350-L371 | train |
Alignak-monitoring/alignak | alignak/basemodule.py | BaseModule._main | def _main(self):
"""module "main" method. Only used by external modules.
:return: None
"""
self.set_proctitle(self.name)
self.set_signal_handler()
logger.info("process for module %s is now running (pid=%d)", self.name, os.getpid())
# Will block here!
tr... | python | def _main(self):
"""module "main" method. Only used by external modules.
:return: None
"""
self.set_proctitle(self.name)
self.set_signal_handler()
logger.info("process for module %s is now running (pid=%d)", self.name, os.getpid())
# Will block here!
tr... | [
"def",
"_main",
"(",
"self",
")",
":",
"self",
".",
"set_proctitle",
"(",
"self",
".",
"name",
")",
"self",
".",
"set_signal_handler",
"(",
")",
"logger",
".",
"info",
"(",
"\"process for module %s is now running (pid=%d)\"",
",",
"self",
".",
"name",
",",
"... | module "main" method. Only used by external modules.
:return: None | [
"module",
"main",
"method",
".",
"Only",
"used",
"by",
"external",
"modules",
"."
] | f3c145207e83159b799d3714e4241399c7740a64 | https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/basemodule.py#L435-L457 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.