https://github.com/robusta-dev/prometheus-report-generator
https://github.com/robusta-dev/prometheus-report-generator
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/robusta-dev/prometheus-report-generator
- Owner: robusta-dev
- Created: 2025-01-27T11:23:44.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-02-02T12:19:11.000Z (12 months ago)
- Last Synced: 2025-06-22T03:52:45.996Z (7 months ago)
- Language: Python
- Size: 849 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prometheus Reports Generator
## Example Report Output
The script generates a Prometheus alerts report in PDF format. An example report can be found here: [example_prometheus_alerts_report.pdf](example_prometheus_alerts_report.pdf).
The generated PDF includes:
1. **Alerts Over Time (Line Chart)**: Shows alert frequency trends.

2. **Alert Distribution (Pie Chart)**: Displays the proportion of each alert type.

3. **Alert Summary Table**: Categorizes alerts based on their types and distributions.
4. **Enrichment Summary Table**: Shows how alerts are enriched and categorized.

## How to Use
This script works by calling Robusta’s API, which stores historical data on Prometheus alerts. It fetches alert information and generates a detailed report.
### Installation
To install the required dependencies, run:
```sh
pip install -r requirements.txt
```
### Set Required Environment Variables
Before running the script, you must set the following environment variables:
```sh
export AUTH_TOKEN="your_auth_token"
export ACCOUNT_ID="your_account_id"
```
### Run the Script
To generate a report for the last 30 days:
```sh
python generate_alert_report.py 30
```
You can adjust the number of days as needed.
## Troubleshooting
- **No alerts appearing in the report?**
- Ensure that `AUTH_TOKEN` and `ACCOUNT_ID` are correctly set.
- Check if the Robusta API is returning data for the requested time range.
- **PDF generation issues?**
- Ensure that `fpdf` is installed and the required fonts are available in the `imported/` directory.
- Check if `matplotlib` and `pandas` are installed correctly.
## Contributing
If you'd like to improve this script, feel free to submit a pull request or open an issue.