With the release of Grafana 5.2, users can now configure Elasticsearch as a data source with alerts. Consequently, Aiven users can now configure alerts based on hosted Elasticsearch queries.
This new feature is especially powerful if you're sending your Aiven service logs to an Elasticsearch instance through the Aiven Elasticsearch log integration.
This short, seven-step guide will take you through all of the initial steps to set up alerts for your Aiven Elasticsearch queries within your Aiven Grafana dashboard.
Step 1: Log into Grafana
You can log into Grafana manually or by clicking the host link from your Aiven Grafana instance overview page within the Aiven Console.
Whether logging in manually or accessing the Grafana login page via the Aiven Console, you will be taken here:
After you log into Grafana, you will be taken to your Home Dashboard view.
Step 2: Go to data sources view
From your Home Dashboard, hover over the Configuration icon (the gear icon) to reveal the Configuration menu: select Data Sources from the menu.
Step 3: Select your Elasticsearch instance or click on Add data source from within the configuration screen.
After selecting Data Sources, you'll be taken to the Data Sources tab of the Configuration page. If you have an Elasticsearch instance within the same project, it'll be automatically configured and pre-populated like below.
NB! If you don't, click the green Add data source button to the right to manually configure.
If you do not have an Aiven Elasticsearch instance within the same project as your Aiven Grafana instance, continue to Step 4; otherwise, jump to step 5.
Step 4: Configure your Elasticsearch instance as a data source
Configure your settings. Once finished, click the Save & Test button at the bottom of the input fields.
Once you configure and save your Elasticsearch instance as a data source, it is time to either create a new dashboard with a Graph panel or simply add a graph panel to an existing dashboard.
Step 5: Create a graph panel
From within the dashboard page, click the Add panel icon at the top of the page. This will open your panel menu; next select a Graph panel.
When the panel is created, click the dropdown menu next to the title of the panel and select edit to configure your graph.
When you select edit, you will be taken to the Graph panel's settings screen with the Metrics tab open by default. Here, you will configure your graph's data source.
Step 6: Add your Elasticsearch instance as the data source from the Metrics tab
- Select your Elasticsearch instance as the data source from the Data Source dropdown.
- Configure your query or queries according to your preferences.
The last step will be to configure your alert settings from within the Alerts tab.
Step 7: Add and configure your first alert from the Alert tab
Once in the Alerts tab, configure your alert to your preferences. After you configure your settings, validate the alert by clicking the Test Rule button.
If the system validates your alert, save your dashboard by clicking the save icon in the header bar or pressing Ctrl+S (or Cmd+S if you're a Mac user).
After you save your configuration, your Elasticsearch dashboard will show your graph with the alert threshold indicated by a thin, red line.
Now you've successfully set up your first Elasticsearch alert in Grafana.
Got here by accident? Learn how Aiven simplifies working with Grafana: