Using the Instaclustr Monitoring API with PrometheusMenu
Note: Instaclustr is currently working on a prometheus compatible API which will make this method obsolete.
Instaclustr’s monitoring API is designed to allow you to integrate the monitoring information from your Instaclustr managed cluster with the monitoring tool used for the entire application. Prometheus (https://prometheus.io/) is an open-source platform for monitoring a range of applications. This help article walks you through how to use the Instaclustr Monitoring API with Prometheus using an exporter.
At a high-level, the process involves using a script, created by one of our customers, to grab metrics from the Instaclustr Monitoring API at regular intervals and convert them into a format that is readable by Prometheus. This may also involve installing some prerequisite software if it is not already installed on the machine. You can find more information on the script we will be using here: https://github.com/fcgravalos/instaclustr_exporter
Follow these steps to set up your environment:
- Set up a Cassandra cluster with Instaclustr (see https://www.instaclustr.com/support/documentation/getting-started/creating-a-cluster/)
- Locate your Instaclustr username, monitoring API key and provisioning API key. (From the console, click ‘Account’ and then ‘API Keys’)
- Install ‘Go’ on the machine (https://golang.org/doc/install)
- Ensure Go is in the system path (check the install link above)
- Set the
GOPATHenvironment variable (https://github.com/golang/go/wiki/SettingGOPATH)
$GOPATH/binto the system path (and create the bin folder if it doesn’t exist, this is similar to step 3 above)
A customer has created a script that calls the Instaclustr API and passes on the data in a Prometheus friendly format. The script is available on GitHub here: https://github.com/fcgravalos/instaclustr_exporter. You can download the ZIP file or clone the repository.
After downloading the files, make sure they are in a folder named
instaclustr_exporter and relocate this folder to
In the folder directory (
make -f Makefile and wait for it to finish. Once that’s done, run the script using the username, monitoring API key and provisioning API key you located earlier:
./instaclustr_exporter -instaclustr.user YOURUSER -instaclustr.monitoring-apikey YOURMONITORINGAPIKEY -instaclustr.provisioning-apikey YOURPROVISIONINGAPIKEY
If this was successful, you will be provided with a port and the script should be running:
INFO [instaclustr_exporter] started on :9279
You can check that the script is running by visiting the port in a browser with: ‘http://localhost:XXXX’ where XXXX is the port (9279 in this case)
If you haven’t already, download the pre-compiled Prometheus binaries (https://prometheus.io/download/).
Edit the Prometheus config file
prometheus.yml located in the prometheus root folder, the important part is that we create a new job that targets the output location of the
instaclustr_exporter script, here’s an example:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'YOUR JOB NAME'
# Override the global default and scrape targets from this job every 5 seconds.
- targets: ['localhost:XXXX'] #YOUR PORT HERE
group: 'YOUR GROUP NAME'
Fill in the ‘YOUR X’ sections and save the file.
For more configuration options see: https://prometheus.io/docs/prometheus/latest/configuration/configuration/
Run Prometheus with the following command in the Prometheus root folder:
If all has gone well, you should be able to view Prometheus from a browser by visiting http://localhost:9090, with exported metrics now visible at ‘localhost:9090/graph’ via the ‘insert metric at cursor’ dropdown.
On the Prometheus graphs page (http://localhost:9090/graph) select a metric from the ‘- insert metric at cursor -’ dropdown box.
Once a desired metric has been selected, select Graph (if you want a time series style graph view) or Console (if you want a (key, value) view) and then click ‘Execute’.
The desired metric should now be displaying.
When selecting graph, you can also change the duration and time range for the graph (only data points after the start time of the
instaclustr_exporter script will be visible)