Create alerts.py
taylor_socfortress committed
Jul 10, 2023 at 16:40 UTC
6f9adda96871658ff739f7a8bd6e414c94de984c
1 file changed
+22
backend/app/routes/alerts.py
new
+22
@@ -0,0 +1,22 @@
1
+from flask import Blueprint, jsonify, request
2
+from loguru import logger
3
+from app.models.connectors import Connector, WazuhManagerConnector
4
+
5
+from app.services.agents.agents import AgentService, AgentSyncService
6
+from app.services.WazuhIndexer.alerts import AlertsService
7
+
8
+bp = Blueprint("alerts", __name__)
9
+
10
+
11
+@bp.route("/alerts", methods=["GET"])
12
+def get_alerts():
13
+ """
14
+ Endpoint to list all available alerts.
15
+ It processes each alert to verify the connection and returns the results.
16
+
17
+ Returns:
18
+ json: A JSON response containing the list of all available alerts along with their connection verification status.
19
+ """
20
+ service = AlertsService()
21
+ alerts = service.collect_alerts()
22
+ return alerts