Free Monitoring using InfluxDB, Telegraf and Grafana – Part II
After the first post in wich we explain how to install Telegraf and configure InfluxDB now we are going to explain how to connect InfluxDB with Grafana to show the data collected.
Before starting the post we must have a previous scenario to be able to use this agent. We will use two servers that we will call Server1 and Server2:
- Server1 with InfluxDB and Grafana installed. We have used a Linux server. Here you can see how to install InfluxDB and Grafana
We must open the output port 3000, it is the one that Grafana uses and enable the input port that InfluxDB uses. The default port is 8086.
- Server2: A machine that we want to monitor, in our case it will be Windows. With the output port that we have enabled for Influxdb open. 8086 if it is the default port.
As in the previous post we already carried out the installation and configuration of Telegraf to InfluxDB, now we only have to configure the connection from InfluxDB to Grafana:
1. Connecting InfluxDB with Grafana
We will enter server1 where we will check that the Grafana service is working:
sudo systemctl status grafana-server
We already have it active, but if not, we can start the service with a similar command:
sudo systemctl start grafana-server
And to stop the service:
sudo systemctl stop grafana-server
Once the service is started we will open a browser (It does not matter if it is a machine outside our network since we have enabled port 3000.) and write to the ip + port of our Server1:
EX: 123.123.123: 3000
The default username and password is admin.
We login with an administrator user and go to the organizations part, it is located in the menu on the left and select Orgs.
In the next window we will create a new organization in which we will configure the connection to the database. Click on New Org.
When we create it, the organization will automatically be selected. To check it, we can click on our user in the lower left.
Again, in the part of the upper menu on the left we will click on Data Sources.
Click on Add data source and a window will appear with different types of databases. By having InfluxDB installed, we simply have to select it and configure the connection. We will fill in the boxes in this way and in the URL we will have to change the port if we have modified it in the InfluxDB configuration.
A little further down we will find the configuration of the database that we have created in the previous post.
With this we already have our Grafana connected to the Database, but with this we cannot see the data collected from Telegraf. We need to create or import dashboards to show the data.
2. Import dashboards
To download already created panels, we can enter the link and download the one we want. There are a lot of dashboards, for Windows, SQL, Linux, etc.
We have used this Windows dashboard.
We enter + and click on Import
A new window will appear in which we can load the panel that we have downloaded in json format.
To show all the panels that we have created we will go to the icon:
And select where it says Manage. Select the one we have upload.
And now we can see the data collected.
Following this steps we are able to monitor our Windows server, remember that Telegraf have many plugins for all the technologies, Linux, SQL Server, Azure, AWS, Salesforce, etc.
Database Administrator. Centrado en la monitorización y el rendimiento de las bases de datos.