Permission Denied when trying to scrape my own metrics

Hello all,

I am trying to do a proof of concept within my team. I have Prometheus setup as a standalone service in a VM. I am able to got to localhost:9090 and move freely through the UI - graph, status, alerts, etc. I am also able to curl the metrics page and get a list of metrics. The issue I’m having is I get a permission denied error when trying to scrape metrics from my targets (localhost:9090/targets), including the same Prometheus instance.

The specific error message I get is “Get “http://localhost:9090/metrics”: dial tcp [::1]:9090: connect: permission denied”.

Does anyone know where this error message originates from?

Could you try with the 127.0.0.1 IP address? It might be an IPv6 issue on your side.

Hello roidelapluie,

Yes. I’ve tried 127.0.0.1 and the actual IP of the VM. Both give me the same error message.

I will add that I don’t have this issue when I run my command in the terminal. I only get these errors when I run it as a service.