Categorygithub.com/arangodb-helper/arangodb-exporter
modulepackage
0.0.0-20210601133155-eaff91f8d23f
Repository: https://github.com/arangodb-helper/arangodb-exporter.git
Documentation: pkg.go.dev

# README

ArangoDB Exporter for Prometheus

This exporter exposes the statistics provided by a specific ArangoDB instance in a format compatible with prometheus.

Deprecation notice

This component has been deprecated.

Recent ArangoDB versions support exposing metrics directly into a Prometheus format. We recommend using that.

For more details on how to do that, go to github.com/arangodb/kube-arangodb/docs/design/exporter.md.

Usage

To use the ArangoDB Exporter, run the following:

arangodb-exporter \
    --arangodb.endpoint=http://<your-database-host>:8529 \
    --arangodb.jwtsecret=<your-jwt-secret> \
    --ssl.keyfile=<your-optional-ssl-keyfile>

This results in an ArangoDB Exporter exposing all statistics of the ArangoDB server (running at http://<your-database-host>:8529) at http://<your-host-ip>:9101/metrics.

Exporter modes

internal

Use internal metrics exporter mode for ArangoDB < 3.6.0

In this mode metrics are calculated on ArangoDB Exporter side

passthru

Expose ArangoDB metrics for ArangoDB >= 3.6.0

In this mode metrics provided by ArangoDB _admin/metrics are exposed on Exporter port.

Running in Docker

To run the ArangoDB Exporter in docker, use an image such as arangodb/arangodb-exporter:0.1.3.

Configuring Prometheus

There are several ways to configure Prometheus to fetch metrics from the ArangoDB Exporter.

Below you're find a sample Prometheus configuration file that can be used to fetch metrics from an ArangoDB exporter listening on localhost port 9101 (without TLS).

global:
  scrape_interval:     15s
scrape_configs:
- job_name: arangodb
  static_configs:
  - targets: ['localhost:9101']

For more info on configuring Prometheus go to its configuration documentation.

If you're using the Prometheus Operator in Kubernetes, you need to create an additional Service and a ServiceMonitor resource like this:

kind: Service
apiVersion: v1
metadata:
  name: arangodb-exporters-service
  labels:
    app: arangodb-exporter
spec:
  selector:
    app: arangodb-exporter
  ports:
  - name: metrics
    port: 9101

---

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: arangodb-exporter
  namespace: monitoring
  labels:
    team: frontend
    prometheus: kube-prometheus
spec:
  namespaceSelector:
    matchNames:
    - default
  selector:
    matchLabels:
      app: arangodb-exporter
  endpoints:
  - port: metrics
    scheme: https
    tlsConfig:
      insecureSkipVerify: true

Note 1: that the typical deployment on the Prometheus operator is done in a namespace called monitoring. Make sure to match the namespace of the ServiceMonitor to match that.

Note 2: that the Prometheus custom resource has a field called serviceMonitorSelector. Make sure that the matchLabels selector in there matches the labels of your ServiceMonitor.

Building

To build this project, you need Go 1.12 or higher and Docker installed. Then run:

DOCKERNAMESPACE=<your docker hub account name> make

# Packages

No description provided by the author

# Functions

CreateArangodJWT creates a superuser arangod jwt.
CreateArangodJwtAuthorizationHeader calculates a JWT authorization header, for authorization of a request to an arangod server, based on the given secret.
GetStatistics requests the statistics values from the given connection.
GetStatisticsDescription requests the statistics description from the given connection.
NewExporter returns an initialized Exporter.
No description provided by the author
NewServer creates a new server, fetching/preparing a TLS certificate.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Exporter collects ArangoDB statistics from the given endpoint and exports them using the prometheus metrics package.
Server is the HTTPS server for the operator.
ServerConfig settings for the Server.
StatisticFigure describes a single statistic.
StatisticGroup describes a group of statistics.
StatisticsDescription is the JSON representation of the result of an _admin/statistics-description call.

# Type aliases

No description provided by the author
No description provided by the author
FigureType is a strongly typed type of statistic.
Statistics is a stringly typed map containing statistic values.