I am trying to get metrics from a running nginx container ( \nginx_status endpoint restricted to 127.0.0.1, 172.17.0.0/16) docker exec nginx curl 127.0.0.1/nginx_status. is good When I run the ELK metricbeat container and set nginx as the host to monitor Error fetching data for metricset nginx.stubstatus: error fetching status: error making http request: Get "http://nginx/nginx_status": dial tcp 172.27.0.6:8080: connect: connection refused. nginx container is created from a different compose file than the metricbeat. They run in different bridge network. Now I inspected both the networks and found that it is completely on different IP address range.
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.16.0/20",
"Gateway": "192.168.16.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
The other bridge network is on
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.32.0/20",
"Gateway": "192.168.32.1"
}
]
},
This was a surprise to me. I am totally confused now and would like to know what is going on. These are my current settings
server {
listen 127.0.0.1;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
allow 172.17.0.0/16;
deny all;
}
}
- How can I reliably set nginx server block ???
- I was thinking that docker is using only 172.17.0.0/16 range. Is this something specific to docker-compose ?