The script generates a Prometheus alerts report in PDF format. An example report can be found here: example_prometheus_alerts_report.pdf.
The generated PDF includes:
- Alerts Over Time (Line Chart): Shows alert frequency trends.
- Alert Distribution (Pie Chart): Displays the proportion of each alert type.
- Alert Summary Table: Categorizes alerts based on their types and distributions.
- Enrichment Summary Table: Shows how alerts are enriched and categorized.
This script works by calling Robusta’s API, which stores historical data on Prometheus alerts. It fetches alert information and generates a detailed report.
To install the required dependencies, run:
pip install -r requirements.txt
Before running the script, you must set the following environment variables:
export AUTH_TOKEN="your_auth_token"
export ACCOUNT_ID="your_account_id"
To generate a report for the last 30 days:
python generate_alert_report.py 30
You can adjust the number of days as needed.
- No alerts appearing in the report?
- Ensure that
AUTH_TOKEN
andACCOUNT_ID
are correctly set. - Check if the Robusta API is returning data for the requested time range.
- Ensure that
- PDF generation issues?
- Ensure that
fpdf
is installed and the required fonts are available in theimported/
directory. - Check if
matplotlib
andpandas
are installed correctly.
- Ensure that
If you'd like to improve this script, feel free to submit a pull request or open an issue.