How to Add Data Source?
In this section, we gonna learn how to add a data source to Grafana. We talked about how to build local Grafana at the previous post. You can click to access previous post, Creating Grafana Environment
Now, let's talk about data sources in Grafana. Grafana provides some data sources that might be a database or store something about data. However, in this article I will show you how to connect Elasticsearch and PostgreSQL data sources.
Add Elasticsearch Data Source
Now, if you have a Elasticsearch data source we can start to add with own connection informations. Please follow these steps:
- Open local Grafana and go to left menu and click Data Sources
- Click Add data source button on this page.
- Okay. Please select Elasticsearch on the list.
- Enter your Elasticsearch connection information(At Auth section). I entered my Elasticsearch connection information that is on a live server. You must customize according to yourself.
- Now, There is important step to connect. On the Elasticsearch Detail section you must enter your Elastic index name that you want to track. My Elasticsearch index name is "traffic" so I entered it. The other information is Time Field Name. Elasticsearch stream data always has its own time history value. My time field name is executeAt. You must enter your own time field.
- Click Save & Test button. And done!
Add PostgreSQL Data Source
- Open Data Sources List and select PostgreSQL
- Enter your PostgreSQL connection informations and click Save & Test
After adding own data sources you can check the data sources list on the left menu. You must see two data sources Elastic and Postgre :)
If you have been able to follow these steps, we will continue to creating dashboards and some graphs! Please keep following.