Prometheus and Grafana Setup
Setup Prometheus and Grafana to view app metrics
Grainite provides a counters/metrics endpoint that includes various counters and gauges to provide insight into applications, as well as the server itself. This page goes over setting up Prometheus to access these metrics in Grafana.
Prerequisites
Prometheus Setup
Note: The following instructions apply to Grainite clusters or servers with TLS enabled.
Copy the new client certificates to the config directory. Example:
cp ~/.gxscerts/<cluster-name>/client/<user-name>/* /etc/config/gxs-client-secret
where<cluster-name>
is the name of the current cluster.Grainite exposes the counters at
<server_ip>:5064/export-dashboard
. To have Prometheus use this, set up your Prometheus configuration file (prometheus.yml
) withscheme
andtls_config
attributes like in the following example:
Where:
<server-IP>
is the IP address of the cluster or server. You can get the IP address by following the instructions linked here.<user-name>
corresponds to the user name specified when generating the client certificate.
After adding the above to the Prometheus configuration file, restart Prometheus for it to pick up the updated targets. Once Prometheus is restarted, confirm that "grainite" is shown as a target for Prometheus:
Grafana Setup
Add Prometheus as a data source in Grafana by going to Settings -> Data sources -> Add data source
and selecting Prometheus, filling in the URL, and clicking on Save & test
.
Now, app counters can be accessed by using Prometheus as a data source and searching for counters/gauges beginning with gxsapp
. The format for app metrics is the following:
Counters:
gxsapp_<counter name>_total
Gauges:
gxsapp_<gauge name>_current
Last updated