Customize Monitoring
On this page
Configure Monitoring using SQL
Note
Using SingleStore 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.
Set the Exporter User
The exporter is typically owned by the database root
user.root
, run the following SQL statements and specify the desired database user for <exporter-user>
and this user’s password for <secure-password>
.
Note: The database user that starts the exporter process can differ from the database user that starts the monitoring process.
CREATE USER '<exporter-user>' IDENTIFIED BY '<secure-password>';GRANT CLUSTER, SHOW METADATA, SELECT, PROCESS ON *.* to '<exporter-user>'@'%';
Start the Exporter Process
Perform the following steps on the Source cluster's Master Aggregator.
Note that the exporter process is restarted when the exporter_
variable is set to any non-zero value, including the current value.
Run either of the following to start the exporter.9104
).
Note: If starting the exporter as a database user other than root
, substitute the database user for root
and this user’s password for <secure-password>
.
HTTP Connections
Run the following SQL statements to start the exporter.
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). -
Run the following SQL statements to start the exporter.
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
Stop the Exporter Process
You may stop the exporter at any time by running the following command on the Source cluster's 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 monitoring process configures the metrics
database and starts monitoring the cluster.
Set the Monitoring User
Monitoring is typically owned by the database root
user.root
, run the following SQL statements and specify the desired database user for <monitoring-user>
and this user's password for <secure-password>
.
Note: The database user that starts the monitoring process can differ from the database user that starts the exporter process.
CREATE USER '<monitoring-user>' IDENTIFIED BY '<secure-password>';GRANT SELECT, CREATE, INSERT, UPDATE, DELETE, EXECUTE, INDEX, ALTER, DROP, CREATE DATABASE, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE ON metrics.* to '<monitoring-user>'@'%';GRANT CREATE PIPELINE, DROP PIPELINE, ALTER PIPELINE, START PIPELINE, SHOW PIPELINE ON metrics.* to '<monitoring-user>'@'%';
metrics
Database DDL
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
.To create the metrics
database as a user other thanroot
, run the following SQL statements and specify the desired database user fordbmon
and this user’s password for<password>
. -
These commands must be run on the Master Aggregator of the Metrics cluster.
Create the metrics
database and associated tables by copying, pasting, and running 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":"<SingleStore 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":"<SingleStore 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":"<SingleStore 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":"<SingleStore 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;
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: September 13, 2024