Metricbeat for NGINX : HTTP error 502 in : 502 Bad Gateway

Hello,

I'm going through the observability fundamentals training and for the NGINX metrics section i'm getting this error:

{"log.level":"error","@timestamp":"2022-03-09T00:57:04.303Z","log.origin":{"file.name":"module/wrapper.go","file.line":254},"message":"Error fetching data for metricset nginx.stubstatus: error fetching status: HTTP error 502 in : 502 Bad Gateway","service.name":"metricbeat","ecs.version":"1.6.0"}

the nginx.yml file configure is below:

- module: nginx
  #metricsets:
  #  - stubstatus
  period: 10s

  # Nginx hosts
  hosts: ["http://127.0.0.1"]

  # Path to server status. Default nginx_status
  #server_status_path: "nginx_status"

  username: "training"
  password: "nonprodpwd"

Hi @elasticmind,

please try setting server_status_path to server-status as follows:

server_status_path: "server-status"

This should solve the issue.

Best,
Andre

Will try this out.

So to clarify, it should be not commented out?

Yes, you will need to uncomment that line to change the default setting.

Best,
Andre

Thanks, it worked.

What could be the reason why it was not working for the nginx metric but worked for the system metrics with the server_status_path commented out?

That's great to hear it worked @elasticmind. That's because this is a specific setting for NGINX metrics.

Best,
Andre

Thanks for your help, i appreciate it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.