CockroachDB

Overview Copied

The CockroachDB Collection Agent plugin monitors CockroachDB clusters by polling two data sources on each collection cycle:

Every data point includes a cluster dimension set to the CockroachDB cluster UUID. The plugin fetches this UUID once from /_admin/v1/cluster at startup. If that call fails, the collector fails to start.

The HTTP and JDBC clients verify the server with a shared CA certificate and authenticate with a username and password. For TLS setup and credential requirements, see Security and TLS. For the minimum system privileges that the SQL user needs, see Collector user and privileges.

Prerequisites Copied

Before you deploy the plugin, make sure that:

Geneos environment Copied

The latest version of the CockroachDB plugin requires:

The CockroachDB plugin binaries are packaged with Netprobe and are stored in the collection_agent > plugins folder. Alternatively, you can download separate binaries for the CockroachDB plugin from ITRS Downloads.

Collector user and privileges Copied

Create a dedicated SQL user for the plugin with password authentication and LOGIN enabled. For more information, see CockroachDB’s Manage Cluster User Authorization guide, CREATE USER for user creation, and GRANT for granting system privileges.

The plugin needs two system-level privileges. Membership in the admin role is not required:

Privilege Used for
SYSTEM VIEWCLUSTERMETADATA HTTP API: /_admin/v1/cluster (cluster UUID at startup) and /_status/nodes (node liveness and allowlisted node or store metrics)
SYSTEM VIEWACTIVITY SQL telemetry: crdb_internal.cluster_sessions and crdb_internal.jobs

Example (run as a user who can grant system privileges, for example root):

CREATE USER c2plugin WITH PASSWORD 'c2plugin_pw';
GRANT SYSTEM VIEWCLUSTERMETADATA TO c2plugin;
GRANT SYSTEM VIEWACTIVITY TO c2plugin;

Use the same user for both http.username / http.password and db.connectionConfig.username / db.connectionConfig.password.

Security and TLS Copied

TLS is controlled by the top-level tls key on the CockroachDB plugin configuration.

When tls is present, both the HTTP client and the JDBC driver use tls.caFile for server-certificate verification. Omit the entire tls key for an insecure cluster.

Client-certificate authentication isn’t supported. Authenticate with a username and password on both clients:

Whenever http.endpointUrl uses https://, both http.username / http.password and db.connectionConfig.username / db.connectionConfig.password are required.

The following table summarizes the settings for each cluster mode:

Cluster mode tls.caFile http.username / http.password db.connection-config credentials
Insecure Omitted Omitted Omitted (defaults to root)
Secure Required Required username and password required

Configure Geneos to deploy the CockroachDB plugin Copied

The plugin supports Collection Agent publication into Geneos using Dynamic Managed Entities. To set up the plugin in Geneos:

  1. Set up the CockroachDB Collection Agent plugin.
  2. Configure your mappings.
  3. Configure other Dynamic Entities in the Gateway.

Set up the CockroachDB Collection Agent plugin Copied

Use one of the following options to configure the plugin:

collectors:
  - type: plugin
    className: CockroachDbCollector

    # How often (in milliseconds) to run a collection cycle. Optional, defaults to 60000.
    collectionInterval: 30000

    # Base URL of CockroachDB's Status / Admin JSON API. Required. The collector appends
    # /_status/nodes and /_admin/v1/cluster to this prefix.
    # Use https:// against a secure cluster; the top-level tls.caFile is then required.
    http:
      endpointUrl: https://localhost:8080

      # Required whenever http.endpointUrl is https://. The plugin exchanges these for a session
      # cookie via POST /api/v2/login/ on first use and after any 401 response.
      username: c2plugin
      password: c2plugin_pw

    # Optional. Server-certificate verification for BOTH the HTTP client and the JDBC
    # driver. Omit the whole block for an insecure cluster.
    #   - HTTP: OkHttp is built with an SSLSocketFactory that trusts caFile only.
    #   - JDBC: pgjdbc is configured with sslmode=verify-full and sslrootcert=caFile.
    # No client-cert options are exposed; both clients authenticate via username/password
    # (see http.* and db.connection-config.* below).
    tls:
      caFile: /etc/c2/certs/ca.crt          # PEM CA that signed the CockroachDB node cert

    # JDBC side-channel settings.
    db:
      # JDBC connection credentials. Required.
      connectionConfig:
        # Full JDBC URL. Required. Any URL-level options are preserved.
        url: jdbc:postgresql://localhost:26257/defaultdb

        # Optional. Defaults to "root".
        # In insecure clusters (env/docker-compose.yml) leave this at root; in secure
        # clusters (env/secure/) create a dedicated user with the privileges above.
        username: c2plugin

        # Required against a secure cluster.
        password: c2plugin_pw

Note

HTTP connect and read timeouts (5 seconds connect, 10 seconds read) and the JDBC connect timeout (5 seconds) are internal defaults and aren’t currently configurable.

For descriptions of all options, see Configuration reference.

Configure your mappings Copied

You can configure your dynamic mappings using a built-in or custom mapping in Dynamic Entities > Mapping:

For more information, see Mapping and mapping group in Dynamic Entities.

Configure other Dynamic Entities in the Gateway Copied

For a more detailed procedure, see Create Dynamic Entities.

Metrics collected Copied

Each collection cycle publishes data points from the HTTP Status and Admin API and from the SQL side-channel. SQL data-point names match their source column names. Dimensions identify which source table a given data point came from.

Each SQL query runs against its own short-lived JDBC connection and is handled independently, so a failure in one query doesn’t suppress the other SQL metrics or the HTTP metrics.

HTTP Status and Admin API Copied

