Prometheus scraping error: Error scraping target: Get "http://localhost:8081/metrics": dial tcp [::1
Hi there
I'm trying to setup Prometheus to scrape immich.
Immich is running in a separate compose file to Prometheus.
I tried adding the Immich network to the Prometheus compose file as follows:
But still get the error:
Error scraping target: Get "http://localhost:8081/metrics": dial tcp [::1]:8081: connect: connection refused
on Prometheus3 Replies
:wave: Hey @SkepticMystic,
Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich :immich:.
References
- Container Logs:
docker compose logs
docs
- Container Status: docker compose ps
docs
- Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
Checklist
1. :ballot_box_with_check: I have verified I'm on the latest release(note that mobile app releases may take some time).
2. :ballot_box_with_check: I have read applicable release notes.
3. :ballot_box_with_check: I have reviewed the FAQs for known issues.
4. :ballot_box_with_check: I have reviewed Github for known issues.
5. :ballot_box_with_check: I have tried accessing Immich via local ip (without a custom reverse proxy).
6. :ballot_box_with_check: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting.
7. :ballot_box_with_check: I have tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable
(an item can be marked as "complete" by reacting with the appropriate number)
If this ticket can be closed you can use the /close
command, and re-open it later if needed.Did you look at https://immich.app/docs/features/monitoring and https://github.com/immich-app/immich/blob/main/docker/prometheus.yml ?
For something running inside a docker container,
localhost
is almost always wrongI did, yes!
The issue is that the two run in different stacks, so I can't reference it with the container name like normal
Ahh ok, I got it working!
Since they're in different compose files, I do need this
networks
section I posted above. But once that's added, I then have to use the container name, as you suggested