Added dynamic loading of notifications and services, refactoring and lot of fixes.

This commit is contained in:
Johannes Findeisen 2022-09-27 06:07:55 +02:00
commit a0892d0980
57 changed files with 146 additions and 272 deletions

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -31,7 +31,7 @@ logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed. do this only for
# options in the "monipy" section of monipy.ini.
# options in the "linspector" section of linspector.ini.
class Configuration:
def __init__(self, configuration_path, environment):
@ -57,7 +57,7 @@ class Configuration:
section_list = glob.glob(configuration_path + '/' + target_section + '/*.ini')
for section_file in section_list:
#print("-->"+section_file)
#print(__file__ + ' (60): ' + section_file)
configuration = configparser.ConfigParser()
configuration.read(section_file, 'utf-8')
for source_section in configuration.sections():

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -34,9 +34,10 @@ class Linspector:
self.__monitors = monitors
# this function is just for testing purposes and can be removed some day
def print_monitors_monitor_identifiers(self):
def print_debug(self):
# example on how to access the monitor objects in monitors
monitors = self.__monitors.get_monitors()
#print(monitors)
print(__file__ + ' (40): ' + str(monitors))
for monitor in monitors:
print(monitors.get(monitor).get_identifier())
print(__file__ + ' (42): ' + monitors.get(monitor).get_identifier())
print(__file__ + ' (43): ' + monitors.get(monitor).get_service())

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -21,9 +21,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from linspector.core.notifications import Notifications
from linspector.core.service import Service
from linspector.core.services import Services
import importlib
from logging import getLogger
logger = getLogger('linspector')
@ -40,5 +39,52 @@ class Monitor:
self.__notifications = notifications
self.__services = services
#print(__file__ + ' (42): ' + str(monitor_configuration))
if self.__monitor_configuration.get('monitor', 'service'):
# TODO: the exception handling later!!!
#try:
service_package = 'linspector.services.' + \
self.__monitor_configuration.get('monitor', 'service').lower()
service_module = importlib.import_module(service_package)
service = getattr(service_module, self.__monitor_configuration.get('monitor', 'service') +
'Service')
service.__init__(self, configuration, environment)
if self.__monitor_configuration.get('monitor', 'service') not in services:
services[self.__monitor_configuration.get('monitor', 'service')] = service
#print(__file__ + ' (57): ' + str(services))
#else:
# do some logging
#except ModuleNotFoundError as err:
# raise Exception('something went wrong when initializing a service. you are '
# 'using an unknown service in your monitor configuration '
# 'identified by: ' + identifier + '({0})'.format(err))
#service.execute(self)
if self.__monitor_configuration.get('monitor', 'notifications'):
for notification_option in self.__monitor_configuration.get('monitor',
'notifications').split(','):
#print(__file__ + ' (72): ' + str(notification_option))
notification_package = 'linspector.notifications.' + notification_option.lower()
notification_module = importlib.import_module(notification_package)
notification = getattr(notification_module, notification_option + 'Notification')
notification.__init__(self, configuration, environment)
if notification_option not in notifications:
notifications[notification_option] = notification
#print(__file__ + ' (81): ' + str(notifications))
def get_identifier(self):
return self.__identifier
# 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.__monitor_configuration.get('monitor', 'service')

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
import configparser
import copy
import glob
import os
@ -43,21 +44,23 @@ class Monitors:
self.__monitors = {}
monitor_groups = os.listdir(self.__configuration.get_configuration_path() + '/monitors/')
print(monitor_groups)
#print(__file__ + ' (47): ' + str(monitor_groups))
monitor_configuration = configparser.ConfigParser()
for monitor_group in monitor_groups:
monitors_file_list = glob.glob(self.__configuration.get_configuration_path() +
'/monitors/' + monitor_group + '/*.ini')
for monitor_file in monitors_file_list:
monitor_configuration = configparser.ConfigParser()
monitor_configuration.read(monitor_file, 'utf-8')
identifier = monitor_group + '_' + os.path.splitext(os.path.basename(
monitor_file))[0]
# create Monitor() object and copy monitor_configuration for each instance because
# they else refer to the same object.
self.__monitors[identifier] = Monitor(configuration, environment, identifier,
monitor_configuration, notifications,
services)
copy.deepcopy(monitor_configuration),
notifications, services)
def get_monitors(self):
return self.__monitors

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,33 +0,0 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
logger = getLogger('linspector')
class Service:
def __init__(self, configuration, environment):
self.__configuration = configuration
self.__environment = environment

View file

@ -1,34 +0,0 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
logger = getLogger('linspector')
class Services:
def __init__(self, configuration, environment):
super().__init__()
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,14 +22,12 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.notifications.notification import Notification
logger = getLogger('linspector')
class CallNotification(Notification):
class CallNotification:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,14 +22,12 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.notifications.notification import Notification
logger = getLogger('linspector')
class EmailNotification(Notification):
class EmailNotification:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,14 +22,12 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.notifications.notification import Notification
logger = getLogger('linspector')
class SMSNotification(Notification):
class SMSNotification:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,14 +22,12 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.notifications.notification import Notification
logger = getLogger('linspector')
class TwitterNotification(Notification):
class TwitterNotification:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,14 +22,12 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.notifications.notification import Notification
logger = getLogger('linspector')
class XMPPNotification(Notification):
class XMPPNotification:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class DummyService(Service):
class DummyService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,16 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class FritzboxService(Service):
class FritzboxUplinkService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment
def execute(self):
print(__file__ + ' (37): ' + 'test...')

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class HTTPKeywordService(Service):
class HTTPKeywordService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class PingService(Service):
class PingService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class PortService(Service):
class PortService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class RandomService(Service):
class RandomService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class ShellService(Service):
class ShellService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class SNMPGetService(Service):
class SNMPGetService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -27,17 +27,13 @@ import time
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class SpeedtestService(Service):
class SpeedtestService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class SSHService(Service):
class SSHService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class TCPConnectService(Service):
class TCPConnectService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,15 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.services.service import Service
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class UptimeService(Service):
class UptimeService:
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,13 +22,13 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.tasks.task import Task
from linspector.core.task import Task
logger = getLogger('linspector')
# TODO: check for all required configuration options and set defaults if needed.
class LoggerTask(Task):
class FileLoggerTask(Task):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.tasks.task import Task
from linspector.core.task import Task
logger = getLogger('linspector')

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.tasks.task import Task
from linspector.core.task import Task
logger = getLogger('linspector')

View file

@ -1,6 +1,6 @@
"""
This file is part of Linspector (https://linspector.org/)
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from logging import getLogger
from linspector.tasks.task import Task
from linspector.core.task import Task
logger = getLogger('linspector')