Instaclustr Monitoring API with Prometheus
Instaclustr’s monitoring API is designed to allow you to integrate monitoring information from your Instaclustr managed clusters with the monitoring tool used for your applications. Prometheus (https://prometheus.io/) is an open-source platform for monitoring a range of applications. This help article walks you through how to configure Prometheus to monitor your clusters.
prometheus.ymllocated in the Prometheus root folder. Here is an example:
- job_name: 'instaclustr_prometheus_example'
- targets: ['api.instaclustr.com']
<your_user_name>etc. Your username and monitoring API key can be created in the Instaclustr console, in the Account tab. Make sure to copy your API key as it will only be displayed once.
To specify the metrics you would like Prometheus to scrape from our Monitoring API, replace <your_metrics_string> in the metrics field to include the metrics you would like to collect. Metrics must be added as a single string, with each metric separated by a comma.
Eg. ‘n::cpuutilization::percentage,cf::<your_keyspace>::<your_table>::diskused::totaldiskspaceused’ will collect metrics on the current CPU utilisation (as a percentage) and total disk used by the table specified in <your_keyspace>::<your_table>.
Each request must contain a string containing at least one metric and is limited to a total of 20 metrics per request.
For available metrics, please refer to https://www.instaclustr.com/support/api-integrations/api-reference/monitoring-api/.
Also, you could change the
monitoring/v1/nodes/<node_id> if you would like to collect metrics on datacentre level or node level instead of cluster level. If you would like to collect metrics for multiple clusters, please add different jobs for different clusters in the Prometheus config.
If everything is configured correctly, you should be able to run
./prometheus --config.file=prometheus.yml to start Prometheus.
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’.
As you can see from the graph above, table and node metrics have different prefixes, “ic_table” and “ic_node” respectively, in the metric names. Also, most of the metrics name include unit such as bytes, microseconds etc.
Also, if you specify subtype for a metric in the config file, the subtype will be included as a label in the returned prometheus metric. In the graph above, “ic_node_cpu_utilization” has “percentage” as the type label. For more info on metric subtypes, please refer to https://www.instaclustr.com/support/api-integrations/api-reference/monitoring-api/.