Elasticsearch
- Download ES 5.6.0 from the official site and unpack
- bin/elasticsearch
- Web-Frontend can be found at http://localhost:9300
Elasticsearch is a document database that stores documents as JSON. Documents can be stored and retrieved by its HTTP API (there are also libraries for the most popular programming languages). Furthermore, ES stores documents into what is called indices and types. An index could be compared to a database in a relational DBMS and a type could be compared with a table.
For example: you could have an index called customers with a type invoices and another type addresses. You can think of types about something that logically belongs to an index (a customer has an address and one or more invoices).
For example: you could have an index called customers with a type invoices and another type addresses. You can think of types about something that logically belongs to an index (a customer has an address and one or more invoices).
Grafana
- Download Grafana from the official site and unpack
- bin/grafana-server
- Web-Frontend can be found at http://localhost:3000
Configure a Data Source:
- Go to http://localhost:3000/datasources and click on "add data source"
- Enter a name for the data source and select "Elasticsearch" from the Type drop-down
- As long as you didn't changed the default ES configuration, enter "http://localhost:9300" in the Url field.
- Access must be set to "Proxy"
- Enter the name of your index (for this example, we need no pattern)
- Every JSON document you insert into ES must have an ISO date field, e.g. 2017-07-20T14:00:00. This is important, because as mentioned before, Grafana is designed to work with time series based data. Therefore, enter the name of the field that contains the ISO date into the field "time field name" (without a leading @). I called this field "insert_time" (as shown in the screenshot below).
- Since we are using ES 5.6.0, select version 5.x from the Version drop-down
Configure a Dashboard:
- Go to http://localhost:3000/?orgId=1 and click on "Create your first dashboard"
- Click on "Graph" to create a new graph dashboard
- Click on "Panel Title", then click on "Edit" (after that, the Graph configuration appears down below)
- In the "General" tab, you can give the dashboard a name
- In the top-right corner, select a time range (e.g. last 90 days), where you know that there is some data
- If you wonder why you don't see anything, go to the "Display" tab and
- Draw Modes: select "Lines"
- Stacking & Null value: select "connected" for Null value
- In case your JSON documents have a field that contains a numeric value that you want to visualize, you can also use the existing aggregate functions. Therefore, go to the "Metrics" tab and for example select "Average" as Metric and your timestamp/date field for "Group by" and select "Date Histogram" from the drop-down.
That's it! Thank you for reading.
No comments:
Post a Comment