Monitoring with Grafana and InfluxDB using Docker Containers — Part 3: Datasource Configuration and Dashboard Installation
Welcome to Part 3 of my series on setting up Monitoring for your Infrastructure using Grafana and InfluxDB.
Last time, we downloaded our Docker Images for Grafana and InfluxDB, created persistent storage for them to persist our data, and also configured our initial Influx Database that will hold all of our Data.
In Part 3, we’re going to set up InfluxDB as our Datasource for the data and metrics we’re going to use in Grafana. We’ll also download the JSON for our Dashboard from the Grafana Dashboards Site and import this into Grafana instance. This will finish off the groundwork of getting our Monitoring System built and ready for use.
Configure your Data Source
- Now we have our InfluxDB set up, we’re ready to configure it as a Data source in Grafana. So we log on to the Grafana console. Click the “Configuration” button (looks like a cog wheel) on the left hand panel, and select “Data Sources”
- This is the main config screen for the Grafana Instance. Click on “Add data source”
- Search for “influxdb”. Click on this and it will add it as a Data Source:
- We are now in the screen for configuring our InfluxDB. We configure the following options:
- Query Language — InfluxQL. (there is an option for “Flux”, however this is only used by InfluxDB versions newer than 1.8)
- URL — this is the Address of our InfluxDB container instance. Don’t forget to specify the port as 8086.
- Access — This will always be Server
- Auth — No options needed here
- Finally, we fill in our InfluxDB details:
- Database — this is the name that we defined when setting up the database, in our case telegraf
- User — this is our “johnboy” user
- Password — This is the password
- Click on “Save & Test”. This should give you a message saying that the Data source is working — this means you have a successful connection between Grafana and InfluxDB.
- Great, so now we have a working connection between Grafana and InfluxDB
We now have our Grafana instance and our InfluxDB ready. So now we need to get some data into our InfluxDB and use this in some Dashboards. The Grafana website (https://grafana.com/grafana/dashboards) has hundreds of official and community build dashboards.
As a reminder, the challenge here is to visualize WSUS … yes, I know WSUS. As in Windows Server Update Services. Sounds pretty boring doesn’t it? It’s not really though — the problem is that unless WSUS is integrated with the likes of SCCM, SCOM or some other 3rd party tools (all of which will incur Licensing Costs), it doesn’t really have a good way of reporting and visualizing its content in a Dashboard.
- I’ll go to the Grafana Dashboards page and search for WSUS. We can also search by Data Source.
- When we click into the first option, we can see that we can “Download JSON”
- Once this is downloaded, lets go back to Grafana. Open Dashboards, and click “Import”:
- Then we can click “Upload JSON File” and upload our downloaded json. We can also import directly from the Grafana website using the Dashboard ID, or else paste the JSON directly in:
- Once the JSON is uploaded, you then get the screen below where you can rename the Dashboard, and specify what Data Source to use. Once this is done, click “Import”:
- And now we have a Dashboard. But there’s no data! That’s the next step, we need to configure our WSUS Server to send data back to the InfluxDB.
Next time …..
Thanks again for reading! Next time will be the final part of our series, where we’ll install the Telegraf agent on our WSUS Server, use it to run a PowerShell script which will send data to our InfluxDB, and finally bring the data from InfluxDB into our Grafana Dashboard.