An open API service indexing awesome lists of open source software.

https://github.com/robusta-dev/prometheus-report-generator


https://github.com/robusta-dev/prometheus-report-generator

Last synced: 7 months ago
JSON representation

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.
Screen Shot 2025-02-02 at 14 05 00

2. **Alert Distribution (Pie Chart)**: Displays the proportion of each alert type.
Screen Shot 2025-02-02 at 14 08 14

3. **Alert Summary Table**: Categorizes alerts based on their types and distributions.
4. **Enrichment Summary Table**: Shows how alerts are enriched and categorized.
Screen Shot 2025-02-02 at 14 05 35

## 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.