Reputation: 323
I've setup Nginx Prometheus exporter from Nginx Inc. (https://github.com/nginxinc/nginx-prometheus-exporter) on an Ubuntu 20.04 server. Trying to start the service, an error shows up:
Could not create Nginx Client: failed to get https://domain.tld/nginx-status: Get "https://domain.tld/nginx-status": dial tcp 127.0.1.1:443: connect: connection refused
The url https://domain.tld/nginx-status is running fine.
This is the config file I'm using:
[Unit]
Description=Nginx Prometheus Exporter
After=network.target
[Service]
Type=simple
User=nginx_exporter
Group=nginx_exporter
ExecStart=/usr/local/bin/nginx-prometheus-exporter \
-web.listen-address=server_IP:9113 \
-nginx.scrape-uri https://domain.tld/nginx-status
SyslogIdentifier=nginx_prometheus_exporter
Restart=always
[Install]
WantedBy=multi-user.target
Upvotes: 1
Views: 4223
Reputation: 323
So the issue was an entry in /etc/hosts
file...
127.0.0.1 domain.tld
Now exporter is starting without any errors!
Thanks to @anemyte
Upvotes: 1