Customize Monitoring
On this page
Configure Monitoring using SQL
Note
Using SingleStoreDB Toolbox to configure cluster monitoring is the easier, preferred, and default method.
Enable the Exporter Process
The memsql-exporter
process (or simply the exporter
) collects data about a running cluster.root
user) must have the following permissions at a minimum:
GRANT CLUSTER on *.* to <user>GRANT SHOW METADATA on *.* to <user>GRANT SELECT on *.* to <user>GRANT PROCESS on *.* to <user>
Start the Exporter Process
Perform the following steps on the Source cluster Master Aggregator.
Note that the exporter process is restarted when the exporter_
variable is set to any non-zero value, including the current value.exporter_
variable can be set by running SET GLOBAL exporter_
.
HTTP Connections
You may start the exporter in the SingleStoreDB engine by passing a user, port, and password to the exporter.root
user:
SET GLOBAL exporter_user = root;SET GLOBAL exporter_password = '<secure-password>';SET GLOBAL exporter_port= 9104;
HTTPS Connections
-
Copy the server certificate and key to the Master Aggregator host of the Source cluster.
This certificate will be used by the exporter process and must be readable by the user under which the nodes are running on the host (typically the memsql
user). -
Use the following SQL statements to start the exporter in the SingleStoreDB engine.
SET GLOBAL exporter_user = root;SET GLOBAL exporter_password = '<secure-password>';SET GLOBAL exporter_use_https= true;SET GLOBAL exporter_ssl_cert = '/path/to/server-cert.pem';SET GLOBAL exporter_ssl_key = '/path/to/server-key.pem';SET GLOBAL exporter_ssl_key_passphrase= '<passphrase>';Note: The
exporter_
variable should only be included if the server key has a passphrase.ssl_ key_ passphrase
How to Stop the Exporter Process
You may stop the exporter at any time by running the following command on the Source cluster Master Aggregator.
Use an engine variable to stop the exporter process by setting the port to 0
.
SET GLOBAL exporter_port = 0;
Configure the metrics
Database
The metrics
database can either reside in the Source cluster, in a dedicated Metrics cluster, or in a remote SingleStoreDB cluster that the Metrics cluster can access.
Note that the user that creates the metrics
database may differ from the one that started the exporter.
metrics
Database DDL
You may run the following SQL scripts to configure the database.
Please note the following:
-
The database that is created to store monitoring data is named
metrics
by default.You must edit these SQL statements manually to change the database name. -
The database user is
root
by default.When creating the metrics
database with a database user other thanroot
, theSUPER
privilege must be granted to this user.For example, for a dbmon
user:GRANT SUPER ON *.
* TO 'dbmon'@'%'; -
These commands must be run on the Master Aggregator of the Metrics cluster.
Create the metrics
database and associated tables by copying, pasting, and executing each set of SQL statements below.
You may also download the latest metrics database DDL SQL file from SingleStore.
Pipelines DDL
Run the following in a SQL client.
Note: You must edit exporter-host
and port
in the following SQL statements to align with where your exporter process resides.
-
The
exporter-host
is typically the host of your Source cluster’s Master Aggregator that’s running the exporter, and must includehttp://
. -
The default port for the endpoint is
9104
. -
The IP address provided in the
exporter-host
argument must be resolvable by all hosts in the cluster.If the cluster you are monitoring has hosts that contain leaf nodes (as is common in a multi-host vs. single-host deployment), do not use localhost
.Instead, provide the explicit IP address or hostname that the other hosts in the cluster can resolve.
HTTP Connections
-
Start the
metrics
pipeline.CREATE OR REPLACE PIPELINE metrics.metrics ASLOAD DATA prometheus_exporter"http://<exporter-host>:<exporter-port>/cluster-metrics"CONFIG '{"is_memsql_internal":true, "high_cardinality_metrics":false,"monitoring_version":"<SingleStoreDB version of the 'metrics' cluster>"}'batch_interval 15000INTO PROCEDURE `load_metrics` FORMAT JSON;START PIPELINE IF NOT RUNNING metrics.metrics; -
Start the
blobs
pipeline.CREATE OR REPLACE PIPELINE metrics.blobs ASLOAD DATA prometheus_exporter"http://<exporter-host>:<exporter-port>/samples"CONFIG '{"is_memsql_internal":true,"download_type":"samples", "sample_queries":true,"monitoring_version":"<SingleStoreDB version of the metrics cluster>"}'batch_interval 15000INTO PROCEDURE `load_blobs` FORMAT JSON;START PIPELINE IF NOT RUNNING metrics.blobs;
HTTPS Connections
-
Copy the CA certificate to the same file path on each host of the Metrics cluster.
Alternatively, a directory containing multiple CA certificates can be provided, and this path must be the same on all hosts.
This directory will be used by the monitoring pipelines and must be readable by the user under which the nodes are running on the host (typically the memsql
user). -
Start the
metrics
pipeline.CREATE OR REPLACE PIPELINE metrics.metrics ASLOAD DATA prometheus_exporter"https://<exporter-host>:<exporter-port>/cluster-metrics"CONFIG '{"is_memsql_internal":true, "high_cardinality_metrics":false,"monitoring_version":"<SingleStoreDB version of the 'metrics' cluster>","ssl_ca":"path to ca cert" OR "ssl_capath":"path to ca dir"}'batch_interval 15000INTO PROCEDURE `load_metrics` FORMAT JSON;START PIPELINE IF NOT RUNNING metrics.metrics; -
Start the
blobs
pipeline.CREATE OR REPLACE PIPELINE metrics.blobs ASLOAD DATA prometheus_exporter"https://<exporter-host>:<exporter-port>/samples"CONFIG '{"is_memsql_internal":true,"download_type":"samples", "sample_queries":true,"monitoring_version":"<SingleStoreDB version of the metrics cluster>","ssl_ca":"path to ca cert" OR "ssl_capath":"path to ca dir"}'batch_interval 15000INTO PROCEDURE `load_blobs` FORMAT JSON;START PIPELINE IF NOT RUNNING metrics.blobs;
How to Stop the Monitoring Process
You may stop the monitoring process at any time by manually stopping the pipelines created earlier.
STOP PIPELINE metrics;
STOP PIPELINE blobs;
Last modified: October 20, 2023