server misbehaving
gldhnchn opened this issue · 1 comments
gldhnchn commented
Prometheus is reporting me:
Get "http://nginx_exporter:9113/metrics": dial tcp: lookup nginx_exporter on 127.0.0.11:53: server misbehaving
The stub status is delivered by the nginx config file:
server {
listen 127.0.0.1:8085;
server_name _;
location /status {
stub_status;
}
}
Which is giving the output:
$ curl 127.0.0.1:8085/status
Active connections: 26
server accepts handled requests
2526 2526 4586
Reading: 0 Writing: 13 Waiting: 13
The exporter is started in the same docker-compose.yaml like my prometheus instance with the following config:
nginx_exporter:
image: nginx/nginx-prometheus-exporter
container_name: nginx_exporter
network_mode: "host"
command: "-nginx.scrape-uri=http://127.0.0.1:8085/status"
restart: unless-stopped
The exporter is giving me the output:
$ curl 127.0.0.1:9113/metrics
# HELP nginx_connections_accepted Accepted client connections
# TYPE nginx_connections_accepted counter
nginx_connections_accepted 2615
# HELP nginx_connections_active Active client connections
# TYPE nginx_connections_active gauge
nginx_connections_active 26
# HELP nginx_connections_handled Handled client connections
# TYPE nginx_connections_handled counter
nginx_connections_handled 2615
# HELP nginx_connections_reading Connections where NGINX is reading the request header
# TYPE nginx_connections_reading gauge
nginx_connections_reading 0
# HELP nginx_connections_waiting Idle client connections
# TYPE nginx_connections_waiting gauge
nginx_connections_waiting 11
# HELP nginx_connections_writing Connections where NGINX is writing the response back to the client
# TYPE nginx_connections_writing gauge
nginx_connections_writing 15
# HELP nginx_http_requests_total Total http requests
# TYPE nginx_http_requests_total counter
nginx_http_requests_total 4743
# HELP nginx_up Status of the last metric scrape
# TYPE nginx_up gauge
nginx_up 1
# HELP nginxexporter_build_info Exporter build information
# TYPE nginxexporter_build_info gauge
nginxexporter_build_info{arch="linux/amd64",commit="e4a6810d4f0b776f7fde37fea1d84e4c7284b72a",date="2022-09-07T21:09:51Z",dirty="false",go="go1.19",version="0.11.0"} 1
I thought with this output, that it should be working, but prometheus is giving me the error from above.
The target in prometheus.yml is defined as
- job_name: "nginx_metrics"
scrape_interval: 15s
scrape_timeout: 5s
static_configs:
- targets: ['nginx_exporter:9113']
Does somebody have an idea, what could be wrong here?
environment
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
$ nginx -v
nginx version: nginx/1.18.0 (Ubuntu)
$ docker -v
Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1
gldhnchn commented
Okay, looks like it is a network misconfiguration in my docker compose. So this is not a issue of the nginx exporter. I found a "solution" with a static ip. I'll have to figure it out. Thanks anyway!