Linking Plex Data Into Grafana
Do you wish Plex had a super cool dashboard that showed you “all the things” in one place? Do you have an underutilized Synology NAS? Do you have some A LOT free time? If those 3 answers are yes, you should read this.
A couple of things before we get started. I don’t like to have to jump to a bunch of web tabs so I will do my best to compile all of the data into one page. I have included some links to resources I used to complete this project. Also, I am using a DS1621+ with 4GB of RAM. I would recommend this as the absolute baseline for running docker on your NAS. All of these services combined are pretty small but it never hurts to have more resources! This is also an x86 machine with an AMD processor so ARM your way through this at your own risk! I would be interested in knowing if it works though!
Layout of Services
Setting up Docker on Synology
The first order of business is to install Docker on your Synology NAS. You can find this in the app store on the Synology desktop. Resource: linuxhint.com
Open Package manager.
Search for Docker.
Click Install.
Select a volume to install in and then click Next.
Make sure “run after installation” is checked and click apply.
Open Docker from the Synology app tray or from the package manager.
Downloading from the Docker Registry
Once you are in docker click on the registry tab.
Search and download the following images:
grafana/grafana (latest)
influxdb (version 1.8… not Latest)
tautulli/tautulli (latest)
telegraf (latest or alpine)
boerderij/varken (latest)
Setting Up InfluxDB in Docker
Resource: gh2home.nl
Set up an InfluxDB folder in your environment ex. /volume1/docker/influxdb
Go to the Images page in Docker.
Click on the Influxdb 1.8 image and then click launch at the top of the page.
Run the container with the bridged network configuration and continue. (this should be the default)
Give it a special name or leave it default.
Enable auto-restart and then continue to the next page.
In folder mapping, add a folder from your choice of destination in your NAS (step 1) and then mouth the path to “‘/var/lib/influxdb” and continue.
Verify settings and make sure the check box for “Run container when wizard is finished” is checked.
Click apply
Go to the container page in docker to verify it is running
Setting Up Grafana in Docker
Resource: mariushosting.com
Set up a Grafana folder in your environment ex. /volume1/docker/grafana
Open up the control panel in your Synology.
Go to the task scheduler tab on the left.
Create a new task as a user-defined script.
General: Install Grafana, User: Root, Enabled = true
Schedule: Run on the following date -> do not repeat
Task settings: email if you want, for the User-Defined Script section:
docker run -d --name=grafana \
-p 3010:3000 \
-v /docker/grafana:/var/lib/grafana \
--restart always \
grafana/grafana
chown -R 472:472 /volume1/docker/grafana
6. Close the window and click ok on the red button if prompted.
7. Select the new line item in the task list, then click run.
8. Then click yes.
9. Browse to http://hostname:3010 and you should see the Grafna login page.
Setting up Varken in Docker
Resource: Varken wiki
Set up a Varken folder in your environment ex. /volume1/docker/varken
Open up the control panel in your Synology.
Go to the task scheduler tab on the left.
Create a new task as a user-defined script.
Script Settings:
General: Install Varken, User: Root, Enabled = true
Schedule: Run on the folling date -> do not repeat
Task settings: email if you want, for the User-Defined Script section:
docker run -d \
--name=varken \
-v /docker/varken:/config \
-e TZ=America/Chicago \
boerderij/varken:latest
Close the script and agree to any warnings.
Click the new task in the list and click “run”.
Setting Up Telegraf in Docker
Resource: docker.com
Set up a Telegraf folder in your environment ex. /volume1/docker/telegraf
Open up the control panel in your Synology.
Go to the task scheduler tab on the left.
Create a new task as a user-defined script.
Script Settings:
General: Install telegraf, User: Root, Enabled = true
Schedule: Run on the folling date -> do not repeat
Task settings: email if you want, for the User-Defined Script section:
sudo docker run -d \
--name=telegraf \
--net=host \
--pid=host \
--restart always \
--volume /docker/telegraf/config/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--volume /sys:/host/sys:ro \
--volume /proc:/host/proc:ro \
--volume /etc:/host/etc:ro \
-e "HOST_PROC=/host/proc" \
-e "HOST_SYS=/host/sys" \
-e "HOST_ETC=/host/etc" \
telegraf:alpine
Close the script and agree to any warnings.
Click the new task in the list and click “run”.
NOTE: If the script fails, you may need to create the following as a blank file:
/volume1/docker/telegraf/config/telegraf.conf
Setting up Tautulli in Docker
Set up a Tautulli folder in your environment ex. /volume1/docker/tautulli
Browse to the Image section in Docker and click on the Tautulli image then click Launch.
Use the bridged network mode
Give it a name, allow it to restart, and allow the requested ports.
Continue to the folder mapping.
docker/tautulli/config is mapped to /config
Allow to run after wizard completion and close the window.
The Synology Web Station app should open now. If it does not, go to the Synology desktop start menu and search for it then open.
Go to the Web Services Portal and then click create.
Select “package server portal”
Select docker and then click next.
Service: Docker Tautulli *
Type: port based
Uncheck 80/443
Check HTTP and enter port 8181
Click apply.
Browse to http://hostname:8181
Follow prompts to set up with your Plex instance.
Generate an API key for use later.
Setting up InfluxDB
Open the Docker app on the Synology desktop web page.
Click on the InfluxDB container in the containers tab.
Click details.
Click the terminal tab at the top.
Click the “create” button at the top left of the window.
In the new terminal session, with your own data, enter this command:
influx user create -n johndoe -p PaSsWoRd -o example-org
Close the window.
Get Maps API Key
Go to MaxMind and make an account or sign in.
Under “Account” click on “Manage License Keys”.
Generate a new key and save it in a safe place.
Setting up Varken
Stop the Docker container in the Docker app on the Synology desktop.
Using VS Code or a similar code editing tool, open;
/volume1/docker/varken/varken.ini
Enter your Influxdb credentials, IP/Hostname, and port number.
Enter any credentials to other applications you may want to stream into Influx.
Enter your MaxMind license key.
Enter your API key for Tautulli and the url of the Tautulli server.
Save and close the file.
Setting up Grafana
Go to your Grafana instance (http://hostname:3010).
Set up your local account (Default login is admin:admin).
Go to the settings and import your InfluxDB database.
Settings -> Datasources
Click “Add Data Source” and then choose InfluxDB
Name: Telegraf
URL: http://hostname:8086
Access: Server
Database: telegraf
User: admin
Password: whatever you set
HTTP method: Get
Save and test.
Go to the settings again, we will be importing a second database
Settings -> Datasources
Click “Add Data Source” and choose InfluxDB.
Name: Varken
URL: http://hostname:8086
Access: Server
Database: varken
User: admin
Password: whatever you set
HTTP method: Get
Save and test.
Now we will import a premade dashboard or you can feel free to make your own.
In Grafana, go to dashborads -> browse.
Click import on the right.
Enter ID 9558 and click load (Resource: Grafana.com)
In the dashboard, link the proper data sources to the proper attributes.
Edit away at the dashboard!