Out of the box PostgreSQL® monitoring with InfluxDB® and Grafana® dashboards
Monitor your Aiven services without leaving the console!
Grafana® visualizes time series data as a graph, allowing you to observe how your application behaves over time. Grafana dashboards offer insights to all kinds of stakeholders, regardless of their technical skills. It's no surprise then that Grafana was built on the principle that data should be accessible to everyone in your organization.
Aiven for Grafana® lets you monitor your stack with a number of prebuilt dashboards for many services! This gives you a head start in organizing your data for observability so you can get back to building your application.
Aiven lets you integrate with services in two different ways:
- External integrations allow you to expose your service metrics and logs to external
tools you might be already using like Datadog or AWS Cloudwatch - Internal integrations allow you to use other Aiven services to build your monitoring
platform
This allows you the flexibility to send your service metrics to monitoring and observability
tools you might already be using, or to take advantage of the ease of configuration and
management that Aiven provides. In this example, we'll be using an internal integration
with Grafana to show you how quick and easy it is, but in reality Aiven offers you many
options!
We'll set up monitoring for an Aiven for PostgreSQL® database using Aiven for InfluxDB® as back-end for our time series metrics, and Aiven for Grafana® as a metrics dashboard. It'll look something like this:
Set up PostgreSQL
First we need to create the PostgreSQL database. Head over to the
Aiven Console to create a new service
with the following configuration:
- Cloud service provider: Any provider
- Service plan: Business-4. For this tutorial, we need a high availability pair.
- Service name:
pg-to-be-monitored
Set up the metrics integration
The PostgreSQL instance takes time to initialize, but we can start our integration with InfluxDB while it finishes. On the pg-to-be-monitored
service detail page, click on the Integrations tab and explore the list of available options.
Aiven integrations are divided into two main sections:
- External integrations allow you to expose your service metrics and logs to external tools you might be already using like Datadog or AWS Cloudwatch
- Internal integrations allow you to use other Aiven services to build your monitoring platform
Select the Store Metrics option, as this lets us use Aiven's preconfigured Grafana dashboards in the next step. In the popup window we then select the target backend and either reuse an existing service, or spin up a new service.
In most cases, you should send your monitoring to a separate database and stack to prevent monitoring failures.
Aiven lets you create any new services needed for an internal integration from an existing service, with no need to navigate back out to the console home. Select the New service > New InfluxDB service. Then we'll be able to chose the service name, Cloud provider, region and service plan.
Tip: Using the same cloud provider and region you used for your PostgreSQL database when setting up your monitoring database and dashboard reduces overall latency.
Set up Grafana
After sending our metrics to InfluxDB, we might want to perform some analytics and set up some dashboards for it. The good news is that Aiven can do all that for us. We can head to the newly created InfluxDB service, and click again on the Integrations tab, from which we can select Grafana Metrics Dashboards.
We can either reuse an existing Grafana service or create a new one. If you need to create a new Aiven for Grafana service, select it from the Dashboard homepage and select an appropriate cloud provider, region, service plan and name.
Now we can review the list of integrations in the Aiven for InfluxDB service.
Check the pre-built dashboards
Once the Grafana instance is up and running, find the URI, username and password on the service homepage and log into your Grafana instance.
Do we need to hand craft a new dashboard? Absolutely not, that's time consuming! We can reuse what the Aiven engineers are using to monitor Aiven itself: the dashboard integration created at the previous step already set up a prebuilt visualization on all the most important metrics.
To access the prebuilt dashboard we need to:
- Login to Grafana
- Navigate to Dashboard and then Browse
- Under the General folder we can find a dashboard name
Aiven for PostgreSQL - <SERVICE_NAME> - Resources
- Click on it, and... Profit!
Tip: If you want to change the dashboard, create a copy of it and rename it, otherwise your changes will be lost when we upgrade.
New features in Grafana 9
At the time of this writing, Aiven supports Grafana 9.2.4. Grafana 9 is a major version bump with exciting new features, like new UI query builders for Prometheus and Loki, and a renewed heatmap panel. Hoang Minh Vo, Technical Product Manager at Aiven, wrote about the Grafana 9 features he's excited about, and that Grafana Alerting is now on by default.
Excited to try out Grafana Alerting? Use their sandbox to get a feel for the feature.
You can set up other Aiven services as data sources for Grafana too, like MySQL, ClickHouse®, OpenSearch® and InfluxDB®. Try it out with your database today!