Some more logging stuff.

This commit is contained in:
Johannes Findeisen 2022-10-06 05:05:41 +02:00
commit 5d99640480
3 changed files with 19 additions and 6 deletions

View file

@ -37,7 +37,7 @@ logger = logging.getLogger('linspector')
# i currently only increase the 3rd number because the goal is that 0.20.* will become the first
# stable version.
__version__ = '0.19.33.dev1'
__version__ = '0.19.34.dev1'
__author__ = 'Johannes Findeisen <you@hanez.org>'

View file

@ -1,7 +1,7 @@
; required options:
[monitor]
; The description must not but should be a unique description of the monitor for better identifying it in the database
; if a data storage tasks is being used.
; The description must not but should be a unique description of the monitor for better identifying it in the datastore
; if a task is being used.
description = Cable Provider
service = net.fritzboxuplink
hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1

View file

@ -29,19 +29,32 @@ class Monitor:
str(err))
try:
self.__interval = int(configuration.get_option('linspector', 'default_interval'))
log('warning', 'set default_interval as per configuration to core with '
'identifier ' + identifier + ' to: ' + str(self.__interval))
log('warning', 'set default_interval as per core configuration with '
'identifier: ' + identifier + ' to: ' + str(self.__interval))
except Exception as err:
log('warning', 'no default_interval found in core configuration for identifier ' +
identifier + ', set to default interval 300 seconds. error: ' + str(err))
# default interval is 300 seconds (5 minutes) if not set in the monitor
# configuration args or a default_interval in the core configuration.
self.__interval = 300
self.__log = log
self.__monitor_configuration = monitor_configuration
self.__notification_list = []
self.__notifications = notifications
self.__service = monitor_configuration.get('monitor', 'service')
try:
self.__service = monitor_configuration.get('monitor', 'service')
except Exception as err:
# if no service is set in the monitor configuration, the service is set to misc.dummy
# instead. just to make Linspector run but with no real result.
log('debug', 'no service set for identifier: ' + identifier + ' setting to '
'misc.dummy as '
'default to ensure '
'Linspector will run. '
'error: ' + str(err))
self.__service = 'misc.dummy'
self.__services = services
self.__task_list = [] # put tasks for the dedicated job here.
self.__tasks = tasks