Skip to content

robusta-dev/prometheus-report-generator

Repository files navigation

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.

The generated PDF includes:

  1. Alerts Over Time (Line Chart): Shows alert frequency trends.
Screen Shot 2025-02-02 at 14 05 00
  1. Alert Distribution (Pie Chart): Displays the proportion of each alert type.
Screen Shot 2025-02-02 at 14 08 14
  1. Alert Summary Table: Categorizes alerts based on their types and distributions.
  2. 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:

pip install -r requirements.txt

Set Required Environment Variables

Before running the script, you must set the following environment variables:

export AUTH_TOKEN="your_auth_token"
export ACCOUNT_ID="your_account_id"

Run the Script

To generate a report for the last 30 days:

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages