0

I run a grafana docker container and tried to connect to my ms-sql database on my hostsystem, but I get an error instandly, if I click on "save and test".

Error Message in logs:

2023-03-20 15:12:51 logger=context userId=1 orgId=1 uname=admin t=2023-03-20T14:12:51.934877922Z level=error msg="Plugin health check failed" error="failed to check plugin health: health check failed" remote_addr= traceID=

2023-03-20 15:12:51 logger=context userId=1 orgId=1 uname=admin t=2023-03-20T14:12:51.934949156Z level=error msg="Request Completed" method=GET path=/api/datasources/1/health status=500 remote_addr= time_ms=22 duration=22.582005ms size=53 referer=http://localhost:3000/datasources/edit/MHHmhiB4z handler=/api/datasources/:id/health

My settings

enter image description here

Addtionally, I tried to use my IP-Address 192.168.xx.xx, but this fails, too. After I setup my connection and click on "Save and Test" I get the error:

enter image description here

Addtionally, I tried to use my IP-Address 192.168.xx.xx, but this fails, too. My SQL Server TCP/IP configuration looks like this: enter image description here

I hope you can help to find out, what the problem is. Thanks a lot.

Christian01
  • 307
  • 1
  • 5
  • 19
  • 1
    Problem most likely related to the fact that you are trying to connect to localhost from inside of container. Read more [here](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) – markalex Mar 20 '23 at 15:00
  • Hello @markalex, thank you for your answer. But all solutions don't work... – Christian01 Mar 23 '23 at 21:29
  • Don't work how? Is error same or different? Have you checked that your mssql incance is reachable from outside of your host (basically docker container is outsider for mssql instance)? – markalex Mar 23 '23 at 21:33
  • The error is the same, but network = host works only on linux. I use Docker Desktop on windows. The mssql is reachable from my docker. I did a ping to the sever. – Christian01 Mar 23 '23 at 21:54
  • Ping is not enough. Have you checked port is reachable (for example with [`nc`](https://www.tecmint.com/check-remote-port-in-linux/) )? Have you verified that you can connect (preferably with some db client app) to mssql from *another* computer? – markalex Mar 23 '23 at 22:08
  • Yes, that's why I tried some more in the last half hour. I used telnet, but I get an error. So, I installed the sql management studio and tried to connect to my database. But this fails too. I don't know...because I think I configurate the server and restart the server after the configuration. In the post above, I append my SQL Configuration – Christian01 Mar 23 '23 at 22:20
  • Delete this question, go configure your SQL server, so it functions normally and could be connected from outside, and try to connect Grafana to it (using outer ip of your host or `host.docker.internal`). If that time Grafana wouldn't connect - create new question using [this guide](https://stackoverflow.com/help/how-to-ask). – markalex Mar 25 '23 at 13:06

1 Answers1

1

I had the same issue, My solution was to add the correct ip address of the database. Insted of localhost:1433 I added 10.2.16.100:1433. Hope this will help

babdeco14
  • 11
  • 2