Data point Type Description Dimensions
status StatusMetric One per node, derived from the livenessByNodeId map returned by /_status/nodes. Possible values: UNKNOWN, DEAD, UNAVAILABLE, LIVE, DECOMMISSIONING, DECOMMISSIONED, DRAINING. cluster, node
Node metric Gauge One per allowlisted entry in a node’s top-level metrics map. Histogram metrics (for example, liveness.heartbeatlatency, sql.service.latency) are emitted as their full suffixed set (-avg, -count, -max, -sum). cluster, node
Store metric Gauge One per allowlisted entry in a store’s metrics map (under storeStatuses[].metrics). cluster, node, store

The allowlist is split into a node-level set and a per-store set based on CockroachDB’s Essential Metrics and Essential Alerts documentation. Metrics that aren’t on the allowlist aren’t published.

SQL side-channel Copied

Sessions Copied

One bucket is published per (user_name, application_name) pair observed in crdb_internal.cluster_sessions. Per-session rows aren’t emitted — session_id is regenerated on every reconnect and isn’t a stable dimension.

Data point Type Description Dimensions
count Counter Number of open sessions for this (user, application) bucket. cluster, user_name, application_name

Jobs Copied

One set of data points is published per row in crdb_internal.jobs whose status is nonterminal: failed, running, paused, pause-requested, cancel-requested, reverting, retry-running. No job_type filter is applied.

Data point Type Description Dimensions
status StatusMetric The job’s status column. cluster, job_id
job_type StatusMetric The job’s job_type column (for example, BACKUP, CHANGEFEED, SCHEMA CHANGE). cluster, job_id
description EntityAttribute The job’s description column. cluster, job_id
created StatusMetric The job’s created TIMESTAMP as a string (for example, 2026-06-25 18:35:00.123456+00:00). cluster, job_id
last_run StatusMetric The job’s last_run TIMESTAMP as a string, or empty if the job has never run. cluster, job_id
age Gauge (seconds) Wall-clock seconds between now() and last_run, computed on the server from Unix epoch seconds. Zero when the job has never run. cluster, job_id
num_runs Counter The job’s num_runs column. cluster, job_id

Note

The JDBC client sets timezone=UTC on each connection so that job timestamps aren’t shifted by the Collection Agent JVM’s local time zone offset.

Custom SQL querying Copied

The CockroachDB Collection Agent plugin publishes a fixed set of cluster telemetry from the HTTP Status and Admin API and from selected crdb_internal views. It doesn’t run arbitrary customer SQL.

To run your own SQL against CockroachDB and surface the results in Geneos, use the JDBC Collection Agent plugin. That plugin is separate from the CockroachDB collector. You can run both on the same Collection Agent — CockroachDB for built-in telemetry, and JDBC for custom queries.

CockroachDB speaks the PostgreSQL wire protocol, so configure the JDBC plugin with a PostgreSQL-style URL. For example:

jdbc:postgresql://<host>:26257/<database>

The JDBC plugin packages the PostgreSQL driver, so no extra driver JAR file is required for CockroachDB.

With the JDBC plugin, you can:

For full configuration, data point translation, and mapping examples, see JDBC.

The following example shows a minimal JDBC collector that runs a custom query against CockroachDB:

collectors:
  - name: jdbc-cockroachdb
    type: plugin
    className: JdbcCollector
    collectionInterval: 60000
    workerThreads: 1

    connection:
      url: jdbc:postgresql://localhost:26257/defaultdb
      user: <sql_user>
      password: <sql_password>

    queryConfigs:
      - name: custom-query
        query: "SELECT id AS row_key, status FROM my_app.orders WHERE status != 'closed'"
        dimensions:
          dbColumns:
            - row_key
          static:
            database: defaultdb
            table: orders
        dataPoints:
          - column: status
            type: StatusMetric

Map the collector with the generic JDBC Dynamic Entity mapping so dimensions such as database, table, and row_key resolve correctly.

Note

Configure TLS on the JDBC collector (URL or propertiesFile). Don’t use the CockroachDB plugin tls block for JDBC connections.

Configuration reference Copied

Collection settings Copied

Field Type Description
collectionInterval long

Interval in milliseconds between collection cycles.

Required: No

Default: 60000

className string

Collector class name. Must be CockroachDbCollector.

Required: Yes

HTTP settings Copied

Configured under http.

Field Type Description
endpointUrl string

Base URL of CockroachDB’s Status and Admin JSON API. The collector appends /_status/nodes and /_admin/v1/cluster to this prefix. Use https:// against a secure cluster.

Required: Yes

username string

Username for HTTP API session sign-in via POST /api/v2/login/. Required whenever endpointUrl is https://.

Required: Conditional

password string

Password for HTTP API session sign-in. Required whenever endpointUrl is https://. Supports ${env:VAR} substitution.

Required: Conditional

TLS settings Copied

Configured under tls. When present, both the HTTP client and the JDBC driver verify the server certificate by using caFile. Omit the entire block for an insecure cluster.

Field Type Description
caFile string

Path to the PEM CA certificate that signed the CockroachDB node certificate. Required for secure clusters.

Required: Conditional

Database connection settings Copied

Configured under db.connectionConfig.

Field Type Description
url string

Full JDBC URL for the CockroachDB SQL endpoint. Any URL-level options are preserved.

Example: jdbc:postgresql://localhost:26257/defaultdb

Required: Yes

username string

JDBC username. On secure clusters, use the dedicated plugin user with the privileges listed in Collector user and privileges.

Required: No

Default: root

password string

JDBC password. Required against a secure cluster. Supports ${env:VAR} substitution.

Required: Conditional

["Geneos"] ["User Guide"]

Was this topic helpful?