Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/current/v26.2/cockroach-gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Subcommand | Usage
`autocomplete` | Generate `bash` or `zsh` autocompletion script for CockroachDB.<br><br>**Default:** `bash`
`example-data` | Generate example SQL datasets. You can also use the [`cockroach workload`]({% link {{ page.version.version }}/cockroach-workload.md %}) command to generate these sample datasets in a persistent cluster and the [`cockroach demo <dataset>`]({% link {{ page.version.version }}/cockroach-demo.md %}) command to generate these datasets in a temporary, in-memory cluster.
`haproxy` | Generate an HAProxy config file for a running CockroachDB cluster. The node addresses included in the config are those advertised by the nodes. Make sure hostnames are resolvable and IP addresses are routable from HAProxy.<br><br> [Decommissioned nodes](node-shutdown.html?filters=decommission) are excluded from the config file.
`dashboard` | Generate a standardized monitoring dashboard as a JSON file for either Datadog or Grafana. The generated dashboard includes Overview, Hardware, Runtime, Networking, SQL, and Storage metrics.
Copy link
Copy Markdown

@aa-joshi aa-joshi Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with this, I think we should also update the section from doc as an alternative: https://www.cockroachlabs.com/docs/v26.1/monitor-cockroachdb-with-prometheus#step-5-visualize-metrics-in-grafana.
CC: @kevin-v-ngo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aa-joshi I added the cockroach gen dashboard command to this section as an alternative to downloading the starter dashboards. Lmk if this is an accurate understanding of how the command fits with this process, thanks!


## Synopsis

Expand Down Expand Up @@ -52,6 +53,13 @@ Generate an HAProxy config file for a running cluster:
$ cockroach gen haproxy
~~~

Generate a Grafana dashboard:

{% include_cached copy-clipboard.html %}
~~~ shell
$ cockroach gen dashboard --tool=grafana
~~~

View help:

{% include_cached copy-clipboard.html %}
Expand Down Expand Up @@ -113,6 +121,14 @@ Flag | Description
`--out` | The path where the `haproxy.cfg` file will be generated. If an `haproxy.cfg` file already exists in the directory, it will be overwritten.<br><br>**Default:** `haproxy.cfg` in the current directory
`--locality` | If nodes were started with [locality]({% link {{ page.version.version }}/cockroach-start.md %}#locality) details, you can use the `--locality` flag here to filter the nodes included in the HAProxy config file, specifying the explicit locality tier(s) or a regular expression to match against. This is useful in cases where you want specific instances of HAProxy to route to specific nodes. See the [Generate an HAProxy configuration file](#generate-an-haproxy-config-file) example for more details.

#### `dashboard`

Flag | Description
-----|------------
`--tool` | Which tool you would like your dashboard to be compatible with.<br><br>**Acceptable values:** `datadog`, `grafana`
`--output` | The path for the output file.
`--rollup-interval` | The interval, in seconds, for the rollup policy to control metric aggregation.

### Logging

{% include {{ page.version.version }}/misc/logging-defaults.md %}
Expand Down Expand Up @@ -394,6 +410,22 @@ Field | Description
For full details on these and other configuration settings, see the [HAProxy Configuration Manual](http://cbonte.github.io/haproxy-dconv/1.7/configuration.html).
{{site.data.alerts.end}}

### Generate a dashboard

Generate a Datadog dashboard:

{% include_cached copy-clipboard.html %}
~~~ shell
$ cockroach gen dashboard --tool=datadog --output='{path/to/file.json}' --rollup-interval=60
~~~

Generate a Grafana dashboard:

{% include_cached copy-clipboard.html %}
~~~ shell
$ cockroach gen dashboard --tool=grafana --output='{path/to/file.json}' --rollup-interval=60
~~~

## See also

- [`cockroach` Commands Overview]({% link {{ page.version.version }}/cockroach-commands.md %})
Expand Down
4 changes: 2 additions & 2 deletions src/current/v26.2/monitor-cockroachdb-with-prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Although Prometheus lets you graph metrics, [Grafana](https://grafana.com/) is a
Url | `http://<hostname of machine running prometheus>:9090`
Access | Direct

1. Download the starter [Grafana dashboards](https://github.com/cockroachdb/cockroach/tree/master/monitoring/grafana-dashboards/by-cluster) for CockroachDB:
1. Generate a standardized Grafana dashboard using [`cockroach gen dashboard --tool=grafana`]({% link {{ page.version.version }}/cockroach-gen.md %}#generate-a-dashboard). Alternatively, download one or more of the starter [Grafana dashboards](https://github.com/cockroachdb/cockroach/tree/master/monitoring/grafana-dashboards/by-cluster) for CockroachDB to focus on specific metrics:

{% include_cached copy-clipboard.html %}
~~~ shell
Expand All @@ -199,7 +199,7 @@ Although Prometheus lets you graph metrics, [Grafana](https://grafana.com/) is a
# replicas dashboard: replica information and operations.
~~~

1. [Add the dashboards to Grafana](http://docs.grafana.org/reference/export_import/#importing-a-dashboard).
1. [Add the dashboard or dashboards to Grafana](http://docs.grafana.org/reference/export_import/#importing-a-dashboard).

## See also

Expand Down
Loading