Closed NavidSassan closed 2 years ago
In GitLab by @markuslf on Dec 9, 2021, 13:03
Try ./nginx-status --url http://your-server/server-status
, assuming you have configured
server {
location /server-status {
stub_status;
allow 127.0.0.1; # only allow requests from localhost
deny all; # deny all other hosts
}
}
In GitLab by @hayt on Dec 9, 2021, 16:29
here is conf file. Markus this script should work with server blocks?
here with curl its working
In GitLab by @hayt on Dec 9, 2021, 16:31
In GitLab by @markuslf on Dec 9, 2021, 20:39
Then please try /usr/lib64/nagios/plugins/nginx-status --url http://your-server.local/nginx_status
. This should work.
In GitLab by @markuslf on Dec 15, 2021, 07:45
Were you able to test this?
In GitLab by @hayt on Dec 29, 2021, 14:17
hello Markus, It doesn't ... here same URL using "curl"
any advice ?
mj
In GitLab by @hayt on Dec 30, 2021, 13:19
@markuslf cant it be the same issue? https://stackoverflow.com/questions/33054527/typeerror-a-bytes-like-object-is-required-not-str-when-writing-to-a-file-in
In GitLab by @markuslf on Jan 4, 2022, 07:55
I was missing the point that you are using the Python 3 version of the check, my mistake.
Fixed via https://git.linuxfabrik.ch/linuxfabrik/lib/-/issues/44. Be sure to checkout the newest url3.py library from the develop branch.
In GitLab by @hayt on Jan 9, 2022, 14:29
thx @markuslf it solved the issue. Tell me please is it possible to get stats only for the exact server block? Right now, for every server block in this instance, I get the same NGINX metrics.
mj
In GitLab by @markuslf on Jan 10, 2022, 08:05
As you can see in the source code, any counter is incremented exactly at the moment when a new request "object" is being created. That is, even before any request header, including the URI, is parsed. So the answer is no, unfortunately there is no way to tell Nginx not to count requests for a particular URI.
Have a look at this discussion on the topic.
In GitLab by @hayt on Jan 10, 2022, 14:13
Markus, as the Nginx status module, is deprecated. Do you plan to develop a plugin for ngx_http_api_module?
In GitLab by @markuslf on Jan 10, 2022, 16:07
Not at the moment, maybe sometimes in the future.
In GitLab by @hayt on Dec 9, 2021, 11:17
I'm trying to execute the script but end with such an error. Could advice?