Lot of bug fixing, optimizations and refactoring.
This commit is contained in:
parent
ee423c01bb
commit
549510c3a4
19 changed files with 145 additions and 91 deletions
|
|
@ -24,13 +24,16 @@ class Monitors:
|
|||
|
||||
monitor_groups = os.listdir(self.__configuration.get_configuration_path() + '/monitors/')
|
||||
log('debug', __name__, 'monitor groups: ' + 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 + '/*.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:
|
||||
identifier = monitor_group + '_' + os.path.splitext(os.path.basename(
|
||||
monitor_file))[0]
|
||||
|
||||
monitor_configuration = configparser.ConfigParser()
|
||||
monitor_configuration.read(monitor_file, 'utf-8')
|
||||
|
||||
kwargs = {}
|
||||
|
|
@ -39,7 +42,8 @@ class Monitors:
|
|||
value = monitor_configuration.get('args', option)
|
||||
kwargs[option] = value
|
||||
|
||||
print(monitor_group + ' ' + str(kwargs))
|
||||
if kwargs:
|
||||
log('debug', __name__, identifier + ' args ' + str(kwargs))
|
||||
|
||||
identifier = monitor_group + '_' + os.path.splitext(os.path.basename(
|
||||
monitor_file))[0]
|
||||
|
|
@ -47,9 +51,8 @@ class Monitors:
|
|||
# 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,
|
||||
copy.deepcopy(monitor_configuration),
|
||||
notifications, services, tasks,
|
||||
copy.deepcopy(kwargs))
|
||||
monitor_configuration, notifications,
|
||||
services, tasks, copy.deepcopy(kwargs))
|
||||
|
||||
del kwargs
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue