Skip to main content
Loading

Configure a Grafana server

Overview

This page describes how to configure a Grafana server to add the Prometheus datasource, Alertmanager datasource, and Aerospike dashboards.

#################################### Paths ####################################
[paths]
# Path to where grafana stores temp files, sessions, and the sqlite3 db (if used)
;data = /var/lib/grafana

# Temporary files in `data` directory older than given duration will be removed
;temp_data_lifetime = 24h

# Directory where grafana stores logs
;logs = /var/log/grafana

# Directory where grafana will automatically scan and look for plugins
;plugins = /var/lib/grafana/plugins

# folder that contains provisioning config files that grafana will apply on startup and while running.
provisioning = /etc/grafana/provisioning

Edit the grafana.ini file

Open the file /etc/grafana/grafana.ini for editing.

info

If you are running Grafana in a Docker container, log in to the running container as root. Only the root user has permission to write to this file.

Change the permissions on /etc/grafana/grafana.ini to make it writeable.

To make the file writeable and leave all other permissions as is, use this chmod command:

chmod 664 /etc/grafana/grafana.ini

Point to the /etc/grafana/provisioning/ directory.

In the [paths] section, uncomment the provisioning parameter and change the value to /etc/grafana/provisioning/:

# folder that contains provisioning config files that grafana will apply on startup and while running.
provisioning = /etc/grafana/provisioning

If you installed Grafana on a node of your Aerospike cluster, change the HTTP port for Grafana to use.

The default HTTP port for Aerospike nodes is 3000. This is also the default HTTP port for Grafana. If any nodes in your Aerospike cluster are using the default of port 3000, then you must specify a non-default port for Grafana.

In the [server] section, uncomment the http_port parameter and change the value from 3000 to a different HTTP port, as in this example:

# The http port to use
http_port = 3100

Add your Prometheus server and Prometheus AlertManager as datasources.

The following steps describe how to install the plugin for the AlertManager datasource, download an example file from Aerospike's aerospike-monitoring GitHub repository, and then edit the file.

Complete all the steps in this procedure on this page before you restart Grafana.

Install the Alertmanager plugin so that Grafana can use Prometheus Alertmanager as a datasource.

grafana-cli plugins install camptocamp-prometheus-alertmanager-datasource

The grafana-cli displays this output:

✔ Downloaded camptocamp-prometheus-alertmanager-datasource v1.0.0 zip successfully

Restart Grafana after installing plugins. Refer to Grafana documentation for instructions if necessary.

Create a datasources folder in Grafana's provisioning directory, then change to that folder.

mkdir -p /etc/grafana/provisioning/datasources
cd /etc/grafana/provisioning/datasources

Download Aerospike's example file.

wget https://raw.githubusercontent.com/aerospike/aerospike-monitoring/master/config/grafana/provisioning/datasources/all.yaml

Edit the URLs in the file. Point to the servers where Prometheus and Prometheus AlertManager are running. Include the HTTP ports that they are using.

Add or upgrade dashboards

Aerospike releases regular improvements and fixes to the Monitoring Stack dashboards on GitHub here: Aerospike Monitoring Releases. To ensure you have the latest dashboards, use the following steps.

caution

The following procedure overwrites any changes you have made to your dashboards. To preserve existing dashboards, rename them and change their ID before you begin.

  1. Download the latest version of monitoring stack.

    wget https://github.com/aerospike/aerospike-monitoring/archive/refs/tags/v3.8.0.tar.gz
  2. Extract the downloaded archive.

    tar -xvf v3.8.0.tar.gz
  3. Copy the dashboards folder to the provisioning directory.

    cp -R ./aerospike-monitoring/config/grafana/dashboards /var/lib/grafana/dashboards
  4. Restart Grafana.