diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index a23e9ef..9cba90c 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -120,6 +120,8 @@ class Lookyloo(): 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() self.logger.info('Initializing context...') diff --git a/website/web/__init__.py b/website/web/__init__.py index a27ed32..92f4f27 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -709,6 +709,13 @@ def tree(tree_uuid: str, node_uuid: Optional[str]=None): if cache.error: flash(cache.error, 'warning') + if lookyloo.monitoring_enabled: + try: + monitoring_collections = lookyloo.monitoring.collections() + except Exception as e: + monitoring_collections = [] + flash(f'Unable to get existing connections from the monitoring : {e}', 'warning') + return render_template('tree.html', tree_json=ct.to_json(), info=cache, tree_uuid=tree_uuid, public_domain=lookyloo.public_domain, @@ -717,6 +724,7 @@ def tree(tree_uuid: str, node_uuid: Optional[str]=None): meta=meta, enable_mail_notification=enable_mail_notification, enable_monitoring=lookyloo.monitoring_enabled, monitoring_settings=lookyloo.monitoring_settings if lookyloo.monitoring_enabled else None, + monitoring_collections=monitoring_collections if lookyloo.monitoring_enabled else [], enable_context_by_users=enable_context_by_users, enable_categorization=enable_categorization, enable_bookmark=enable_bookmark, diff --git a/website/web/templates/tree.html b/website/web/templates/tree.html index 694260f..032ce54 100644 --- a/website/web/templates/tree.html +++ b/website/web/templates/tree.html @@ -740,8 +740,18 @@ {% endif %}
- + {% if monitoring_collections %} + + + + {% for name in monitoring_collections %} + + {% endfor %} + + {%else%} + + {% endif %}