-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input plugin nginx_plus_api http request throws "404 Not Found" error #5807
Comments
Could you run it again with this build of #5811. This should correct the error message so we can see the actual path returning 404, currently it is just showing the URL from the config file. |
Thanks @danielnelson for quick response.
|
It doesn't look like this should interrupt any other metrics, are other metrics being collected? If so you can ignore this error until we fix the logging. I think we just need to make the 404 error ignored in the plugin for these endpoints. |
We are only getting metrics mentioned below. Other metrics are not getting collected. Not sure if they all are due to the 404 errors or there are other issues. nginx_plus_api_processes |
I guess I need to enable the NGINX load balancers to get other missing metrics. I will have to try that and see if they get collected. If yes, then probably, we just have issues with |
@danielnelson After configuring the load balancer, we are getting all metrics. So, there does not seem to be any issue with metrics collection. As you said, looks like only logging needs to be taken care then. |
Closes #5807 Currently, this plugin tries a set of hardcoded paths. Not all paths are enabled in a standard NGINX configuration. This PR skips any API resource paths that do not exist. However, the correct way would be to get the paths from NGINX itself at /api, /api/4, etc rather than have a set of hardcoded paths.
Relevant telegraf.conf:
System info:
Ubuntu Xenial (16.04)
Nginx Plus R18
Telegraf 1.10.2
Steps to reproduce:
Expected behavior:
Ngnix metrics data through the API
Actual behavior:
Getting following error-
2019-05-06T10:06:19Z E! [inputs.nginx_plus_api]: Error in plugin: http://127.0.0.1/api returned HTTP status 404 Not Found
Additional info:
Checked
gatherUrl
function in file "nginx_plus_api_metrics.go". Just to see some more error details, changed theurls
value in "telegraf.conf" to127.0.0.
(removed 1 from last). Restarted Telegraf and got the error as below-2019-05-06T10:07:54Z E! [inputs.nginx_plus_api]: Error in plugin: error making HTTP request to http://127.0.0./api: Get http://127.0.0./api/4/processes: dial tcp: lookup 127.0.0.: no such host
When opening the correct URL
http://127.0.0.1/api/4/processes
from the machine, it is accessible and response is Successful.Not sure why should we get "HTTP status 404 Not Found" as mentioned in Actual Behavior. The URLs seem to be good, then why it should go the block
if resp.StatusCode != http.StatusOK {
. It brings my doubt onresp, err := n.client.Get(url)
, which is very unlikely to be an issue.We want to start using this plugin, so any help is appreciated. Thanks.
The text was updated successfully, but these errors were encountered: