Backup commit. Many internally changes. Known issues still need to be fixed.
This commit is contained in:
parent
8808b657c4
commit
ee423c01bb
22 changed files with 122 additions and 85 deletions
1
TODO.txt
1
TODO.txt
|
|
@ -11,3 +11,4 @@ Things to do in no particular order:
|
||||||
- Add more tasks e.g. storage in mongodb or mariadb and some more notifications like XMPP and SMS
|
- Add more tasks e.g. storage in mongodb or mariadb and some more notifications like XMPP and SMS
|
||||||
- Check for all required configuration options and set defaults in services.
|
- Check for all required configuration options and set defaults in services.
|
||||||
- Write documentation and inline documentation.
|
- Write documentation and inline documentation.
|
||||||
|
- Add kwargs ro notifications, tasks and maybe plugins.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ from linspector.core.environment import Environment
|
||||||
from linspector.core.linspector import Linspector
|
from linspector.core.linspector import Linspector
|
||||||
from linspector.core.monitors import Monitors
|
from linspector.core.monitors import Monitors
|
||||||
|
|
||||||
__version__ = '0.19.11.dev1'
|
__version__ = '0.19.12.dev1'
|
||||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||||
|
|
||||||
logger = logging.getLogger('linspector')
|
logger = logging.getLogger('linspector')
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ members = superadmin@example.com,developers@example.com
|
||||||
; scheduler configuration
|
; scheduler configuration
|
||||||
start_scheduler = true
|
start_scheduler = true
|
||||||
max_threads = 3500
|
max_threads = 3500
|
||||||
max_processes = 10
|
max_processes = 24
|
||||||
timezone = CET
|
timezone = CET
|
||||||
|
|
||||||
; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO.txt for more
|
; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO.txt for more
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,17 @@ tasks = redis
|
||||||
; internally to single hosts to become a monitor for each host internally. some more ideas are in ;)
|
; internally to single hosts to become a monitor for each host internally. some more ideas are in ;)
|
||||||
; hosts with added hostgroup defined in main configuration file
|
; hosts with added hostgroup defined in main configuration file
|
||||||
hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1
|
hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1
|
||||||
|
; monitors can add their self into a hostgroup
|
||||||
hostgroup = group1
|
hostgroup = group1
|
||||||
user = USERNAME
|
user = USERNAME
|
||||||
password = PASSWORD
|
password = PASSWORD
|
||||||
info = Cable Provider
|
info = Cable Provider
|
||||||
; only alert when the error reaches the threshold
|
; only alert when the error reaches the threshold
|
||||||
threshold = 3
|
threshold = 3
|
||||||
|
|
||||||
|
; need to think about it but since Linspector does not know variables defined by a service, notification or task they
|
||||||
|
; need to be handed over as **kwargs dict. so i think it would be a good idea to put them here and just give over all
|
||||||
|
; these vars as a dict. for now only interval and service are know and even required arguments to get a service running.
|
||||||
|
[args]
|
||||||
|
foo = bar
|
||||||
|
bar = foo
|
||||||
|
|
@ -10,3 +10,7 @@ hosts = 192.168.1.1
|
||||||
user = USERNAME
|
user = USERNAME
|
||||||
password = PASSWORD
|
password = PASSWORD
|
||||||
info = Cable Provider
|
info = Cable Provider
|
||||||
|
|
||||||
|
[args]
|
||||||
|
foo = bary
|
||||||
|
bar = fooy
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
[monitor]
|
[monitor]
|
||||||
service = misc.dummy
|
service = misc.dummy
|
||||||
interval = 1
|
interval = 60
|
||||||
|
|
||||||
|
[args]
|
||||||
|
foo = barx
|
||||||
|
bar = foox
|
||||||
|
|
@ -46,10 +46,10 @@ class Linspector:
|
||||||
'memory': MemoryJobStore()
|
'memory': MemoryJobStore()
|
||||||
}
|
}
|
||||||
executors = {
|
executors = {
|
||||||
#'default': ThreadPoolExecutor(int(configuration.get_option('linspector',
|
'default': ThreadPoolExecutor(int(configuration.get_option('linspector',
|
||||||
# 'max_threads'))),
|
'max_threads'))),
|
||||||
'default': ProcessPoolExecutor(int(configuration.get_option('linspector',
|
#'default': ProcessPoolExecutor(int(configuration.get_option('linspector',
|
||||||
'max_processes')))
|
# 'max_processes')))
|
||||||
}
|
}
|
||||||
job_defaults = {
|
job_defaults = {
|
||||||
'max_instances': 10000
|
'max_instances': 10000
|
||||||
|
|
@ -59,7 +59,7 @@ class Linspector:
|
||||||
job_defaults=job_defaults)
|
job_defaults=job_defaults)
|
||||||
|
|
||||||
start_date = datetime.datetime.now()
|
start_date = datetime.datetime.now()
|
||||||
log('debug', __name__, monitors.get_monitors())
|
#log('debug', __name__, monitors.get_monitors())
|
||||||
monitors = self.__monitors.get_monitors()
|
monitors = self.__monitors.get_monitors()
|
||||||
for monitor in monitors:
|
for monitor in monitors:
|
||||||
time_delta = round(random.uniform(1.00, 10.00), 2)
|
time_delta = round(random.uniform(1.00, 10.00), 2)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ from linspector.core.task import Task, TaskExecutor
|
||||||
class Monitor:
|
class Monitor:
|
||||||
|
|
||||||
def __init__(self, configuration, environment, identifier, monitor_configuration, notifications,
|
def __init__(self, configuration, environment, identifier, monitor_configuration, notifications,
|
||||||
services, tasks):
|
services, tasks, kwargs):
|
||||||
|
self.__args = kwargs
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
self.__identifier = identifier
|
self.__identifier = identifier
|
||||||
|
|
@ -29,7 +30,7 @@ class Monitor:
|
||||||
self.__tasks = tasks
|
self.__tasks = tasks
|
||||||
|
|
||||||
self.service = self.__service
|
self.service = self.__service
|
||||||
self.host = monitor_configuration.get('monitor', 'host')
|
#self.host = monitor_configuration.get('monitor', 'host')
|
||||||
#self.members = members
|
#self.members = members
|
||||||
#self.core = core
|
#self.core = core
|
||||||
self.hostgroup = monitor_configuration.get('monitor', 'hostgroup')
|
self.hostgroup = monitor_configuration.get('monitor', 'hostgroup')
|
||||||
|
|
@ -48,8 +49,9 @@ class Monitor:
|
||||||
"""
|
"""
|
||||||
self.status = "NONE"
|
self.status = "NONE"
|
||||||
self.last_execution = None
|
self.last_execution = None
|
||||||
self.monitor_information = MonitorInformation(self.job_id, self.hostgroup, self.host,
|
#self.monitor_information = MonitorInformation(self.job_id, self.hostgroup, self.host,
|
||||||
self.service)
|
# self.service)
|
||||||
|
self.monitor_information = MonitorInformation(self.job_id, self.service)
|
||||||
|
|
||||||
if configuration.get_option('linspector', 'notifications') or \
|
if configuration.get_option('linspector', 'notifications') or \
|
||||||
monitor_configuration.get('monitor', 'notifications'):
|
monitor_configuration.get('monitor', 'notifications'):
|
||||||
|
|
@ -83,10 +85,8 @@ class Monitor:
|
||||||
|
|
||||||
service_module = importlib.import_module(service_package)
|
service_module = importlib.import_module(service_package)
|
||||||
self.__service = monitor_configuration.get('monitor', 'service').lower()
|
self.__service = monitor_configuration.get('monitor', 'service').lower()
|
||||||
service = service_module.create(configuration, environment)
|
service = service_module.create(configuration, environment, **self.__args)
|
||||||
services[monitor_configuration.get('monitor', 'service').lower()] = service
|
self.__services[monitor_configuration.get('monitor', 'service').lower()] = service
|
||||||
|
|
||||||
#service.execute(self)
|
|
||||||
|
|
||||||
if configuration.get_option('linspector', 'tasks') or \
|
if configuration.get_option('linspector', 'tasks') or \
|
||||||
monitor_configuration.get('monitor', 'tasks'):
|
monitor_configuration.get('monitor', 'tasks'):
|
||||||
|
|
@ -121,17 +121,11 @@ class Monitor:
|
||||||
def get_service(self):
|
def get_service(self):
|
||||||
return self.__service
|
return self.__service
|
||||||
|
|
||||||
# currently only used for testing but maybe i will add get functions for all known variables.
|
|
||||||
# but not all variables can be known because all monitors are different. only the service
|
|
||||||
# implementation can know all variables which are being used inside the service.
|
|
||||||
def get_service(self):
|
|
||||||
return self.__service
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.__dict__)
|
return str(self.__dict__)
|
||||||
|
|
||||||
def __hex__(self):
|
def __hex__(self):
|
||||||
return hex(crc32(bytes(self.hostgroup + self.host + self.service, 'utf-8')))
|
return hex(crc32(bytes(self.hostgroup + self.service, 'utf-8')))
|
||||||
|
|
||||||
def hex_string(self):
|
def hex_string(self):
|
||||||
ret = self.__hex__()
|
ret = self.__hex__()
|
||||||
|
|
@ -186,6 +180,7 @@ class Monitor:
|
||||||
|
|
||||||
def handle_call(self):
|
def handle_call(self):
|
||||||
log('info', __name__, "handle call to identifier: " + self.__identifier)
|
log('info', __name__, "handle call to identifier: " + self.__identifier)
|
||||||
|
self.__services[self.__service].execute()
|
||||||
#logger.debug("handle call")
|
#logger.debug("handle call")
|
||||||
#logger.debug(self.service)
|
#logger.debug(self.service)
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
|
|
@ -201,7 +196,8 @@ class Monitor:
|
||||||
self.handle_threshold(self.service.get_threshold(),
|
self.handle_threshold(self.service.get_threshold(),
|
||||||
self.last_execution.was_successful())
|
self.last_execution.was_successful())
|
||||||
|
|
||||||
#logger.info("Job " + self.get_job_id() +
|
log('info', __name__, 'sadasd')
|
||||||
|
#log.info("Job " + self.get_job_id() +
|
||||||
# ", Code: " + str(self.last_execution.get_error_code()) +
|
# ", Code: " + str(self.last_execution.get_error_code()) +
|
||||||
# ", Message: " + str(self.last_execution.get_message()))
|
# ", Message: " + str(self.last_execution.get_message()))
|
||||||
|
|
||||||
|
|
@ -212,8 +208,8 @@ class Monitor:
|
||||||
else:
|
else:
|
||||||
log('info', __name__, "job " + self.get_job_id() + " disabled")
|
log('info', __name__, "job " + self.get_job_id() + " disabled")
|
||||||
|
|
||||||
def get_host(self):
|
#def get_host(self):
|
||||||
return self.host
|
# return self.host
|
||||||
|
|
||||||
def get_hostgroup(self):
|
def get_hostgroup(self):
|
||||||
return self.hostgroup
|
return self.hostgroup
|
||||||
|
|
@ -262,10 +258,10 @@ class MonitorExecution:
|
||||||
|
|
||||||
|
|
||||||
class MonitorInformation:
|
class MonitorInformation:
|
||||||
def __init__(self, job_id, hostgroup, host, service):
|
def __init__(self, job_id, service):
|
||||||
self.job_id = job_id
|
self.job_id = job_id
|
||||||
self.hostgroup = hostgroup
|
#self.hostgroup = hostgroup
|
||||||
self.host = host
|
#self.host = host
|
||||||
self.service = service
|
self.service = service
|
||||||
|
|
||||||
self.response_massage = None
|
self.response_massage = None
|
||||||
|
|
|
||||||
|
|
@ -26,20 +26,32 @@ class Monitors:
|
||||||
log('debug', __name__, 'monitor groups: ' + str(monitor_groups))
|
log('debug', __name__, 'monitor groups: ' + str(monitor_groups))
|
||||||
monitor_configuration = configparser.ConfigParser()
|
monitor_configuration = configparser.ConfigParser()
|
||||||
for monitor_group in monitor_groups:
|
for monitor_group in monitor_groups:
|
||||||
|
|
||||||
monitors_file_list = glob.glob(self.__configuration.get_configuration_path() +
|
monitors_file_list = glob.glob(self.__configuration.get_configuration_path() +
|
||||||
'/monitors/' + monitor_group + '/*.conf')
|
'/monitors/' + monitor_group + '/*.conf')
|
||||||
log('debug', __name__, 'monitor files: ' + str(monitors_file_list))
|
#log('debug', __name__, 'monitor files: ' + str(monitors_file_list))
|
||||||
for monitor_file in monitors_file_list:
|
for monitor_file in monitors_file_list:
|
||||||
monitor_configuration.read(monitor_file, 'utf-8')
|
monitor_configuration.read(monitor_file, 'utf-8')
|
||||||
|
|
||||||
|
kwargs = {}
|
||||||
|
for option in monitor_configuration.options('args'):
|
||||||
|
#print(option)
|
||||||
|
value = monitor_configuration.get('args', option)
|
||||||
|
kwargs[option] = value
|
||||||
|
|
||||||
|
print(monitor_group + ' ' + str(kwargs))
|
||||||
|
|
||||||
identifier = monitor_group + '_' + os.path.splitext(os.path.basename(
|
identifier = monitor_group + '_' + os.path.splitext(os.path.basename(
|
||||||
monitor_file))[0]
|
monitor_file))[0]
|
||||||
|
|
||||||
# create Monitor() object and copy monitor_configuration for each instance because
|
# create Monitor() object and copy monitor_configuration for each instance because
|
||||||
# they else refer to the same object.
|
# they else refer to the same object.
|
||||||
self.__monitors[identifier] = copy.deepcopy(Monitor(configuration, environment, identifier,
|
self.__monitors[identifier] = Monitor(configuration, environment, identifier,
|
||||||
copy.deepcopy(monitor_configuration),
|
copy.deepcopy(monitor_configuration),
|
||||||
notifications, services, tasks))
|
notifications, services, tasks,
|
||||||
|
copy.deepcopy(kwargs))
|
||||||
|
|
||||||
|
del kwargs
|
||||||
|
|
||||||
def get_monitors(self):
|
def get_monitors(self):
|
||||||
return self.__monitors
|
return self.__monitors
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from linspector.core.helpers import log
|
||||||
|
|
||||||
class Service:
|
class Service:
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__()
|
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self._environment = environment
|
self._environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return HTTPKeywordService(configuration, environment)
|
return HTTPKeywordService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class HTTPKeywordService(Service):
|
class HTTPKeywordService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,18 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return DummyService(configuration, environment)
|
return DummyService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class DummyService(Service):
|
class DummyService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
log('debug', __name__, 'dummy object @' + str(self))
|
log('debug', __name__, 'dummy object @' + str(self) + str(self.__kwargs['foo']))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return RandomService(configuration, environment)
|
return RandomService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class RandomService(Service):
|
class RandomService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,18 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return FritzboxUplinkService(configuration, environment)
|
return FritzboxUplinkService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class FritzboxUplinkService(Service):
|
class FritzboxUplinkService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
print('huhu')
|
log('debug', __name__, 'dummy object @' + str(self))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return PingService(configuration, environment)
|
return PingService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class PingService(Service):
|
class PingService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return PortService(configuration, environment)
|
return PortService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class PortService(Service):
|
class PortService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self, execution):
|
def execute(self, execution):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return SpeedtestService(configuration, environment)
|
return SpeedtestService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class SpeedtestService(Service):
|
class SpeedtestService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
self.__speedtest_maximum_speed = None
|
self.__speedtest_maximum_speed = None
|
||||||
self.__speedtest_average_speed = None
|
self.__speedtest_average_speed = None
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return SSHService(configuration, environment)
|
return SSHService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class SSHService(Service):
|
class SSHService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
path = os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')
|
path = os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,18 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return TCPConnectService(configuration, environment)
|
return TCPConnectService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
# TODO: check for all required configuration options and set defaults if needed.
|
# TODO: check for all required configuration options and set defaults if needed.
|
||||||
class TCPConnectService(Service):
|
class TCPConnectService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return GetService(configuration, environment)
|
return GetService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class GetService(Service):
|
class GetService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def create(configuration, environment):
|
def create(configuration, environment, **kwargs):
|
||||||
return ShellService(configuration, environment)
|
return ShellService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class ShellService(Service):
|
class ShellService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ from linspector.core.helpers import log
|
||||||
from linspector.core.service import Service
|
from linspector.core.service import Service
|
||||||
|
|
||||||
|
|
||||||
def get(configuration, environment):
|
def get(configuration, environment, **kwargs):
|
||||||
return UptimeService(configuration, environment)
|
return UptimeService(configuration, environment, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class UptimeService(Service):
|
class UptimeService(Service):
|
||||||
|
|
||||||
def __init__(self, configuration, environment):
|
def __init__(self, configuration, environment, **kwargs):
|
||||||
super().__init__(configuration, environment)
|
super().__init__(configuration, environment, **kwargs)
|
||||||
self.__configuration = configuration
|
self.__configuration = configuration
|
||||||
self.__environment = environment
|
self.__environment = environment
|
||||||
|
self.__kwargs = kwargs
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue