'How Can I Find Resolved Alert in Prometheus "ALERTS" Query with API
I'm using Prometheus API Client and getting alerts for last 24 hours with below code
import json
from prometheus_api_client import PrometheusConnect
from prometheus_api_client.utils import parse_datetime
from datetime import timedelta
prom = PrometheusConnect(url="***prometheus-url***", disable_ssl=True)
start_time = parse_datetime("1d")
end_time = parse_datetime("now")
chunk_size = timedelta(days=1)
metric_data = prom.get_metric_range_data(
metric_name='ALERTS',
start_time=start_time,
end_time=end_time,
chunk_size=chunk_size,
)
print(json.dumps(metric_data, indent=4))
The alarm list for the last 24 hours comes, but I want to find the resolved alarms in this list. How can I do that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
