keep icon indicating copy to clipboard operation
keep copied to clipboard

[🐛 Bug]: Fail to ingest NetData events

Open imorph opened this issue 2 years ago • 0 comments

Describe the bug

Valid events conforming netdata provider input are not appearing in UI/API

To Reproduce Steps to reproduce the behavior:

Try to ingest event through the API into /alerts/event/netdata with event["status"]["text"] == "unreachable"

Example:

{
  "id": "test-alert-1234",
  "name": "TEST_NAME_TEST2",
  "host": "server-1",
  "message": "CPU usage has exceeded the threshold.",
  "severity": "critical",
  "status": {
    "text": "unreachable"
  },
  "alert": "cpu_usage_alert",
  "alert_url": "http://monitoring.example.com/alerts/123",
  "url": "http://monitoring.example.com",
  "chart": "system.cpu",
  "class": "performance",
  "context": "system_metrics",
  "date": "2024-10-22T15:51:49.000Z",
  "duration": 3600,
  "info": "Threshold exceeded for 60 minutes.",
  "space": "production",
  "total_critical": 5,
  "total_warnings": 10,
  "value": 95.5
}

Expected behavior Event accepted and can be seen through API/UI

Additional context Log of event processing has:

File "/venv/lib/python3.11/site-packages/keep/api/tasks/process_event_task.py", line 528, in process_event
event = provider_class.format_alert(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/keep/providers/base/base_provider.py", line 342, in format_alert
formatted_alert = cls._format_alert(event, provider_instance)                     
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
File "/venv/lib/python3.11/site-packages/keep/providers/netdata_provider/netdata_provider.py", line 75, in _format_alert   
event[\"status\"][\"text\"], AlertStatus.INFO
                             ^^^^^^^^^^^^^^^^  
File "/usr/local/lib/python3.11/enum.py", line 784, in __getattr__  
    raise AttributeError(name) from None
    AttributeError: INFO", 

imorph avatar Oct 22 '24 19:10 imorph