rpk generate prometheus-config
Generate the Prometheus configuration to scrape Redpanda nodes.
The output of this command should be included in the 'scrape_configs' array within the YAML configuration file of your Prometheus instance.
There are different options you can use when generating the configuration:
-
If you provide the
--seed-addr
flag, the command will use the address to discover the rest of the cluster hosts using Redpanda’s Kafka API. -
If you provide the
--node-addrs
flag, the command will directly use the provided addresses. -
If neither
--seed-addr
nor--node-addrs
are passed, the command will read the redpanda config file and use the node IP configured there.
If the node you want to scrape uses TLS, you can provide the TLS flags
(--tls-key
, --tls-cert
, and --tls-truststore
). The command will generate the
required tls_config section in the scrape configuration.
Additionally, you have the option to define labels for the target in the
static-config section by using the --labels
flag. You can specify the desired
metric that the label should target, either internal (/metrics) or public
(/public_metrics).
For example:
--job-name test --labels "public:group=one,internal:group=two"
This will result in two separate configs for the test job, each with a different label:
- job_name: test
static_configs:
- targets: [<targets>]
labels:
group: one
metrics_path: /public_metrics
- job_name: test
static_configs:
- targets: [<targets>]
labels:
group: two
metrics_path: /metrics
You can only provide one label per job. By default, if no metric target is specified, the label will be shared across the jobs.
Flags
Value | Type | Description |
---|---|---|
|
- |
Help for prometheus-config. |
|
- |
Include scrape config for internal metrics (/metrics). |
|
string |
The prometheus job name by which to identify the Redpanda nodes (default "redpanda"). |
|
strings |
Comma-separated labels and their target metric (int or pub): [metric|labelName:labelValue, …]. |
|
strings |
Comma-separated list of admin API host:ports. |
|
string |
The URL of a Redpanda node with which to discover the rest. |
|
string |
The certificate to be used for TLS authentication with the broker. |
|
- |
Enable TLS for the Kafka API (not necessary if specifying custom certs). |
|
string |
The certificate key to be used for TLS authentication with the broker. |
|
string |
The CA certificate to be used for TLS communication with the broker. |
|
string |
Redpanda or rpk config file; default search paths are |
|
stringArray |
Override |
|
string |
Profile to use. See |
|
- |
Enable verbose logging. |