Skip to main content
Loading
Version: Operator 3.4.0

Monitor Aerospike clusters

This page describes how to use Prometheus and Grafana to monitor Aerospike clusters.

Overviewโ€‹

To monitor Aerospike clusters, expose the Aerospike Database metrics and make them readable by Prometheus. Use the Aerospike Monitoring Stack or the Prometheus Operator to monitor and set alerts for Aerospike clusters deployed by Aerospike Kubernetes Operator (AKO).

Expose metrics for Prometheusโ€‹

Expose the metrics for Prometheus with the Aerospike Prometheus Exporter (APE), which runs as a sidecar container in the same Kubernetes pod as your Aerospike Database container.

You can configure the APE to connect to your Aerospike Database cluster using either plaintext authentication or a Kubernetes secret. The process for using a secret is longer, but you should always enable security in a production environment.

For testing purposes, you can pass your credentials to the cluster in plain text. The following example modifies the podSpec section of your Aerospike cluster's Custom Resource (CR) file with a sidecars section. Replace the values for AS_AUTH_USER and AS_AUTH_PASSWORD with your actual credentials.

spec:
...
podSpec:
multiPodPerHost: true
sidecars:
- name: aerospike-prometheus-exporter
image: aerospike/aerospike-prometheus-exporter:latest
env:
# Replace with your credentials
- name: "AS_AUTH_USER"
value: "exporter"
- name: "AS_AUTH_PASSWORD"
value: "exporter123"
- name: "AS_AUTH_MODE"
value: "internal"
ports:
- containerPort: 9145
name: exporter

Scrape metrics with Prometheusโ€‹

To collect metrics from the APE, configure Prometheus to scrape the /metrics endpoint exposed by the exporter. You can do this manually by installing and configuring the Prometheus Operator from GitHub, or by using the pre-built AKO monitoring stack.

Scrape with the Prometheus Operatorโ€‹

  1. Follow the directions in GitHub at Install Prometheus Operator to install the kube-prometheus-stack, which includes the Prometheus Operator and Grafana. The Prometheus Operator uses a PodMonitor resource to scrape the exporter endpoints.

  2. Create a file named pod-monitor.yaml with the following content.

    apiVersion: monitoring.coreos.com/v1
    kind: PodMonitor
    metadata:
    name: aerospike-cluster-pod-monitor
    namespace: aerospike
    labels:
    release: prometheus-operator
    spec:
    selector:
    matchLabels:
    app: aerospike-cluster
    namespaceSelector:
    matchNames:
    - default
    - aerospike
    podMetricsEndpoints:
    - port: exporter
    path: /metrics
    interval: 30s
  3. Apply the PodMonitor resource.

    kubectl apply -f pod-monitor.yaml

Scrape with the AKO monitoring stackโ€‹

The AKO repository, includes monitoring configurations in the config/ directory. Apply them with kubectl.

  1. Apply the monitoring stack:

    kubectl apply -k config/monitoring
  2. To configure alerts, create Prometheus rule YAML files in the aerospike-kubernetes-operator/config/monitoring/prometheus/config/alert-rules directory. Aerospike provides predefined Prometheus alert rules in the Aerospike Monitoring GitHub repository.

Grafana dashboardsโ€‹

To visualize the metrics, import pre-built Grafana dashboards from the Aerospike Monitoring GitHub repository or from Grafana Labs.