fix: Avoid webinterface to crash if the monitoring in unavailable

pull/920/head
Raphaël Vinot 2024-06-13 12:44:12 +02:00
parent 8ad2292d68
commit cae1f98866
1 changed files with 7 additions and 4 deletions

View File

@ -165,10 +165,13 @@ class Lookyloo():
if monitoring_config['enable']:
self.monitoring = PyLookylooMonitoring(monitoring_config['url'], get_useragent_for_requests())
if self.monitoring.is_up:
self.monitoring_enabled = True
# NOTE: maybe move that somewhere else: we'll need to restart the webserver
# if we change the settings in the monitoring instance
self.monitoring_settings = self.monitoring.instance_settings()
try:
# NOTE: maybe move that somewhere else: we'll need to restart the webserver
# if we change the settings in the monitoring instance
self.monitoring_settings = self.monitoring.instance_settings()
self.monitoring_enabled = True
except Exception as e:
self.logger.critical(f'Unable to initialize the monitoring instance: {e}')
self.logger.info('Initializing context...')
self.context = Context()