{"id":16177867,"url":"https://github.com/hifly81/prometheus-csvplot","last_synced_at":"2025-07-21T12:35:20.949Z","repository":{"id":68321719,"uuid":"241658494","full_name":"hifly81/prometheus-csvplot","owner":"hifly81","description":"Scrape Prometheus metrics, export them as csv files and generate plots","archived":false,"fork":false,"pushed_at":"2024-08-19T07:22:44.000Z","size":44,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T01:35:05.829Z","etag":null,"topics":["csv","grafana","kubernetes","openshift","orca","pandas","pdf","plotly","prometheus","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hifly81.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}},"created_at":"2020-02-19T16:00:30.000Z","updated_at":"2025-02-24T04:43:15.000Z","dependencies_parsed_at":"2023-12-18T13:24:45.775Z","dependency_job_id":"89a690ea-71d6-46ea-96d4-04f3d398a1d6","html_url":"https://github.com/hifly81/prometheus-csvplot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hifly81%2Fprometheus-csvplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hifly81%2Fprometheus-csvplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hifly81%2Fprometheus-csvplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hifly81%2Fprometheus-csvplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hifly81","download_url":"https://codeload.github.com/hifly81/prometheus-csvplot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244336104,"owners_count":20436769,"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":["csv","grafana","kubernetes","openshift","orca","pandas","pdf","plotly","prometheus","python"],"created_at":"2024-10-10T05:10:57.992Z","updated_at":"2025-03-19T01:30:41.513Z","avatar_url":"https://github.com/hifly81.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Quickly run queries on prometheus and view results as csv files. Extract pdf reports with plots.\n\n## Usage\n\n### Configuration\n\nA configuration file is required with a list of Prometheus metrics to be collected.\n\nBy default, metrics are listed in file: _config/metrics.txt_\n\nIf you want to use a custom metrics file, place it in config directory:\ne.g. _config/metrics_haproxy.txt_\n\nExample of a metrics config file:\n\n```\nrate(go_gc_duration_seconds[5m])\nscrape_duration_seconds\nprometheus_http_request_duration_seconds_bucket{handler=\"/api/v1/query_range\", instance=\"localhost:9090\", job=\"prometheus\", le=\"0.1\"}\nsum(rate(http_server_requests_seconds_count{instance=\"application:8080\", status!~\"5.*\"}[5m]))\n```\n\n## How to use\n\nYou need a **prometheus** instance running.\n\nFile _docker-compose_ in root folder can be used to run a prometheus instance on port 9090 and node exporter:\n\n```\ndocker-compose up -d \n```\n\n### Generate csv files from prometheus metrics\n\nThis component is written in **python v3**, and you need some python libs to be installed on your local machine:\n\n - python modules: _jproperties, requests, pandas, pillow, plotly, kaleido_\n\nyou can install those with _pip3_:\n\n```\npip3 install jproperties requests pandas pillow plotly kaleido\n```\n\n### Generate csv files from prometheus metrics\n\n```\npython3 export_csv.py \u003cprometheus_url\u003e \u003cdateStart RFC 3339 | unix_timestamp\u003e \u003cdateEnd RFC 3339 | unix_timestamp\u003e \u003ccustom_metrics_file_name\u003e\n```\n\nExample of usage:\n\n```\npython3 export_csv.py http://localhost:9090 2022-12-14T10:00:00Z 2022-12-14T11:30:00Z metrics.txt\n```\n\nA new directory named csv/metrics_%Y-%m-%d-%H:%M:%S with the csv files will be generated.\n\n### Create a pdf report with plots from csv files\n\n```\npython3 plot.py \u003ccsv_directory\u003e\n```\n\nExample of usage:\n\n```\npython3 plot.py csv/metrics_2022-12-14_11:20:20\n```\n\nA new pdf file *report.pdf* will be generated in directory csv/metrics_%Y-%m-%d-%H:%M:%S\n\n## Teardown\n\n```\ndocker-compose down --volumes\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhifly81%2Fprometheus-csvplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhifly81%2Fprometheus-csvplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhifly81%2Fprometheus-csvplot/lists"}