{"id":18150092,"url":"https://github.com/sysulq/nginx-prometheus-metrics","last_synced_at":"2025-07-24T13:38:10.978Z","repository":{"id":152270119,"uuid":"93492763","full_name":"sysulq/nginx-prometheus-metrics","owner":"sysulq","description":"A production demo to collect prometheus metrics for nginx with lua embedded.","archived":false,"fork":false,"pushed_at":"2018-03-08T07:49:50.000Z","size":30,"stargazers_count":98,"open_issues_count":0,"forks_count":32,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-27T07:17:21.924Z","etag":null,"topics":["lua-nginx-module","metrics","nginx","prometheus"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/sysulq.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}},"created_at":"2017-06-06T08:08:07.000Z","updated_at":"2025-03-18T12:02:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1431453-46a2-418b-9b5b-0b0a9273d2e4","html_url":"https://github.com/sysulq/nginx-prometheus-metrics","commit_stats":null,"previous_names":["sysulq/nginx-prometheus-metrics","hnlq715/nginx-prometheus-metrics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fnginx-prometheus-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fnginx-prometheus-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fnginx-prometheus-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fnginx-prometheus-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysulq","download_url":"https://codeload.github.com/sysulq/nginx-prometheus-metrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251099763,"owners_count":21536159,"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":["lua-nginx-module","metrics","nginx","prometheus"],"created_at":"2024-11-02T00:07:33.469Z","updated_at":"2025-04-27T07:17:30.652Z","avatar_url":"https://github.com/sysulq.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nginx Prometheus Metrics\n\n[![Docker Repository on Quay](https://quay.io/repository/hnlq715/nginx-prometheus-metrics/status \"Docker Repository on Quay\")](https://quay.io/repository/hnlq715/nginx-prometheus-metrics)\n[![Docker Pulls](https://img.shields.io/docker/pulls/sophos/nginx-prometheus-metrics.svg)](https://hub.docker.com/r/sophos/nginx-prometheus-metrics/)\n\nA simple demo to collect prometheus metrics for nginx, version 1.11.4 or above recommended.\n\n[Docker Hub: sophos/nginx-prometheus-metrics](https://hub.docker.com/r/sophos/nginx-prometheus-metrics)\n\n## Why use nginx_prometheus_metrics\nThis is absolutely a good question, but please just try it before you ask.\n\n## How to build\n\n```\ndocker build -t nginx_prometheus_metrics .\n```\n\n## How to run\n\n```\ndocker pull sophos/nginx-prometheus-metrics\ndocker run -d --rm -it -p 80:80 -p 1314:1314 -p 9527:9527 sophos/nginx-prometheus-metrics\n```\n\nVisit [http://localhost:1314](http://localhost:1314) to generate some test metrics.\n\nThen visit [http://localhost:9527/metrics](http://localhost:9527/metrics) in your browser(safari/chrome).\n\nAnd you will see the prometheus output below:\n```\n# HELP nginx_http_connections Number of HTTP connections\n# TYPE nginx_http_connections gauge\nnginx_http_connections{state=\"active\"} 1\nnginx_http_connections{state=\"reading\"} 0\nnginx_http_connections{state=\"waiting\"} 0\nnginx_http_connections{state=\"writing\"} 1\n# HELP nginx_http_request_time HTTP request time\n# TYPE nginx_http_request_time histogram\nnginx_http_request_time_bucket{host=\"localhost\",le=\"03.000\"} 1\nnginx_http_request_time_bucket{host=\"localhost\",le=\"04.000\"} 1\nnginx_http_request_time_bucket{host=\"localhost\",le=\"05.000\"} 1\nnginx_http_request_time_bucket{host=\"localhost\",le=\"10.000\"} 1\nnginx_http_request_time_bucket{host=\"localhost\",le=\"+Inf\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.005\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.010\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.020\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.030\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.050\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.075\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.100\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.200\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.300\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.400\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.500\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"00.750\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"01.000\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"01.500\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"02.000\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"03.000\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"04.000\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"05.000\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"10.000\"} 1\nnginx_http_request_time_bucket{host=\"testservers\",le=\"+Inf\"} 1\nnginx_http_request_time_count{host=\"localhost\"} 1\nnginx_http_request_time_count{host=\"testservers\"} 1\nnginx_http_request_time_sum{host=\"localhost\"} 2.0099999904633\nnginx_http_request_time_sum{host=\"testservers\"} 0\n# HELP nginx_http_requests Number of HTTP requests\n# TYPE nginx_http_requests counter\nnginx_http_requests{host=\"localhost\",status=\"200\"} 1\nnginx_http_requests{host=\"testservers\",status=\"200\"} 1\n# HELP nginx_http_upstream_connect_time HTTP upstream connect time\n# TYPE nginx_http_upstream_connect_time histogram\nnginx_http_upstream_connect_time_bucket{addr=\"10.12.13.14:80\",le=\"03.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"10.12.13.14:80\",le=\"04.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"10.12.13.14:80\",le=\"05.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"10.12.13.14:80\",le=\"10.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"10.12.13.14:80\",le=\"+Inf\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.005\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.010\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.020\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.030\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.050\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.075\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.100\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.200\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.300\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.400\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.500\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"00.750\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"01.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"01.500\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"02.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"03.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"04.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"05.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"10.000\"} 1\nnginx_http_upstream_connect_time_bucket{addr=\"127.0.0.1:80\",le=\"+Inf\"} 1\nnginx_http_upstream_connect_time_count{addr=\"10.12.13.14:80\"} 1\nnginx_http_upstream_connect_time_count{addr=\"127.0.0.1:80\"} 1\nnginx_http_upstream_connect_time_sum{addr=\"10.12.13.14:80\"} 2.006\nnginx_http_upstream_connect_time_sum{addr=\"127.0.0.1:80\"} 0\n# HELP nginx_http_upstream_header_time HTTP upstream header time\n# TYPE nginx_http_upstream_header_time histogram\nnginx_http_upstream_header_time_bucket{addr=\"10.12.13.14:80\",le=\"03.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"10.12.13.14:80\",le=\"04.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"10.12.13.14:80\",le=\"05.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"10.12.13.14:80\",le=\"10.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"10.12.13.14:80\",le=\"+Inf\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.005\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.010\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.020\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.030\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.050\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.075\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.100\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.200\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.300\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.400\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.500\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"00.750\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"01.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"01.500\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"02.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"03.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"04.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"05.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"10.000\"} 1\nnginx_http_upstream_header_time_bucket{addr=\"127.0.0.1:80\",le=\"+Inf\"} 1\nnginx_http_upstream_header_time_count{addr=\"10.12.13.14:80\"} 1\nnginx_http_upstream_header_time_count{addr=\"127.0.0.1:80\"} 1\nnginx_http_upstream_header_time_sum{addr=\"10.12.13.14:80\"} 2.006\nnginx_http_upstream_header_time_sum{addr=\"127.0.0.1:80\"} 0.004\n# HELP nginx_http_upstream_requests Number of HTTP upstream requests\n# TYPE nginx_http_upstream_requests counter\nnginx_http_upstream_requests{addr=\"10.12.13.14:80\",status=\"504\"} 1\nnginx_http_upstream_requests{addr=\"127.0.0.1:80\",status=\"200\"} 1\n# HELP nginx_http_upstream_response_time HTTP upstream response time\n# TYPE nginx_http_upstream_response_time histogram\nnginx_http_upstream_response_time_bucket{addr=\"10.12.13.14:80\",le=\"03.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"10.12.13.14:80\",le=\"04.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"10.12.13.14:80\",le=\"05.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"10.12.13.14:80\",le=\"10.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"10.12.13.14:80\",le=\"+Inf\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.005\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.010\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.020\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.030\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.050\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.075\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.100\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.200\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.300\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.400\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.500\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"00.750\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"01.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"01.500\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"02.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"03.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"04.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"05.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"10.000\"} 1\nnginx_http_upstream_response_time_bucket{addr=\"127.0.0.1:80\",le=\"+Inf\"} 1\nnginx_http_upstream_response_time_count{addr=\"10.12.13.14:80\"} 1\nnginx_http_upstream_response_time_count{addr=\"127.0.0.1:80\"} 1\nnginx_http_upstream_response_time_sum{addr=\"10.12.13.14:80\"} 2.006\nnginx_http_upstream_response_time_sum{addr=\"127.0.0.1:80\"} 0.004\n# HELP nginx_metric_errors_total Number of nginx-lua-prometheus errors\n# TYPE nginx_metric_errors_total counter\nnginx_metric_errors_total 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysulq%2Fnginx-prometheus-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysulq%2Fnginx-prometheus-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysulq%2Fnginx-prometheus-metrics/lists"}