gluster-prometheus

module
v0.0.0-...-3ebaacc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2020 License: LGPL-2.1

README

= Prometheus exporter for Gluster Metrics

image:https://travis-ci.org/gluster/gluster-prometheus.svg?branch=master["Build Status", link="https://travis-ci.org/gluster/gluster-prometheus"]

These exporters will be run on all Gluster peers, So it makes sense to
collect only local metrics and aggregate in Prometheus server when
required.

== Install

----
mkdir -p $GOPATH/src/github.com/gluster
cd $GOPATH/src/github.com/gluster
git clone https://github.com/gluster/gluster-prometheus.git
cd gluster-prometheus

# Install the required dependancies.
# Hint: assumes that GOPATH and PATH are already configured.
./scripts/install-reqs.sh

PREFIX=/usr make
PREFIX=/usr make install
----

== Usage

Run `gluster-exporter` with default settings, glusterd is consumable
at http://localhost:9713/metrics

----
systemctl enable gluster-exporter
systemctl start gluster-exporter
----

Systemd service uses following configuration file for global and
collectors related configurations.

.`/etc/gluster-exporter/gluster-exporter.toml`
[source,toml]
----
[globals]
gluster-mgmt = "glusterd"
glusterd-dir = "/var/lib/glusterd"
gluster-binary-path = "gluster"
# If you want to connect to a remote gd1 host, set the variable gd1-remote-host
# However, using a remote host restrict the gluster cli to read-only commands
# The following collectors won't work in remote mode : gluster_volume_counts, gluster_volume_profile 
#gd1-remote-host = "localhost"
gd2-rest-endpoint = "http://127.0.0.1:24007"
port = 9713
metrics-path = "/metrics"
log-dir = "/var/log"
log-file = "gluster-exporter.log"
log-level = "info"

[collectors.gluster_ps]
name = "gluster_ps"
sync-interval = 5
disabled = false

[collectors.gluster_brick]
name = "gluster_brick"
sync-interval = 5
disabled = false
----

To use `gluster-exporter` without systemd,

----
gluster-exporter --config=/etc/gluster-exporter/gluster-exporter.toml
----

== Metrics

List of supported metrics are documented link:docs/metrics.adoc[here].

== Adding New metrics

* Add new file under `gluster-exporter` directory.
* Define Metrics depending on the type of
  Metric(https://prometheus.io/docs/concepts/metric_types/)
  For example, "Gauge" Metrics type

[source,go]
----
glusterCPUPercentage = prometheus.NewGaugeVec(
    prometheus.GaugeOpts{
        Namespace: "gluster",
        Name:      "cpu_percentage",
        Help:      "CPU Percentage used by Gluster processes",
    },
    []string{"volume", "peerid", "brick_path"},
)
----

* Implement the function to gather data, and register to gather data
  in required interval

[source,go]
----
prometheus.MustRegister(glusterCPUPercentage)

registerMetric("gluster_brick", brickUtilization)
----

* Add an entry in /etc/gluster-exporter/gluster-exporter.toml

[source,toml]
----
[collectors.gluster_ps]
name = "gluster_ps"
sync-interval = 5
disabled = false
----

* Thats it! Exporter will run these registered metrics.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL