{"id":28718796,"url":"https://github.com/rahuldongre-us/python-prometheus-grafana-docker","last_synced_at":"2026-04-16T18:03:04.872Z","repository":{"id":296638848,"uuid":"993986435","full_name":"rahuldongre-us/python-prometheus-grafana-docker","owner":"rahuldongre-us","description":"Easily monitor your Python applications like a pro using Prometheus, Grafana, and Docker – all in one streamlined setup. This project offers a plug-and-play observability stack to track key metrics, set up alerting, and visualize real-time performance dashboards for your Python services.","archived":false,"fork":false,"pushed_at":"2025-06-01T02:49:17.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-01T12:38:21.759Z","etag":null,"topics":["alert","checkov","fastapi","grafana","monitoring","observability","prometheus","python3","trivy"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahuldongre-us.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-01T00:06:46.000Z","updated_at":"2025-06-01T02:52:43.000Z","dependencies_parsed_at":"2025-06-01T12:40:09.128Z","dependency_job_id":null,"html_url":"https://github.com/rahuldongre-us/python-prometheus-grafana-docker","commit_stats":null,"previous_names":["rahuldongre-us/python-prometheus-grafana-docker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rahuldongre-us/python-prometheus-grafana-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahuldongre-us%2Fpython-prometheus-grafana-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahuldongre-us%2Fpython-prometheus-grafana-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahuldongre-us%2Fpython-prometheus-grafana-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahuldongre-us%2Fpython-prometheus-grafana-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahuldongre-us","download_url":"https://codeload.github.com/rahuldongre-us/python-prometheus-grafana-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahuldongre-us%2Fpython-prometheus-grafana-docker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259924673,"owners_count":22932782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","checkov","fastapi","grafana","monitoring","observability","prometheus","python3","trivy"],"created_at":"2025-06-15T05:04:32.464Z","updated_at":"2025-10-08T12:19:00.592Z","avatar_url":"https://github.com/rahuldongre-us.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Python + Prometheus + Grafana Monitoring Stack (Dockerized)\n\nMonitor your Python applications in real-time with a production-ready monitoring stack using **Prometheus**, **Grafana** and **Docker**. This repository helps developers and DevOps engineers bootstrap observability for microservices or monoliths with minimal setup. Checkov uses a common command line interface to manage and analyze infrastructure as code (IaC) scan results across platforms such as Terraform and other framework. Trivy to find vulnerabilities (CVE) \u0026 misconfigurations (IaC) across code repositories, binary artifacts, container images and more. All in one tool!\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![Docker Compose](https://img.shields.io/badge/Docker--Compose-Ready-blue)\n[![Stars](https://img.shields.io/github/stars/rahuldongre-us/python-prometheus-grafana-docker?style=social)](https://github.com/rahuldongre-us/python-prometheus-grafana-docker/stargazers)\n[![Issues](https://img.shields.io/github/issues/rahuldongre-us/python-prometheus-grafana-docker)](https://github.com/rahuldongre-us/python-prometheus-grafana-docker/issues)\n[![Last Commit](https://img.shields.io/github/last-commit/rahuldongre-us/python-prometheus-grafana-docker)](https://github.com/rahuldongre-us/python-prometheus-grafana-docker/commits/main)\n\n\n---\n\n## 📊 Features\n\n✅ Easy setup with Docker Compose  \n✅ Python app exposing metrics with `prometheus_client`  \n✅ Pre-configured Prometheus scrape targets  \n✅ Grafana ready for dashboards  \n✅ Modular and extensible for production use  \n\n---\n\n## ⚙️ Quick Start\n\n### Prerequisites\n\n- Docker \u0026 Docker Compose installed\n- Python 3.7+ (optional, for local testing)\n\n### Clone the Repository\n\n```bash\ngit clone https://github.com/rahuldongre-us/python-prometheus-grafana-docker.git\ncd python-prometheus-grafana-docker\ndocker-compose up --build -d\n```\n\nor \n\nStart the application.\n\n``` bash\n  chmod +x infra.sh \n  ./infra.sh\n```\nLocal docker should expose python app, prometheus and grafana.\n\nDestroy the application.\n\n``` bash\n  chmod +x cleanup-infra.sh\n  ./cleanup-infra.sh\n```\n\nScan for misconfiguration, CVE and other vulnerabilities. \n\n``` bash\n  chmod +x scan.sh\n  ./scan.sh\n```\nSplunk and email notification can be setup based on scan results at build time.\n\n\n| Service    | URL                                                            | Notes                            |\n| ---------- | -------------------------------------------------------------- | -------------------------------- |\n| Grafana    | [http://localhost:3000](http://localhost:3000)                 | Default login: `admin` / `admin` |\n| Prometheus | [http://localhost:9090](http://localhost:9090)                 | Live metrics \u0026 targets           |\n| Python App | [http://localhost:8000/metrics](http://localhost:8000/metrics) | Prometheus metrics endpoint      |\n\n---\n\n🛠️ Customize \u0026 Extend\n\nAdd More Metrics\n\nEdit app/main.py and add custom Prometheus metrics using prometheus_client:\n\nfrom prometheus_client import Counter\n\nREQUESTS = Counter('http_requests_total', 'Total HTTP Requests')\n\nAdd More Services\nJust define new services in docker-compose.yml and update prometheus.yml to scrape their metrics.\n\n---\n## Checkov\n\npip install checkov\n\ndocker run --rm -v $(pwd):/tf bridgecrew/checkov --directory /tf\n\n### For Terraform files\ncheckov -d .\n\n### For Dockerfiles\ncheckov --dockerfile-path ./app/Dockerfile\n\n### Terraform \u0026 Dockerfile\n\ndocker run --rm -v $(pwd):/tf bridgecrew/checkov --directory /tf\n\ndocker run --rm -v $(pwd)/app/Dockerfile:/Dockerfile bridgecrew/checkov --dockerfile-path /Dockerfile\n\n---\n## Trivy\n\nbrew install aquasecurity/trivy/trivy      \n\ndocker run --rm -v $(pwd):/project aquasec/trivy config /project\n\ntrivy config .\n\n### Example: scan Python app image built by Terraform\n\ntrivy image python_app\n\n---\n\n📌 Use Cases\n\n📊 Monitoring microservices\n\n⚙️ System observability in Dev/Test environments\n\n🚨 Alerting integration with Prometheus AlertManager\n\n🧪 Teaching/promoting observability best practices\n\n---\n\n🧠 Resources\n\n[Prometheus Docs ](https://prometheus.io/docs/) \n\n[Grafana Docs](https://grafana.com/docs/)\n\n[Prometheus Python Client](https://github.com/prometheus/client_python)\n\n[Checkov](https://www.checkov.io/)\n\n[Trivy](https://trivy.dev/latest/)\n\n---\n\n🙌 Acknowledgments\n\nBuilt with ❤️ by Rahul Dongre\nInspired by open-source observability stacks worldwide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahuldongre-us%2Fpython-prometheus-grafana-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahuldongre-us%2Fpython-prometheus-grafana-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahuldongre-us%2Fpython-prometheus-grafana-docker/lists"}