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

@ -2,7 +2,7 @@
"""
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
@ -23,6 +23,10 @@ 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.
"""
# TODO: implement error handling at all needed places! currently nearly no error handling is done!
# TODO: make use of the logger wherever it us useful! and be verbose when information really helps
# debugging the application!
import argparse
import sys
@ -58,22 +62,26 @@ def main():
args = parse_args()
environment = Environment()
monitors = None
notifications = {}
services = {}
try:
configuration = Configuration(args.configuration_path, environment)
# configuration.dump_to_ini()
#configuration.dump_to_ini()
except Exception as err:
logger.error(str('[uplink] configuration error: {0}'.format(err)))
logger.error(str('[linspector] configuration error: {0}'.format(err)))
sys.exit(1)
monitors = Monitors(configuration, environment, notifications, services)
try:
monitors = Monitors(configuration, environment, notifications, services)
except Exception as err:
logger.warning('[linspector] monitor initialization error: {0}'.format(err))
linspector = Linspector(configuration, environment, monitors)
#linspector.print_monitors_monitor_identifiers()
#linspector.print_debug()
# so, if Linspector should start in Daemon mode, do thi here...
# so, if Linspector should start in Daemon mode, do it here...
#Linspectord(configuration, environment, linspector).execute()

View file

@ -1,43 +0,0 @@
; all you need to know: https://docs.python.org/3/library/configparser.html ... ;)
[linspector]
; report core errors to the following users
error_receivers = admin@example.com
log_file = ~/code/linspector/log/linspector.log
log_level= verbose
log_count = 5
log_size = 10485760
pid_file = /var/run/user/1000/linspector.pid
; default delimiters '=' and ':' should be changed to ',' to be more native
plugins = HTTPServer
tasks = MariaDB:Logger
; maybe the run_mode is obsolete because this will be a daemon but maybe it is useful for one time execution?
; in uplink the available run_modes were cron, daemon and foreground
run_mode = cron
; every notification can be configured in it's own ini file in etc/notifications; there no notification name as prefix
; is needed. see email example.
[notifications]
; values can be overridden in each defined monitor
sms_receivers = +number1:+number2
sms_configuration_file = ~/linspector/etc/gammurc
; retry to send interval and number of retries if something failed
sms_resend = 10
sms_resend_count = 5
email_resend = 10
; every plugin can be configured in it's own ini file in etc/plugins; there no plugin name as prefix is needed. see
; httpserver example.
[plugins]
; if types can or must be configured before use; for now no use case seen.
; every type can be configured in it's own ini file in etc/types; there no type name as prefix is not needed.
[services]
speedtest_interval = 3600
speedtest_url = https://go.microsoft.com/fwlink/?Linkid=850641
[tasks]
mariadb_database = linspector
mariadb_host = 10.0.0.254
mariadb_password = PASSWORD
mariadb_port": 3306
mariadb_user = USER

View file

@ -1,17 +0,0 @@
[main]
; identifiers must be unique in the whole configuration so maybe it is better to create a random string for this
; dynamically. identifiers should maybe a checksum of some options so they will not change when small changes to
; the configurations changes and will remain even when doing a fresh install.
identifier = cable
service = Fritzbox
interval = 60
# default delimiters '=' and ':' should be changed to ',' to be more native
notifications = SMS:Email
; values from main configuration can be overridden for each defined monitor
email_receivers = admin@example.com:fallback@example.com
sms_receivers = +329084320984:+39804932409
tasks = None
host = 192.168.0.1
user = USERNAME
password = PASSWORD
info = Cable Provider

View file

@ -1,13 +0,0 @@
[main]
identifier = dsl
service = Fritzbox
interval = 60
# default delimiters '=' and ':' should be changed to ',' to be more native
notifications = SMS:Email
email_receivers = admin@example.com:fallback@example.com
sms_receivers = +329084320984:+39804932409
tasks = MariaDB:Logger:Redis
host = 192.168.1.1
user = USERNAME
password = PASSWORD
info = Cable Provider

View file

@ -1,7 +0,0 @@
[email]
resend = 20
smtp_host = mail.example.com
smtp_port = 25
smtp_password = PASSWORD
smtp_user = alerts@example.com
receivers = admin@example.com

View file

@ -1,3 +0,0 @@
[httpserver]
ip = 127.0.0.1
port = 4242

View file

@ -9,7 +9,7 @@ log_size = 10485760
pid_file = /var/run/user/1000/linspector.pid
; default delimiters '=' and ':' should be changed to ',' to be more native
plugins = HTTPServer
tasks = MariaDB:Logger
tasks = MariaDB,Logger
; maybe the run_mode is obsolete because this will be a daemon but maybe it is useful for one time execution?
; in uplink the available run_modes were cron, daemon and foreground
run_mode = cron

View file

@ -1,8 +1,7 @@
[main]
service = Fritzbox
[monitor]
service = FritzboxUplink
interval = 60
# default delimiters '=' and ':' should be changed to ',' to be more native
notifications = SMS:Email
notifications = SMS,Email
; values from main configuration can be overridden for each defined monitor
email_receivers = admin@example.com:fallback@example.com
sms_receivers = +329084320984:+39804932409

View file

@ -1,9 +1,9 @@
[main]
[monitor]
identifier = dsl
service = Fritzbox
service = FritzboxUplink
interval = 60
# default delimiters '=' and ':' should be changed to ',' to be more native
notifications = SMS:Email
notifications = SMS,Email
email_receivers = admin@example.com:fallback@example.com
sms_receivers = +329084320984:+39804932409
tasks = MariaDB:Logger:Redis

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')