{"id":18150088,"url":"https://github.com/sysulq/status-nginx-module","last_synced_at":"2025-04-27T07:19:09.966Z","repository":{"id":20804099,"uuid":"24089513","full_name":"sysulq/status-nginx-module","owner":"sysulq","description":"A http status module for pure nginx, which is in production already.","archived":false,"fork":false,"pushed_at":"2019-03-19T03:00:51.000Z","size":19,"stargazers_count":15,"open_issues_count":3,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T08:32:13.508Z","etag":null,"topics":["c","nginx","status","status-nginx"],"latest_commit_sha":null,"homepage":"","language":"C","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}},"created_at":"2014-09-16T07:20:07.000Z","updated_at":"2024-09-09T23:18:55.000Z","dependencies_parsed_at":"2022-08-21T21:01:04.047Z","dependency_job_id":null,"html_url":"https://github.com/sysulq/status-nginx-module","commit_stats":null,"previous_names":["sysulq/status-nginx-module"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fstatus-nginx-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fstatus-nginx-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fstatus-nginx-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysulq%2Fstatus-nginx-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysulq","download_url":"https://codeload.github.com/sysulq/status-nginx-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251100108,"owners_count":21536207,"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":["c","nginx","status","status-nginx"],"created_at":"2024-11-02T00:07:32.896Z","updated_at":"2025-04-27T07:19:09.946Z","avatar_url":"https://github.com/sysulq.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"status-nginx-module\n===================\n![](https://travis-ci.org/hnlq715/status-nginx-module.svg)\n\nThe req status module for pure nginx. The core source file comes from Tengine, which is developed and maintained by Alibaba.\n\n\nDescription\n===========\n\nThis module will help monitor running status of Nginx.\n* It can provide running status information of Nginx.\n* The information is divided into different zones, and each zone is independent.\n* The status information is about connections, requests, response status codes, input and output flows, rt, and upstreams.\n* It shows all the results by default, and can be set to show part of them by specifying zones.\n\n\nCompilation\n===========\n\n```\ngit clone https://github.com/hnlq715/status-nginx-module\n./configure --add-module=/path/to/status-nginx-module\nmake \u0026\u0026 make install\n```\n\nStarting from NGINX 1.9.11, you can also compile this module as a dynamic\nmodule, by using the `--add-dynamic-module=PATH` option instead of\n`--add-module=PATH` on the ./configure command line above. And then you can\nexplicitly load the module in your `nginx.conf` via the *load\\_module* directive.\n\n\nConfiguration Directives\n========================\n\nhttp\\_status\\_zone\n------------------\n**syntax:** *http\\_status\\_zone \u0026lt;zone\\_name\u0026gt; \u0026lt;row\\_name\u0026gt; \u0026lt;shm\\_size\u0026gt;* \\\n**default:** *no* \\\n**context:** *http*\n\nSets up shared memory zone named *zone_name* for statistics. Statistics are\nsimple table where first column is key and its value is computed by evaluating\nexpression *row\\_name*. Remaining columns are collected metrics (see\n[below](#format-of-statistics-output)).\n*shm_size* specifies reserved memory for the statistics, each row will consume\nabout 200 bytes of memory (this is rough estimation, see source code for exact\nvalue). If request should create new statistics row and there is no more memory\nin zone, then it is not counted in this zone and appropriate warning is logged.\n\nhttp\\_status\n------------\n**syntax:** *http\\_status \u0026lt;zone\\_name\u0026gt; [\u0026lt;zone\\_name\u0026gt; ...];* \\\n**default:** *no* \\\n**context:** *http*, *server*, *location*\n\nTakes list of zones (at least one) where request should be counted.\n\nhttp\\_status\\_bypass\n---------------------\n**syntax:** *http\\_status\\_bypass \u0026lt;condition\u0026gt; [\u0026lt;condition\u0026gt; ...];* \\\n**default:** *no* \\\n**context:** *http*, *server*, *location*\n\nDefines conditions under which request will not be counted in statistics at\nall.  If at least one value of the string parameters is not empty and is not\nequal to “0” then the request will not be counted.\n\nhttp\\_status\\_show\n------------\n**syntax:** *http\\_status\\_show [\u0026lt;zone\\_name\u0026gt; [\u0026lt;zone\\_name\u0026gt; ...]];* \\\n**default:** *no* \\\n**context:** *location*\n\nRenders statistics as a response to the request matching current location.\nNo Content-Type response header is set.\n\n\nVariables\n=========\n\n$upstream\\_first\\_addr\n----------------------\n\nThis module defines variable *$upstream\\_first\\_addr* which contains\naddress of first upstream that was contacted when handling current request.\n\n\nFormat of statistics output\n===========================\nStatistics are formatted as comma separated values (without quoting, thus you\ncan create more virtual columns by having commas in *row\\_name*). No header row\nis rendered.\n\n  * **row\\_name** - value of expression defined by the directive `http_status_zone`\n  * **bytesintotal** - total number of bytes received from client\n  * **bytesouttotal** - total number of bytes sent to client\n  * **conn\\_total** - total number of accepted connections\n  * **req\\_total** - total number of processed requests\n  * **2xx** - total number of 2xx requests\n  * **3xx** - total number of 3xx requests\n  * **4xx** - total number of 4xx requests\n  * **5xx** - total number of 5xx requests\n  * **other total** - number of other requests\n  * **rt\\_total** - accumulated request time (miliseconds)\n  * **upstream\\_req** - total number of requests calling for upstream\n  * **upstream\\_rt** - accumulated time of upstream calls (miliseconds)\n  * **upstream\\_tries** - total number of calls for upstream\n\n\nExample\n=======\n\n```\nhttp {\n    # Set up statistics zone named 'host'.\n    # ( Name of shared memory zone cannot be used in other\n    #   places using named shared memory zones (proxy_cache_path ... keys_zone=..., ). )\n    http_status_zone host \"$host,$server_addr:$server_port\" 10M;\n\n    # Prepare variable for statistics with custom differrentiation.\n    # ( We cannot use 'set' in 'http' block, so we use map and set it to \"$server_name\" by default,\n    #   with mapping of server_name '_' to \"unnamed_server\" );\n    map \"$server_name\" $custom_stat_name {\n        default \"$server_name\";\n        _ unnamed_server;\n    }\n    http_status_zone custom_stats \"_CUSTOM,$custom_stat_name\" 10M;\n\n    # Count served pages only in zone 'host' by default\n    http_status host;\n\n\n    server {\n        server_name _;\n\n        location /all-stats {\n            #Display rows from all zones together\n            http_status_show;\n        }\n\n        location /host-stats {\n            #Display rows only from 'host' zone;\n            http_status_show host;\n        }\n\n        location /all-stats-ex {\n            #Display rows from both zones (defined explicitly for configuration demonstration)\n            http_status_show host custom_stats;\n\n            #Override custom_stats_name when counting accesses to this location\n            set $custom_stat_name \"all stats explicit\";\n        }\n\n        # Count all accesses to this server in both statistics zones.\n        http_status host custom_stats;\n    }\n}\n```\n\nWhen you call '/all-stats', you will get results like this:\n```\nlocalhost,127.0.0.1:80,162,6242,1,1,1,0,0,0,0,10,1,10,1\n_CUSTOM,unnamed_server,6242,1,1,1,0,0,0,0,10,1,10,1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysulq%2Fstatus-nginx-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysulq%2Fstatus-nginx-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysulq%2Fstatus-nginx-module/lists"}