diff --git a/docs/sources/flow/getting-started/migrating-from-prometheus.md b/docs/sources/flow/getting-started/migrating-from-prometheus.md index 0417d3c27260..4068cee50c49 100644 --- a/docs/sources/flow/getting-started/migrating-from-prometheus.md +++ b/docs/sources/flow/getting-started/migrating-from-prometheus.md @@ -46,7 +46,7 @@ This topic describes how to: To fully migrate your configuration from [Prometheus] to Grafana Agent in flow mode, you must convert your Prometheus configuration into a Grafana Agent flow -mode configuration. This conversion will enable you to take full advantage of the many +mode configuration. This conversion will enable you to take full advantage of the many additional features available in Grafana Agent flow mode. > In this task, we will use the [convert][] CLI command to output a flow @@ -54,11 +54,19 @@ additional features available in Grafana Agent flow mode. 1. Open a terminal window and run the following command: - ```bash - AGENT_MODE=flow; grafana-agent convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` - - Replace the following: + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} + + Replace the following: * `INPUT_CONFIG_PATH`: The full path to the Prometheus configuration. * `OUTPUT_CONFIG_PATH`: The full path to output the flow configuration. @@ -66,22 +74,38 @@ additional features available in Grafana Agent flow mode. ### Debugging -1. If the convert command cannot convert a Prometheus configuration, +1. If the convert command can't convert a Prometheus configuration, diagnostic information is sent to `stderr`. You can bypass - any non-critical issues and output the flow configuration using a + any non-critical issues and output the flow configuration using a best-effort conversion by including the `--bypass-errors` flag. {{% admonition type="caution" %}}If you bypass the errors, the behavior of the converted configuration may not match the original Prometheus configuration. Make sure you fully test the converted configuration before using it in a production environment.{{% /admonition %}} - ```bash - AGENT_MODE=flow; grafana-agent convert --source-format=prometheus --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=prometheus --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=prometheus --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} 1. You can also output a diagnostic report by including the `--report` flag. - ```bash - AGENT_MODE=flow; grafana-agent convert --source-format=prometheus --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=prometheus --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=prometheus --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} * Replace `OUTPUT_REPORT_PATH` with the output path for the report. @@ -151,10 +175,18 @@ The convert command takes the YAML file as input and outputs a [River][] file. [River]: {{< relref "../config-language/_index.md" >}} -```bash -AGENT_MODE=flow; grafana-agent convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH +{{< code >}} + +```static-binary +AGENT_MODE=flow grafana-agent convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH +``` + +```flow-binary +grafana-agent-flow convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH ``` +{{< /code >}} + The new flow configuration file looks like this: ```river diff --git a/docs/sources/flow/getting-started/migrating-from-promtail.md b/docs/sources/flow/getting-started/migrating-from-promtail.md index 09b91ec0d4ad..45a1a4e411bd 100644 --- a/docs/sources/flow/getting-started/migrating-from-promtail.md +++ b/docs/sources/flow/getting-started/migrating-from-promtail.md @@ -57,9 +57,18 @@ features available in Grafana Agent Flow Mode. 1. Open a terminal window and run the following command: - ```bash - AGENT_MODE=flow; grafana-agent convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} + Replace the following: * `INPUT_CONFIG_PATH`: The full path to the Promtail configuration. @@ -77,15 +86,31 @@ features available in Grafana Agent Flow Mode. {{% admonition type="caution" %}}If you bypass the errors, the behavior of the converted configuration may not match the original Promtail configuration. Make sure you fully test the converted configuration before using it in a production environment.{{% /admonition %}} - ```bash - AGENT_MODE=flow; grafana-agent convert --source-format=promtail --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=promtail --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=promtail --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} 1. You can also output a diagnostic report by including the `--report` flag. - ```bash - AGENT_MODE=flow; grafana-agent convert --source-format=promtail --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=promtail --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=promtail --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} * Replace `OUTPUT_REPORT_PATH` with the output path for the report. @@ -152,10 +177,18 @@ The convert command takes the YAML file as input and outputs a [River][] file. [River]: {{< relref "../config-language/_index.md" >}} -```bash -AGENT_MODE=flow; grafana-agent convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH +{{< code >}} + +```static-binary +AGENT_MODE=flow grafana-agent convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH +``` + +```flow-binary +grafana-agent-flow convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH ``` +{{< /code >}} + The new Flow Mode configuration file looks like this: ```river @@ -182,7 +215,7 @@ loki.write "default" { ## Limitations Configuration conversion is done on a best-effort basis. The Agent will issue -warnings or errors where the conversion cannot be performed. +warnings or errors where the conversion can't be performed. Once the configuration is converted, we recommend that you review the Flow Mode configuration file created, and verify that it is correct diff --git a/docs/sources/flow/getting-started/migrating-from-static.md b/docs/sources/flow/getting-started/migrating-from-static.md index 6d3349b18aea..a390be9dca3b 100644 --- a/docs/sources/flow/getting-started/migrating-from-static.md +++ b/docs/sources/flow/getting-started/migrating-from-static.md @@ -62,9 +62,17 @@ features available in Grafana Agent Flow mode. 1. Open a terminal window and run the following command: - ```bash - AGENT_MODE=flow grafana-agent convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} Replace the following: * `INPUT_CONFIG_PATH`: The full path to the [Static][] configuration. @@ -82,16 +90,32 @@ features available in Grafana Agent Flow mode. {{% admonition type="caution" %}}If you bypass the errors, the behavior of the converted configuration may not match the original [Static] mode configuration. Make sure you fully test the converted configuration before using it in a production environment.{{% /admonition %}} - ```bash - AGENT_MODE=flow grafana-agent convert --source-format=static --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH - ``` + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=static --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=static --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + {{< /code >}} 1. You can use the `--report` flag to output a diagnostic report. - ```bash - AGENT_MODE=flow grafana-agent convert --source-format=static --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + {{< code >}} + + ```static-binary + AGENT_MODE=flow grafana-agent convert --source-format=static --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH + ``` + + ```flow-binary + grafana-agent-flow convert --source-format=static --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH ``` + {{< /code >}} + * Replace `OUTPUT_REPORT_PATH` with the output path for the report. Using the [example](#example) Grafana Agent Static Mode configuration below, the diagnostic @@ -159,7 +183,7 @@ metrics: - targets: ['127.0.0.1:12345'] labels: cluster: 'localhost' - + logs: global: file_watch_config: @@ -196,10 +220,18 @@ The convert command takes the YAML file as input and outputs a [River][] file. [River]: {{< relref "../config-language/_index.md" >}} -```bash +{{< code >}} + +```static-binary AGENT_MODE=flow grafana-agent convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH ``` +```flow-binary +grafana-agent-flow convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH +``` + +{{< /code >}} + The new Flow mode configuration file looks like this: ```river