SSH Tunnel

Estimated reading time: 1 min

Slemma allows to connect to your databases in two ways: Directly or through the SSH tunnel.

Direct Connection requires you to whitelist Slemma’s IP address ( and enter your connection details (user, database, password, and etc. ) on the Integration settings dialogue. In other words, it requires your database to be accessible from the internet. If your database is on a private network and you do not want it to be accessible from the internet, you can set up a secure tunnel to forward encrypted inbound connections from our SSH server to your database server, or use your own SSH/proxy.

Creating a new data source

Navigate to your Data sources page, click the blue plus icon on the bottom right and choose the desired data source from the list. You’ll see the Integration settings form.

NOTE: You still need to create a read-only user for Slemma to access your database. See the documentation for MySQL and PostgreSQL.

  1. On the General tab, enter your localhost or IP from your private network, provide database name and user credentials.
  2. Make sure you check the Use SSH-tunnel box on the Security tab. Slemma will create a command you need to run to open a tunnel. 
  3. Next, run the command in your terminal.
    If you are using Windows OS you can use one of the available SSH clients to establish a tunnel. The example here shows a command for Plink
  4. When prompted, type in the password from the connection dialog above. You can find it just under the command.
    This command should print nothing and appear to exit immediately. It will be running in the background.
  5. We encourage you to test the tunnel. To do so click TEST from your Integration settings dialogue. It should return a ‘Success’ message if the tunnel is running. Otherwise, Slemma returns ‘Fail’. The most common issue that can cause failure is that your server is unreachable.

NOTE: This method requires the software used to set up SSH tunnel to be running in order to keep your charts updated. This means that should the tunnel stop running (ex. due to server reboot) your charts will be broken once Slemma tries to clear the cache and pull new data. If you want the tunnel restart automatically you can set up autossh or similar tools. Also it might be helpful to add a crontab (startup) entry to set up the tunnel automatically after your machine reboot.

Was this article helpful?
Dislike 0
Views: 1020