Cant add a new Data Source

Hello.

i wish to monitor disk space on my Ubuntu Server. I’ve installed Grafana, logged into http://myserverip:3030 & logged into admin, changed the password and then gone to add a Data Source.

Data Sources > Prometheus then added the URL:
http://prometheus:9090

When i click save and test i get:
HTTP Error Bad Gateway

Im new to this. Can you help?

Thanks for your time

  1. Does the name “prometheus” resolve to an IP address on your Grafana server?

If not, then DNS is the problem, otherwise:

  1. Log in to the Prometheus machine and (as root) look at the output of the
    command “netstat -lptn”

You either want to see Prometheus (I assume that’s the name of the service,
I’m not familiar with it) listening on port 9090, or perhaps listening on some
other port.

If Prometheus is listening on port 9090, I suspect you have a firewall
problem between the Grafana server and the Prometheus server.

If it’s not listening on port 9090 but instead on some other port, try using
that in your data source definition in Grafana.

If Prometheus isn’t listening on any port at all, then I suspect it’s simply
not running. Start it (check for any errors) and then give Grafana another
go.

Antony.

1 Like
  1. Does the name “prometheus” resolve to an IP address on your Grafana server?

Fallen at the first hurdle. How do i check that?

Could i not, when hosting on the server, just point to the loopback as a data source
http://127.0.0.1:9090

When as root i netstat -iptn

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:61209 0.0.0.0:* LISTEN 756/python3 tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 79181/monitorix-htt tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 720/systemd-resolve tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 822/sshd: /usr/sbin tcp6 0 0 :::3000 :::* LISTEN 79131/grafana-serve tcp6 0 0 :::12345 :::* LISTEN 79434/grafana-agent tcp6 0 0 :::9095 :::* LISTEN 79434/grafana-agent tcp6 0 0 :::22 :::* LISTEN 822/sshd: /usr/sbin username@servername:~$

Not sure how to format that better. lets try a picture


  1. Does the name “prometheus” resolve to an IP address on your Grafana
    server?

Fallen at the first hurdle. How do i check that?

“ping prometheus” would be a reasonable start.

Alternatively “host prometheus”.

Could i not, when hosting on the server, just point to the loopback as a
data source http://127.0.0.1:9090

If Prometheus is running on the same machien as Grafana, then yes.

When as root i netstat -iptn

So, I see nothing there (a) listening on port 9090, or (b) looking like it
might be prometheus.

Therefore i think you have got the last of my suggestions:

“If Prometheus isn’t listening on any port at all, then I suspect it’s simply
not running. Start it (check for any errors) and then give Grafana another
go.”

Antony.

1 Like

And now i feel silly.
ping: prometheus: Temporary failure in name resolution

Although i’ve setup a cloud based system thats working fine at:
https://myusername.grafana.net

The disk space usage is showing sda and i want to see sdc - i just need to work out how to change that now.

Thanks for your help so far.

W