惊慌失措。Put http://localhost:8080/v1/agent/service/register?dc=dc1: dial tcp 127.0.0.1:8080: connect: connection refused

0 人关注

我试图为 https://github.com/martin-helmich/prometheus-nginxlog-exporter#docker nginxlog exporter运行docker,我得到了`panic。把http://localhost:8080/v1/agent/service/register?dc=dc1:拨号tcp 127.0.0.1:8080:连接:拒绝连接

goroutine 1 [running]:main.setupConsul(0xc000188000, 0xc00018e000, 0xc000020014)/home/runner/work/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter/main.go:286 +0x125main.main()/home/runner/work/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter/main.go:236 +0x11e2`
and prometheus config`listen {port = 4040address = "127.0.0.1"metrics_endpoint = "/metrics"}
consul {enable = trueaddress = "localhost:8080"datacenter = "dc1"scheme = "http"token = ""service {id = "nginx-exporter"name = "nginx-exporter"address = "127.0.0.1"tags = ["foo", "bar"]}}
namespace "app1" {format = "$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for""source {files = ["/opt/homebrew/var/log/nginx/access.log"]}
log can be printed to std out, e.g. for debugging purposes (disabled by default)
print_log = false
metrics_override = { prefix = "myprefix" }
namespace_label = "vhost"
labels {app = "application-one"environment = "production"foo = "bar"}
histogram_buckets = [.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10]}`
and Using the command docker run --name nginx-exporter -p 4040:4040 -v /path/to/logs:/mnt/nginxlogs -v /path/to/config.hcl:/etc/prometheus-nginxlog-exporter.hcl quay.io/martinhelmich/prometheus-nginxlog-exporter -config-file /etc/prometheus-nginxlog-exporter.hcl

我查看了端口并尝试使用curl,我得到的回应是 而当我运行这个命令时 docker run
--名称nginx-exporter