<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Grafana Mimir tools on Grafana Labs</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/</link><description>Recent content in Grafana Mimir tools on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/mimir/v3.1.x/manage/tools/index.xml" rel="self" type="application/rss+xml"/><item><title>Grafana Mimir listblocks</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/listblocks/</link><pubDate>Wed, 03 Jun 2026 09:01:40 +0200</pubDate><guid>https://grafana.com/docs/mimir/v3.1.x/manage/tools/listblocks/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-mimir-listblocks&#34;&gt;Grafana Mimir listblocks&lt;/h1&gt;
&lt;p&gt;The listblocks tool lists blocks and shows the block details of a tenant.&lt;/p&gt;
&lt;h2 id=&#34;download-and-configure-listblocks&#34;&gt;Download and configure listblocks&lt;/h2&gt;
&lt;p&gt;Download listblocks as part of the Mimir binary. To download the binary, refer to &lt;a href=&#34;https://github.com/grafana/mimir/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Mimir releases&lt;/a&gt; on GitHub.&lt;/p&gt;
&lt;p&gt;To configure listblocks, you need to provide access to the object storage bucket and specify the tenant ID. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimir listblocks --config.file=/path/to/mimir.yaml --tenant-id=&amp;lt;your-tenant-id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also specify bucket details directly if they aren&amp;rsquo;t in your configuration file. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimir listblocks --tenant-id=&amp;lt;your-tenant-id&amp;gt; --blocks-storage.backend=s3 --blocks-storage.s3.bucket-name=&amp;lt;your-bucket&amp;gt; --blocks-storage.s3.endpoint=&amp;lt;your-s3-endpoint&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;use-listblocks&#34;&gt;Use listblocks&lt;/h2&gt;
&lt;p&gt;Listblocks doesn&amp;rsquo;t use the bucket index; instead, it downloads the &lt;code&gt;meta.json&lt;/code&gt; file of every block in the tenant.
This means that listblocks has an up-to-date view of the blocks in the bucket.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;$ ./listblocks -backend=gcs -gcs.bucket-name=bucket-with-blocks -user=10428
Block ID                     Min Time               Max Time               Duration
01E0HMK47RGAAKZJBMG8B8QXGP   2020-02-07T07:49:46Z   2020-02-08T00:00:00Z   16h10m13.89s
01E0M0VK2KEDZC5AK1PX8K00EX   2020-02-08T00:00:00Z   2020-02-09T00:00:00Z   24h0m0s
01E0PK9B84XJ9KQ0DHZDQECNH6   2020-02-09T00:00:00Z   2020-02-10T00:00:00Z   24h0m0s
01E0S8VAKJ0H41N41GBKQN4G1N   2020-02-10T00:00:00Z   2020-02-11T00:00:00Z   24h0m0s
01E0VTN88859KW1KTDVBS14E7A   2020-02-11T00:00:00Z   2020-02-12T00:00:00Z   24h0m0s
01E0YCZKFG2ME5GZ60AYCQ39V4   2020-02-12T00:00:00Z   2020-02-13T00:00:00Z   24h0m0s
01E111CX17BXFZD97AKSYKX0A5   2020-02-13T00:00:00Z   2020-02-14T00:00:00Z   24h0m0s
01E13JCZK9A5SJMAY6QSSEB0XX   2020-02-14T00:00:00Z   2020-02-15T00:00:00Z   24h0m0s
01E164EJFPT8ZCY6QWEKNJ0VYX   2020-02-15T00:00:00Z   2020-02-16T00:00:00Z   24h0m0s
...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Listblocks has many options you can use to modify the output. The following list contains the most important listblocks options:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;  -format string
    	The format of the output. Must be one of &amp;#34;tabbed&amp;#34;, &amp;#34;json&amp;#34;, or &amp;#34;yaml&amp;#34; (default &amp;#34;tabbed&amp;#34;)
  -max-time value
    	If set, only blocks with MaxTime &amp;lt;= this value is printed
  -min-time value
    	If set, only blocks with MinTime &amp;gt;= this value is printed
  -show-block-size
    	Show size of block based on details in meta.json, if available
  -show-compaction-level
    	Show compaction level
  -show-deleted
    	Show deleted blocks
  -show-labels
    	Show block labels
  -show-parents
    	Show parent blocks
  -show-sources
    	Show compaction sources
  -show-ulid-time
    	Show time from ULID&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;$ ./listblocks -backend=gcs -gcs.bucket-name=bucket-with-blocks -user=10428 -min-time=2022-02-01T00:00:00Z -max-time=2022-02-04T00:00:00Z -show-labels -show-block-size
Block ID                     Min Time               Max Time               Duration   Size     Labels (excl. __org_id__)
01FTWJ3V2TP7N4D7FCSSBJXQ9Z   2022-02-01T00:00:00Z   2022-02-02T00:00:00Z   24h0m0s    69 GiB   {__compactor_shard_id__=&amp;#34;1_of_4&amp;#34;}
01FTWJZ3FD4QX4T1FMJJNP7XR1   2022-02-01T00:00:00Z   2022-02-02T00:00:00Z   24h0m0s    69 GiB   {__compactor_shard_id__=&amp;#34;2_of_4&amp;#34;}
01FTWMN7AQBPMXWBHVC61ENPT7   2022-02-01T00:00:00Z   2022-02-02T00:00:00Z   24h0m0s    69 GiB   {__compactor_shard_id__=&amp;#34;3_of_4&amp;#34;}
01FTWQ5Y87AWVKXH44T2N23BHW   2022-02-01T00:00:00Z   2022-02-02T00:00:00Z   24h0m0s    69 GiB   {__compactor_shard_id__=&amp;#34;4_of_4&amp;#34;}
01FTZ4QWE2PNK69ZJGTK2NCWFB   2022-02-02T00:00:00Z   2022-02-03T00:00:00Z   24h0m0s    73 GiB   {__compactor_shard_id__=&amp;#34;1_of_4&amp;#34;}
01FTZ55XAZCVHWP9K5AAR5BVHF   2022-02-02T00:00:00Z   2022-02-03T00:00:00Z   24h0m0s    73 GiB   {__compactor_shard_id__=&amp;#34;2_of_4&amp;#34;}
01FTZ7AQBCSBB8T6P2Q5QZ416W   2022-02-02T00:00:00Z   2022-02-03T00:00:00Z   24h0m0s    73 GiB   {__compactor_shard_id__=&amp;#34;3_of_4&amp;#34;}
01FTYW42TNTZ44QMM9YTFDE6Y4   2022-02-02T00:00:00Z   2022-02-03T00:00:00Z   24h0m0s    73 GiB   {__compactor_shard_id__=&amp;#34;4_of_4&amp;#34;}
01FV1S5GQDAFTQ4M9CTN1CD1E4   2022-02-03T00:00:00Z   2022-02-04T00:00:00Z   24h0m0s    77 GiB   {__compactor_shard_id__=&amp;#34;1_of_4&amp;#34;}
01FV1JKPH2VFXA4K6XNETC8FBR   2022-02-03T00:00:00Z   2022-02-04T00:00:00Z   24h0m0s    77 GiB   {__compactor_shard_id__=&amp;#34;2_of_4&amp;#34;}
01FV1VQQTAJVA287ZY8DC435HD   2022-02-03T00:00:00Z   2022-02-04T00:00:00Z   24h0m0s    77 GiB   {__compactor_shard_id__=&amp;#34;3_of_4&amp;#34;}
01FV1FRX39NC1J64D6H6W9VVZ9   2022-02-03T00:00:00Z   2022-02-04T00:00:00Z   24h0m0s    77 GiB   {__compactor_shard_id__=&amp;#34;4_of_4&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="grafana-mimir-listblocks">Grafana Mimir listblocks&lt;/h1>
&lt;p>The listblocks tool lists blocks and shows the block details of a tenant.&lt;/p>
&lt;h2 id="download-and-configure-listblocks">Download and configure listblocks&lt;/h2>
&lt;p>Download listblocks as part of the Mimir binary. To download the binary, refer to &lt;a href="https://github.com/grafana/mimir/releases" target="_blank" rel="noopener noreferrer">Grafana Mimir releases&lt;/a> on GitHub.&lt;/p></description></item><item><title>Grafana Mimir tenant injector</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/tenant-injector/</link><pubDate>Wed, 03 Jun 2026 09:01:40 +0200</pubDate><guid>https://grafana.com/docs/mimir/v3.1.x/manage/tools/tenant-injector/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-mimir-tenant-injector&#34;&gt;Grafana Mimir tenant injector&lt;/h1&gt;
&lt;p&gt;The tenant injector is a standalone HTTP proxy that injects the &lt;code&gt;X-Scope-OrgID&lt;/code&gt; header with the value that you specify in the &lt;code&gt;-tenant-id&lt;/code&gt; flag into incoming HTTP requests. It then forwards the modified requests to the URL you specify in the &lt;code&gt;-remote-address&lt;/code&gt; flag.&lt;/p&gt;
&lt;h2 id=&#34;download-the-tenant-injector&#34;&gt;Download the tenant injector&lt;/h2&gt;
&lt;p&gt;Download the tenant injector as a separate binary from Grafana Mimir. Refer to &lt;a href=&#34;https://github.com/grafana/mimir/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Mimir releases&lt;/a&gt; on GitHub.&lt;/p&gt;
&lt;h2 id=&#34;use-the-tenant-injector&#34;&gt;Use the tenant injector&lt;/h2&gt;
&lt;p&gt;You can use the tenant injector to query data for a tenant during development or troubleshooting.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;Usage of tenant-injector:
  -local-address string
    	Local address to listen on (host:port or :port). (default &amp;#34;:8080&amp;#34;)
  -remote-address string
    	URL of target to forward requests to to (eg. http://domain.com:80).
  -tenant-id string
    	Tenant ID to inject to proxied requests.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="grafana-mimir-tenant-injector">Grafana Mimir tenant injector&lt;/h1>
&lt;p>The tenant injector is a standalone HTTP proxy that injects the &lt;code>X-Scope-OrgID&lt;/code> header with the value that you specify in the &lt;code>-tenant-id&lt;/code> flag into incoming HTTP requests. It then forwards the modified requests to the URL you specify in the &lt;code>-remote-address&lt;/code> flag.&lt;/p></description></item><item><title>Grafana Mimir query-tee</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/query-tee/</link><pubDate>Wed, 03 Jun 2026 09:01:40 +0200</pubDate><guid>https://grafana.com/docs/mimir/v3.1.x/manage/tools/query-tee/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-mimir-query-tee&#34;&gt;Grafana Mimir query-tee&lt;/h1&gt;
&lt;p&gt;The query-tee is a standalone tool that you can use for testing purposes when comparing the query results and performance of two Grafana Mimir clusters.
The two Mimir clusters compared by the query-tee must ingest the same series and samples.&lt;/p&gt;
&lt;p&gt;The query-tee exposes Prometheus-compatible read API endpoints and acts as a proxy.
When the query-tee receives a request, it performs the same request against the two backend Grafana Mimir clusters and tracks the response time of each backend, and compares the query results.&lt;/p&gt;
&lt;h2 id=&#34;download-the-query-tee&#34;&gt;Download the query-tee&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Using Docker:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;docker pull &amp;#34;grafana/query-tee:latest&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Using a local binary:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Download the appropriate &lt;a href=&#34;https://github.com/grafana/mimir/releases/latest&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;release asset&lt;/a&gt; for your operating system and architecture and make it executable.&lt;/p&gt;
&lt;p&gt;For Linux with the AMD64 architecture, execute the following command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -Lo query-tee https://github.com/grafana/mimir/releases/latest/download/query-tee-linux-amd64
chmod &amp;#43;x query-tee&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;configure-the-query-tee&#34;&gt;Configure the query-tee&lt;/h2&gt;
&lt;p&gt;The query-tee requires the endpoints of the backend Grafana Mimir clusters.
You can configure the backend endpoints by setting the &lt;code&gt;-backend.endpoints&lt;/code&gt; flag to a comma-separated list of HTTP or HTTPS URLs.&lt;/p&gt;
&lt;p&gt;For each incoming request, the query-tee clones the request and sends it to each configured backend.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;You can configure the query-tee proxy listening ports via the &lt;code&gt;-server.http-service-port&lt;/code&gt; flag for the HTTP port and &lt;code&gt;server.grpc-service-port&lt;/code&gt; flag for the gRPC port.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;how-the-query-tee-works&#34;&gt;How the query-tee works&lt;/h2&gt;
&lt;p&gt;This section describes how the query-tee tool works.&lt;/p&gt;
&lt;h3 id=&#34;api-endpoints&#34;&gt;API endpoints&lt;/h3&gt;
&lt;p&gt;Query-tee accepts two types of requests:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;HTTP requests on the configured &lt;code&gt;-server.http-service-port&lt;/code&gt; flag (default port 80)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/weaveworks/common/tree/master/httpgrpc&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;HTTP over gRPC&lt;/a&gt; requests on the configured &lt;code&gt;-server.grpc-service-port&lt;/code&gt; flag (default port: 9095)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following Prometheus API endpoints are supported by &lt;code&gt;query-tee&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/query&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/query_range&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/query_exemplars&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/labels&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/label/{name}/values&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/series&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/metadata&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/api/v1/alerts&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET &amp;lt;prefix&amp;gt;/prometheus/config/v1/rules&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can configure the &lt;code&gt;&amp;lt;prefix&amp;gt;&lt;/code&gt; by setting the &lt;code&gt;-server.path-prefix&lt;/code&gt; flag, which defaults to an empty string.&lt;/p&gt;
&lt;h3 id=&#34;pass-through-requests&#34;&gt;Pass-through requests&lt;/h3&gt;
&lt;p&gt;The query-tee can optionally act as a transparent proxy for requests to routes not matching any of the supported API endpoints.
You can enable the pass-through support setting &lt;code&gt;-proxy.passthrough-non-registered-routes=true&lt;/code&gt; and configuring a preferred backend using the &lt;code&gt;-backend.preferred&lt;/code&gt; flag.
When pass-through is enabled, a request for an unsupported API endpoint is transparently proxied to the configured preferred backend.&lt;/p&gt;
&lt;h3 id=&#34;authentication&#34;&gt;Authentication&lt;/h3&gt;
&lt;p&gt;The query-tee supports &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;HTTP basic authentication&lt;/a&gt;.
The query-tee can merge the HTTP basic authentication in the received request with the username and configured in a backend URL.&lt;/p&gt;
&lt;p&gt;A request sent from the query-tee to a backend includes HTTP basic authentication when one of the following conditions is met:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the backend endpoint URL is configured with both a username and password, then query-tee uses it.&lt;/li&gt;
&lt;li&gt;If the backend endpoint URL is configured only with a username, then query-tee keeps the configured username and injects the password received in the incoming request.&lt;/li&gt;
&lt;li&gt;If the backend endpoint URL is configured without a username and password, then query-tee forwards the authentication credentials found in the incoming request.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;configure-the-backend&#34;&gt;Configure the backend&lt;/h3&gt;
&lt;p&gt;You can configure individual backend behavior using the &lt;code&gt;-backend.config-file&lt;/code&gt; flag to specify a YAML or JSON configuration file.
Each key in the configuration file corresponds to a backend hostname, and the value contains the configuration for that backend.&lt;/p&gt;
&lt;p&gt;The following configuration options are available for each backend:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;request_headers&lt;/code&gt;: Additional HTTP headers to send to this backend&lt;/li&gt;
&lt;li&gt;&lt;code&gt;request_proportion&lt;/code&gt;: Proportion of requests to send to this backend. Set between 0.0 -1.0. This value overrides the global &lt;code&gt;-proxy.secondary-backends-request-proportion&lt;/code&gt; setting for this backend.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min_data_queried_age&lt;/code&gt;: Minimum time threshold for time-based query routing (Go duration format like &amp;ldquo;24h&amp;rdquo;, &amp;ldquo;168h&amp;rdquo;, &amp;ldquo;1h30m&amp;rdquo;). Default is &amp;ldquo;0s&amp;rdquo;, which means to serve all queries.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;backend-configuration-examples&#34;&gt;Backend configuration examples&lt;/h4&gt;
&lt;p&gt;JSON configuration example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;prometheus-main&amp;#34;: {
    &amp;#34;request_headers&amp;#34;: {
      &amp;#34;X-Storage-Tier&amp;#34;: [&amp;#34;main&amp;#34;]
    }
  },
  &amp;#34;prometheus-hot&amp;#34;: {
    &amp;#34;request_headers&amp;#34;: {
      &amp;#34;X-Storage-Tier&amp;#34;: [&amp;#34;hot&amp;#34;],
      &amp;#34;Cache-Control&amp;#34;: [&amp;#34;no-store&amp;#34;]
    },
    &amp;#34;request_proportion&amp;#34;: 1.0,
    &amp;#34;min_data_queried_age&amp;#34;: &amp;#34;0s&amp;#34;
  },
  &amp;#34;prometheus-cold&amp;#34;: {
    &amp;#34;request_headers&amp;#34;: {
      &amp;#34;X-Storage-Tier&amp;#34;: [&amp;#34;warm&amp;#34;],
      &amp;#34;Cache-Control&amp;#34;: [&amp;#34;no-store&amp;#34;]
    },
    &amp;#34;request_proportion&amp;#34;: 1.0,
    &amp;#34;min_data_queried_age&amp;#34;: &amp;#34;6h&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;YAML configuration example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;prometheus-main:
  request_headers:
    X-Storage-Tier: [&amp;#34;main&amp;#34;]
prometheus-hot:
  request_headers:
    X-Storage-Tier: [&amp;#34;hot&amp;#34;]
    Cache-Control: [&amp;#34;no-store&amp;#34;]
  request_proportion: 1.0
  min_data_queried_age: &amp;#34;0s&amp;#34; # serves all queries
prometheus-cold:
  request_headers:
    X-Storage-Tier: [&amp;#34;warm&amp;#34;]
    Cache-Control: [&amp;#34;no-store&amp;#34;]
  request_proportion: 1.0
  min_data_queried_age: &amp;#34;6h&amp;#34; # 6 hours&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;select-backends&#34;&gt;Select backends&lt;/h3&gt;
&lt;p&gt;You can use the query-tee to either send requests to all backends, or to send a proportion of requests to all backends and the remaining requests to only the preferred backend.&lt;/p&gt;
&lt;h4 id=&#34;configure-request-proportion&#34;&gt;Configure request proportion&lt;/h4&gt;
&lt;p&gt;You can configure request proportions in two ways:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Global setting: Use the &lt;code&gt;-proxy.secondary-backends-request-proportion&lt;/code&gt; CLI flag to set the default proportion for all secondary backends.&lt;/li&gt;
&lt;li&gt;Per-backend setting: Use the &lt;code&gt;request_proportion&lt;/code&gt; field in the backend configuration file to override the global setting for individual backends.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example, if you set the &lt;code&gt;-proxy.secondary-backends-request-proportion&lt;/code&gt; CLI flag to &lt;code&gt;1.0&lt;/code&gt;, then all requests are sent to all backends.
Alternatively, if you set the &lt;code&gt;-proxy.secondary-backends-request-proportion&lt;/code&gt; CLI flag to &lt;code&gt;0.2&lt;/code&gt;, then 20% of requests are sent to all backends, and the remaining 80% of requests are sent only to your preferred backend.&lt;/p&gt;
&lt;p&gt;Per-backend request proportions take precedence over the global setting. In the previous configuration example, &lt;code&gt;prometheus-warm&lt;/code&gt; would receive 80% of requests and &lt;code&gt;prometheus-cold&lt;/code&gt; would receive 50% of requests, regardless of the global setting.&lt;/p&gt;
&lt;h4 id=&#34;configure-time-based-routing&#34;&gt;Configure time-based routing&lt;/h4&gt;
&lt;p&gt;You can configure backends to only serve queries based on the time range of the requested data using the &lt;code&gt;min_data_queried_age&lt;/code&gt; setting. This is useful for implementing tiered storage architectures where different backends store data for different time periods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How time-based routing works:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A backend with &lt;code&gt;min_data_queried_age: &amp;quot;24h&amp;quot;&lt;/code&gt; only serves queries where the minimum query time is within the last 24 hours.&lt;/li&gt;
&lt;li&gt;A backend with &lt;code&gt;min_data_queried_age: &amp;quot;0s&amp;quot;&lt;/code&gt;, the default, serves all queries regardless of their time range.&lt;/li&gt;
&lt;li&gt;The preferred backend is always included regardless of its time threshold.&lt;/li&gt;
&lt;li&gt;Range queries, meaning&lt;code&gt;/api/v1/query_range&lt;/code&gt;, use earliest time between the &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt; parameters.&lt;/li&gt;
&lt;li&gt;Instant queries, meaning &lt;code&gt;/api/v1/query&lt;/code&gt; use, the &lt;code&gt;time&lt;/code&gt; parameter or, if not specified, the current time.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;With the preceding configuration example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Recent queries (&amp;lt; 6 hours old) are sent to &lt;code&gt;prometheus-main&lt;/code&gt; and &lt;code&gt;prometheus-hot&lt;/code&gt; only. This excludes &lt;code&gt;prometheus-cold&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Old queries (&amp;gt; 6 hours old) are sent to all backends, meaning &lt;code&gt;prometheus-main&lt;/code&gt;, &lt;code&gt;prometheus-hot&lt;/code&gt;, and &lt;code&gt;prometheus-cold&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This allows you to route queries to appropriate storage tiers based on data age, optimizing both performance and cost.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The &lt;code&gt;min_data_queried_age&lt;/code&gt; field supports Go duration format. Valid time units are &lt;code&gt;ns&lt;/code&gt;, &lt;code&gt;us&lt;/code&gt; (or &lt;code&gt;µs&lt;/code&gt;), &lt;code&gt;ms&lt;/code&gt;, &lt;code&gt;s&lt;/code&gt;, &lt;code&gt;m&lt;/code&gt;, &lt;code&gt;h&lt;/code&gt;. Examples: &lt;code&gt;&amp;quot;30s&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;15m&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;24h&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;168h&amp;quot;&lt;/code&gt; (7 days), &lt;code&gt;&amp;quot;1h30m&amp;quot;&lt;/code&gt;. Days are not supported directly; use hours instead (e.g., &lt;code&gt;&amp;quot;168h&amp;quot;&lt;/code&gt; for 7 days).&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;backend-response-selection&#34;&gt;Backend response selection&lt;/h3&gt;
&lt;p&gt;The query-tee enables you to configure a preferred backend that selects the response to send back to the client.
The query-tee returns the &lt;code&gt;Content-Type&lt;/code&gt; header, HTTP status code, and body of the response from the preferred backend.
The preferred backend can be configured via &lt;code&gt;-backend.preferred=&amp;lt;hostname&amp;gt;&lt;/code&gt;.
The value of the preferred backend configuration option must be the hostname of one of the configured backends.&lt;/p&gt;
&lt;p&gt;When a preferred backend is configured, the query-tee always returns the response from the preferred backend.&lt;/p&gt;
&lt;p&gt;When a preferred backend is not configured, the query-tee uses the following algorithm to select the backend response to send back to the client:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If at least one backend response status code is 2xx or 4xx, the query-tee selects the first received response whose status code is 2xx or 4xx.&lt;/li&gt;
&lt;li&gt;If no backend response status code is 2xx or 4xx, the query-tee selects the first received response regardless of the status code.&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The query-tee considers a 4xx response as a valid response to select because a 4xx status code is generally an invalid request and not a server-side issue.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;backend-results-comparison&#34;&gt;Backend results comparison&lt;/h3&gt;
&lt;p&gt;You can use the query-tee to compare query results received from multiple backends.
The query results comparison can be enabled setting the flag &lt;code&gt;-proxy.compare-responses=true&lt;/code&gt; and requires that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You&amp;rsquo;ve configured at least two backends by setting &lt;code&gt;-backend.endpoints&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You&amp;rsquo;ve configured a preferred backend by setting &lt;code&gt;-backend.preferred&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When you enable the query results comparison, the query-tee compares the response received from the preferred backend against each secondary backend individually and logs a message for each query whose results don&amp;rsquo;t match. Query-tee keeps track of the number of successful and failed comparison through the metric &lt;code&gt;cortex_querytee_responses_compared_total&lt;/code&gt;, with separate metrics for each secondary backend.&lt;/p&gt;
&lt;p&gt;By default, query-tee considers equivalent error messages as matching, even if they are not exactly the same.
This ensures that comparison does not fail for known situations where error messages are non-deterministic.
Set &lt;code&gt;-proxy.compare-exact-error-matching=true&lt;/code&gt; to require that error messages match exactly.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Query-tee compares floating point sample values with a tolerance that you can configure with the &lt;code&gt;-proxy.value-comparison-tolerance&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;The configured tolerance prevents false positives due to differences in floating point values rounding introduced by the non-deterministic series ordering within the Prometheus PromQL engine.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;



&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The default value of &lt;code&gt;-proxy.compare-skip-recent-samples&lt;/code&gt; is two minutes.
This means points within results with a timestamp within two minutes of the current time aren&amp;rsquo;t compared.
This prevents false positives due to racing with ingestion, and, if the query selects the output of recording rules, rule evaluation.&lt;/p&gt;
&lt;p&gt;If either Mimir cluster is running with a non-default value of &lt;code&gt;-ruler.evaluation-delay-duration&lt;/code&gt;, you should set &lt;code&gt;-proxy.compare-skip-recent-samples&lt;/code&gt; to one minute more than the value of &lt;code&gt;-ruler.evaluation-delay-duration&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;slow-query-log&#34;&gt;Slow query log&lt;/h3&gt;
&lt;p&gt;You can configure query-tee to log requests that take longer than the fastest backend by setting the flag &lt;code&gt;-proxy.log-slow-query-response-threshold&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The default value is &lt;code&gt;10s&lt;/code&gt; which logs requests that are ten seconds slower than the fastest backend.&lt;/p&gt;
&lt;p&gt;To disable slow query logging, set &lt;code&gt;-proxy.log-slow-query-response-threshold&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;exported-metrics&#34;&gt;Exported metrics&lt;/h3&gt;
&lt;p&gt;The query-tee exposes the following Prometheus metrics at the &lt;code&gt;/metrics&lt;/code&gt; endpoint listening on the port configured via the flag &lt;code&gt;-server.metrics-port&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# HELP cortex_querytee_backend_request_duration_seconds Time (in seconds) spent serving requests.
# TYPE cortex_querytee_backend_request_duration_seconds histogram
cortex_querytee_backend_request_duration_seconds_bucket{backend=&amp;#34;&amp;lt;hostname&amp;gt;&amp;#34;,method=&amp;#34;&amp;lt;method&amp;gt;&amp;#34;,route=&amp;#34;&amp;lt;route&amp;gt;&amp;#34;,status_code=&amp;#34;&amp;lt;status&amp;gt;&amp;#34;,le=&amp;#34;&amp;lt;bucket&amp;gt;&amp;#34;}
cortex_querytee_backend_request_duration_seconds_sum{backend=&amp;#34;&amp;lt;hostname&amp;gt;&amp;#34;,method=&amp;#34;&amp;lt;method&amp;gt;&amp;#34;,route=&amp;#34;&amp;lt;route&amp;gt;&amp;#34;,status_code=&amp;#34;&amp;lt;status&amp;gt;&amp;#34;}
cortex_querytee_backend_request_duration_seconds_count{backend=&amp;#34;&amp;lt;hostname&amp;gt;&amp;#34;,method=&amp;#34;&amp;lt;method&amp;gt;&amp;#34;,route=&amp;#34;&amp;lt;route&amp;gt;&amp;#34;,status_code=&amp;#34;&amp;lt;status&amp;gt;&amp;#34;}

# HELP cortex_querytee_responses_total Total number of responses sent back to the client by the selected backend.
# TYPE cortex_querytee_responses_total counter
cortex_querytee_responses_total{backend=&amp;#34;&amp;lt;hostname&amp;gt;&amp;#34;,method=&amp;#34;&amp;lt;method&amp;gt;&amp;#34;,route=&amp;#34;&amp;lt;route&amp;gt;&amp;#34;}

# HELP cortex_querytee_responses_compared_total Total number of responses compared per route name by result.
# TYPE cortex_querytee_responses_compared_total counter
cortex_querytee_responses_compared_total{route=&amp;#34;&amp;lt;route&amp;gt;&amp;#34;,secondary_backend=&amp;#34;&amp;lt;hostname&amp;gt;&amp;#34;,result=&amp;#34;&amp;lt;success|fail|skip&amp;gt;&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Additionally, if backend results comparison is configured, two native histograms are available:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cortex_querytee_backend_response_relative_duration_seconds{route=&amp;quot;&amp;lt;route&amp;gt;&amp;quot;,secondary_backend=&amp;quot;&amp;lt;hostname&amp;gt;&amp;quot;}&lt;/code&gt;: Time (in seconds) of the secondary backend minus the preferred backend, for each secondary backend.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cortex_querytee_backend_response_relative_duration_proportional{route=&amp;quot;&amp;lt;route&amp;gt;&amp;quot;,secondary_backend=&amp;quot;&amp;lt;hostname&amp;gt;&amp;quot;}&lt;/code&gt;: Response time of the secondary backend minus the preferred backend, as a proportion of the preferred backend response time.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ruler-remote-operational-mode-test&#34;&gt;Ruler remote operational mode test&lt;/h3&gt;
&lt;p&gt;When the ruler is configured with the &lt;a href=&#34;../../../references/architecture/components/ruler/&#34;&gt;remote evaluation mode&lt;/a&gt; you can use the query-tee to compare rule evaluations too.
To test ruler evaluations with query-tee, set the &lt;code&gt;-ruler.query-frontend.address&lt;/code&gt; CLI flag or its respective YAML configuration parameter for the ruler with query-tee&amp;rsquo;s gRPC address:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;ruler:
  query_frontend:
    address: &amp;#34;dns://query-tee:9095&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When the ruler evaluates a rule, the test flow is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ruler sends gRPC request to query-tee&lt;/li&gt;
&lt;li&gt;query-tee forwards the request to the query-frontend backends configured setting the &lt;code&gt;-backend.endpoints&lt;/code&gt; CLI flag&lt;/li&gt;
&lt;li&gt;query-tee receives the response from the query-frontend and forwards the result (based on the preferred backend) to the ruler&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="grafana-mimir-query-tee">Grafana Mimir query-tee&lt;/h1>
&lt;p>The query-tee is a standalone tool that you can use for testing purposes when comparing the query results and performance of two Grafana Mimir clusters.
The two Mimir clusters compared by the query-tee must ingest the same series and samples.&lt;/p></description></item><item><title>Grafana mimir-continuous-test</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/mimir-continuous-test/</link><pubDate>Wed, 03 Jun 2026 09:01:40 +0200</pubDate><guid>https://grafana.com/docs/mimir/v3.1.x/manage/tools/mimir-continuous-test/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-mimir-continuous-test&#34;&gt;Grafana mimir-continuous-test&lt;/h1&gt;
&lt;p&gt;As a developer, you can use the mimir-continuous-test tool to run smoke tests on live Grafana Mimir clusters.
This tool identifies a class of bugs that could be difficult to spot during development.
Two operating modes are supported:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;As a continuously running deployment in your environment, mimir-continuous-test can be used to detect issues on a live Grafana Mimir cluster over time.&lt;/li&gt;
&lt;li&gt;As an ad-hoc smoke test tool, mimir-continuous-test can be used to validate basic functionality after configuration changes are made to a Grafana Mimir cluster.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;download-and-run-mimir-continuous-test&#34;&gt;Download and run mimir-continuous-test&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Using Docker:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;docker pull &amp;#34;grafana/mimir:latest&amp;#34;
docker run --rm -ti grafana/mimir -target=continuous-test&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Using a local binary:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Download the appropriate &lt;a href=&#34;https://github.com/grafana/mimir/releases/latest&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;mimir binary&lt;/a&gt; for your operating system and architecture, and make it executable.&lt;/p&gt;
&lt;p&gt;For Linux with the AMD64 architecture, execute the following command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -Lo mimir https://github.com/grafana/mimir/releases/latest/download/mimir-linux-amd64
chmod &amp;#43;x mimir
mimir -target=continuous-test&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;In &lt;a href=&#34;../../../release-notes/v2.13/&#34;&gt;Grafana Mimir 2.13&lt;/a&gt; the mimir-continuous-test became a part of Mimir as its own target.&lt;/p&gt;
&lt;p&gt;The standalone &lt;code&gt;grafana/mimir-continuous-test&lt;/code&gt; Docker image and mimir-continuous-test binary were deprecated in 2.13 and removed in 3.0.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;configure-mimir-continuous-test&#34;&gt;Configure mimir-continuous-test&lt;/h2&gt;
&lt;p&gt;Mimir-continuous-test requires the endpoints of the backend Grafana Mimir clusters and the authentication for writing and querying testing metrics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;-tests.write-endpoint&lt;/code&gt; to the base endpoint on the write path. Remove any trailing slash from the URL. The tool appends the specific API path to the URL, for example &lt;code&gt;/api/v1/push&lt;/code&gt; for the remote-write API.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;-tests.read-endpoint&lt;/code&gt; to the base endpoint on the read path. Remove any trailing slash from the URL. The tool appends the specific API path to the URL, for example &lt;code&gt;/api/v1/query_range&lt;/code&gt; for the range-query API.&lt;/li&gt;
&lt;li&gt;Set the authentication means to use to write and read metrics in tests. By priority order:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-tests.bearer-token&lt;/code&gt; for bearer token authentication.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-tests.basic-auth-user&lt;/code&gt; and &lt;code&gt;-tests.basic-auth-password&lt;/code&gt; for a basic authentication.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-tests.tenant-id&lt;/code&gt; to the tenant ID, default to &lt;code&gt;anonymous&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;-tests.smoke-test&lt;/code&gt; to run the test once and immediately exit. In this mode, the process exit code is non-zero when the test fails.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;You can run &lt;code&gt;mimir -help&lt;/code&gt; to list all available configuration options. All configuration options for mimir-continuous-test begin with &lt;code&gt;tests&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&lt;/h2&gt;
&lt;p&gt;Mimir-continuous-test periodically runs a suite of tests, writes data to Mimir, queries that data back, and checks if the query results match what is expected.
The tool exposes metrics that you can use to alert on test failures. The tool logs the details about the failed tests.&lt;/p&gt;
&lt;h3 id=&#34;exported-metrics&#34;&gt;Exported metrics&lt;/h3&gt;
&lt;p&gt;Mimir-continuous-test exposes the following Prometheus metrics at the &lt;code&gt;/metrics&lt;/code&gt; endpoint listening on the port that you configured via the flag &lt;code&gt;-server.metrics-port&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# HELP mimir_continuous_test_writes_total Total number of attempted write requests.
# TYPE mimir_continuous_test_writes_total counter
mimir_continuous_test_writes_total{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}
{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_writes_failed_total Total number of failed write requests.
# TYPE mimir_continuous_test_writes_failed_total counter
mimir_continuous_test_writes_failed_total{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;,status_code=&amp;#34;&amp;lt;code&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_writes_request_duration_seconds Duration of the requests
# TYPE mimir_continuous_test_writes_request_duration_seconds histogram
mimir_continuous_test_writes_request_duration_seconds{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_queries_total Total number of attempted query requests.
# TYPE mimir_continuous_test_queries_total counter
mimir_continuous_test_queries_total{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_queries_failed_total Total number of failed query requests.
# TYPE mimir_continuous_test_queries_failed_total counter
mimir_continuous_test_queries_failed_total{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_query_result_checks_total Total number of query results checked for correctness.
# TYPE mimir_continuous_test_query_result_checks_total counter
mimir_continuous_test_query_result_checks_total{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_query_result_checks_failed_total Total number of query results failed when checking for correctness.
# TYPE mimir_continuous_test_query_result_checks_failed_total counter
mimir_continuous_test_query_result_checks_failed_total{test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}

# HELP mimir_continuous_test_queries_request_duration_seconds Duration of the requests
# TYPE mimir_continuous_test_queries_request_duration_seconds histogram
mimir_continuous_test_queries_request_duration_seconds{results_cache=&amp;#34;false&amp;#34;,test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}
mimir_continuous_test_queries_request_duration_seconds{results_cache=&amp;#34;true&amp;#34;,test=&amp;#34;&amp;lt;name&amp;gt;&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The metrics &lt;code&gt;mimir_continuous_test_writes_request_duration_seconds&lt;/code&gt; and &lt;code&gt;mimir_continuous_test_queries_request_duration_seconds&lt;/code&gt;
are exposed as &lt;a href=&#34;../../../send/native-histograms/&#34;&gt;native histograms&lt;/a&gt; and don’t have proper textual presentation on the &lt;code&gt;/metrics&lt;/code&gt; endpoint.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;alerts&#34;&gt;Alerts&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;../../monitor-grafana-mimir/installing-dashboards-and-alerts/&#34;&gt;Grafana Mimir alerts&lt;/a&gt; include checks on failures that mimir-continuous-test tracks.
When running mimir-continuous-test, use the provided alerts.&lt;/p&gt;
]]></content><description>&lt;h1 id="grafana-mimir-continuous-test">Grafana mimir-continuous-test&lt;/h1>
&lt;p>As a developer, you can use the mimir-continuous-test tool to run smoke tests on live Grafana Mimir clusters.
This tool identifies a class of bugs that could be difficult to spot during development.
Two operating modes are supported:&lt;/p></description></item><item><title>Grafana Mimirtool</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/mimirtool/</link><pubDate>Wed, 03 Jun 2026 09:01:40 +0200</pubDate><guid>https://grafana.com/docs/mimir/v3.1.x/manage/tools/mimirtool/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-mimirtool&#34;&gt;Grafana Mimirtool&lt;/h1&gt;
&lt;p&gt;Mimirtool is a command-line tool that operators and tenants can use to execute a number of common tasks that involve Grafana Mimir or Grafana Cloud Metrics.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;alertmanager&lt;/code&gt; command enables you to create, update, and delete tenant configurations in Grafana Mimir Alertmanager or Grafana Cloud Metrics.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;alertmanager&lt;/code&gt; command, refer to &lt;a href=&#34;#alertmanager&#34;&gt;Alertmanager&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;rules&lt;/code&gt; command enables you to validate and lint Prometheus rule files and convert them for use in Grafana Mimir.
You can also create, update, and delete rulegroups in Grafana Mimir or Grafana Cloud Metrics.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;rules&lt;/code&gt; command, refer to &lt;a href=&#34;#rules&#34;&gt;Rules&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;remote-read&lt;/code&gt; subcommand enables you to fetch statistics and series from &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;remote-read&lt;/a&gt; APIs.
You can write series from a remote-read API to a local TSDB file that you load into Prometheus.&lt;/p&gt;
&lt;p&gt;For more information about the remote-read command, refer to &lt;a href=&#34;#remote-read&#34;&gt;Remote-read&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;analyze&lt;/code&gt; command extracts statistics about metric usage from Grafana or Hosted Grafana instances.
You can also extract the same metrics from Grafana dashboard JSON files or Prometheus rule YAML files.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;analyze&lt;/code&gt; command, refer to &lt;a href=&#34;#analyze&#34;&gt;Analyze&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;bucket-validation&lt;/code&gt; command verifies that an object storage bucket is suitable as a backend storage for Grafana Mimir.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;bucket-validation&lt;/code&gt; command, refer to &lt;a href=&#34;#bucket-validation&#34;&gt;Bucket validation&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;acl&lt;/code&gt; command generates the label-based access control header used in Grafana Enterprise Metrics and Grafana Cloud Metrics.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;acl&lt;/code&gt; command, refer to &lt;a href=&#34;#acl&#34;&gt;ACL&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;config&lt;/code&gt; command helps convert configuration files from Cortex to Grafana Mimir.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;config&lt;/code&gt; command, refer to &lt;a href=&#34;#config&#34;&gt;Config&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;backfill&lt;/code&gt; command uploads existing Prometheus TSDB blocks into Grafana Mimir.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;backfill&lt;/code&gt; command, refer to &lt;a href=&#34;#backfill&#34;&gt;Backfill&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;partition-ring&lt;/code&gt; commands allow for forcefully modifying the ingest storage partition ring via memberlist.&lt;/p&gt;
&lt;p&gt;For more information about the &lt;code&gt;partition-ring&lt;/code&gt; command, refer to &lt;a href=&#34;#partition-ring&#34;&gt;Partition ring&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mimirtool interacts with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;User-facing APIs provided by Grafana Mimir.&lt;/li&gt;
&lt;li&gt;Backend storage components containing Grafana Mimir data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;p&gt;To install Mimirtool with Homebrew on macOS, run &lt;code&gt;brew install mimirtool&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To install Mimirtool in other environments, download the appropriate binary from the &lt;a href=&#34;https://github.com/grafana/mimir/releases/latest&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;latest release&lt;/a&gt; for your operating system and architecture and make it executable.&lt;/p&gt;
&lt;p&gt;Alternatively, use a command line tool such as &lt;code&gt;curl&lt;/code&gt; to download &lt;code&gt;mimirtool&lt;/code&gt;. For example, for Linux with the AMD64 architecture, use the following command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -fLo mimirtool https://github.com/grafana/mimir/releases/latest/download/mimirtool-linux-amd64
chmod &amp;#43;x mimirtool&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;configuration-options&#34;&gt;Configuration options&lt;/h2&gt;
&lt;p&gt;For Mimirtools to interact with Grafana Mimir, Grafana Enterprise Metrics, Prometheus, or Grafana, set the following environment variables or CLI flags.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_ADDRESS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--address&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the address of the API of the Grafana Mimir cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_API_USER&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--user&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the basic authentication username. If this variable is empty and &lt;code&gt;MIMIR_API_KEY&lt;/code&gt; is set, the system uses &lt;code&gt;MIMIR_TENANT_ID&lt;/code&gt; instead. If you&amp;rsquo;re using Grafana Cloud, this variable is your instance ID.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_API_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--key&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the basic authentication password. If you&amp;rsquo;re using Grafana Cloud, this variable is your API key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TENANT_ID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the tenant ID of the Grafana Mimir instance that Mimirtool interacts with.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_EXTRA_HEADERS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--extra-headers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Extra headers to add to the requests in header=value format. You can specify this flag multiple times. You must newline separate environment values.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;It is also possible to set TLS-related options with the following environment variables or CLI flags:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TLS_CA_PATH&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--tls-ca-path&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the path to the CA certificate to use to verify the connection to the Grafana Mimir cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TLS_CERT_PATH&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--tls-cert-path&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the path to the client certificate to use to authenticate to the Grafana Mimir cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TLS_KEY_PATH&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--tls-key-path&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the path to the private key to use to authenticate to the Grafana Mimir cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TLS_INSECURE_SKIP_VERIFY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--tls-insecure-skip-verify&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If &lt;code&gt;true&lt;/code&gt;, disables verification of the Grafana Mimir cluster&amp;rsquo;s TLS certificate. This is insecure and not recommended.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;commands&#34;&gt;Commands&lt;/h2&gt;
&lt;p&gt;The following sections outline the commands that you can run against Grafana Mimir and Grafana Cloud Metrics.&lt;/p&gt;
&lt;h3 id=&#34;alertmanager&#34;&gt;Alertmanager&lt;/h3&gt;
&lt;p&gt;The following commands interact with Grafana Mimir Alertmanager configuration and alert template files.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The Mimir Alertmanager exposes the configuration API based on the path that you set via the &lt;code&gt;-server.path-prefix&lt;/code&gt; flag; it doesn&amp;rsquo;t use the path of the &lt;code&gt;-http.alertmanager-http-prefix&lt;/code&gt; flag.&lt;/p&gt;
&lt;p&gt;If you run Mimir with the default configuration, &lt;code&gt;-server.path-prefix&lt;/code&gt;, where the default value is &lt;code&gt;/&lt;/code&gt;, then only set the hostname for the &lt;code&gt;--address&lt;/code&gt; flag of the &lt;code&gt;mimirtool&lt;/code&gt; command; do not set a path-specific address.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;/&lt;/code&gt; is correct, and &lt;code&gt;/alertmanager&lt;/code&gt; is incorrect.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h4 id=&#34;get-alertmanager-configuration&#34;&gt;Get Alertmanager configuration&lt;/h4&gt;
&lt;p&gt;The following command shows the current Alertmanager configuration.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager get&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Alternatively, you can output the config and template files to a folder which can then be loaded back
into alert manager at a later date. For example, the following command outputs the files to a folder called &lt;code&gt;am&lt;/code&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager get --output-dir=&amp;#34;am&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The config file is named &lt;code&gt;config.yaml&lt;/code&gt; and the template files ends in &lt;code&gt;.tpl&lt;/code&gt;, where each template is written
out to its own file. Note that using the &lt;code&gt;--output-dir&lt;/code&gt; flag only writes the output to files and no longer print
the config to the console.&lt;/p&gt;
&lt;h4 id=&#34;load-alertmanager-configuration&#34;&gt;Load Alertmanager configuration&lt;/h4&gt;
&lt;p&gt;The following command loads an Alertmanager configuration to the Alertmanager instance.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager load &amp;lt;config_file&amp;gt;
mimirtool alertmanager load &amp;lt;config_file&amp;gt; &amp;lt;template_files&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;example&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager load ./example_alertmanager_config.yaml ./example_alertmanager_template.tpl&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;./example_alertmanager_config.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;route:
  receiver: &amp;#34;example_receiver&amp;#34;
  group_by: [&amp;#34;example_groupby&amp;#34;]
receivers:
  - name: &amp;#34;example_receiver&amp;#34;
templates:
  - example_template.tpl&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;./example_alertmanager_template.tpl&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;gotemplate&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-gotemplate&#34;&gt;{{ define &amp;#34;alert_customer_env_message&amp;#34; }}
  [{{ .CommonLabels.alertname }} | {{ .CommonLabels.customer }} | {{ .CommonLabels.environment }}]
{{ end }}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The input to &lt;code&gt;[&amp;lt;template_files&amp;gt;...]&lt;/code&gt; accepts wildcard, i.e. &lt;code&gt;*.tpl&lt;/code&gt; will include all the template files ending
in &lt;code&gt;.tpl&lt;/code&gt;. If we have used the previous command of exporting the config and templates to a directory, they
can be loaded&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# assuming we have written the files out to the folder am
# mimirtool alertmanager get --output-dir=&amp;#34;am&amp;#34;
mimirtool alertmanager load  am/config.yaml am/*.tpl&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;delete-alertmanager-configuration&#34;&gt;Delete Alertmanager configuration&lt;/h4&gt;
&lt;p&gt;The following command deletes the Alertmanager configuration in the Grafana Mimir Alertmanager.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;migrate-alertmanager-configuration-for-utf-8-in-mimir-212-and-later&#34;&gt;Migrate Alertmanager configuration for UTF-8 in Mimir 2.12 and later&lt;/h4&gt;
&lt;p&gt;This requires mimirtool version 2.12 or later. To check your version of mimirtool, run &lt;code&gt;mimirtool version&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In accordance with &lt;a href=&#34;https://github.com/prometheus/prometheus/issues/13095&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;prometheus/prometheus#13095&lt;/a&gt;
and &lt;a href=&#34;https://github.com/prometheus/alertmanager/issues/3486&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;prometheus/alertmanager#3486&lt;/a&gt;, Mimir is
adding support for UTF-8. To support UTF-8 in alerts, routes, silences, and inhibition rules,
Alertmanager has added a new parser for matchers that has a number of backwards incompatible changes.
More information about these changes can be found &lt;a href=&#34;https://prometheus.io/docs/alerting/latest/configuration/#label-matchers&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The migrate-utf8 command migrates an existing Alertmanager configuration in preparation for when
UTF-8 is enabled in a Mimir installation. To do this, it translates matchers that are incompatible
with UTF-8 into equivalent matchers that are compatible. This translation is backwards compatible,
does not change the behavior of existing matchers, and works even in Mimir installations that
do not have UTF-8 enabled.&lt;/p&gt;
&lt;p&gt;The need to migrate an Alertmanager configuration depends on whether it contains matchers
incompatible with UTF-8. You can verify if an existing Alertmanager configuration needs to be
migrated for UTF-8 by running the verify command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager verify &amp;lt;config_file&amp;gt; [template_files...]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the command succeeds without any warnings, the configuration is compatible with UTF-8 and you
don&amp;rsquo;t need to migrate it.&lt;/p&gt;
&lt;p&gt;However, if the command prints the following warning, then you need to migrate the Alertmanager
configuration with the migrate-utf8 command.&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the classic matchers parser as a fallback. To make this input compatible with the UTF-8 matchers parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The command takes as input an existing configuration and template files, and prints as output
the migrated configuration and template files:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager migrate-utf8 &amp;lt;config_file&amp;gt; [template_files...]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also output the migrated configuration and template files to a folder which can be
reviewed before being loaded back into the Alertmanager at a later time. We recommended you output
the migrated files to a different folder than the original files so you always have the original files
as a backup. For example, the following command outputs the migrated configuration and template files
to a folder called &lt;code&gt;migrated&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager migrate-utf8 &amp;lt;config_file&amp;gt; [template_files...] --output-dir=&amp;#34;migrated&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Within the output dir, the configuration file is named &lt;code&gt;config.yaml&lt;/code&gt; and the template files ends in
&lt;code&gt;.tpl&lt;/code&gt;, where each template is written out to its own file.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;When you use the &lt;code&gt;--output-dir&lt;/code&gt; flag, the command only writes the output to files and doesn&amp;rsquo;t print the configuration to the console.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;After you migrate an Alertmanager configuration, use the verify command to verify it:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager verify &amp;lt;config_file&amp;gt; [template_files...]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It should succeed without warnings.&lt;/p&gt;
&lt;p&gt;You can also run the verify command with the &lt;code&gt;--utf8-strict-mode&lt;/code&gt; flag to verify if an Alertmanager
configuration is compatible with UTF-8:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager verify &amp;lt;config_file&amp;gt; [template_files...] --utf8-strict-mode&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When using this flag, the verify command prints a warning with the text &lt;code&gt;UTF-8 mode enabled&lt;/code&gt; to let
you know the command is using UTF-8 strict mode to validate the Alertmanager configuration. Unlike
when the flag is omitted, it doesn&amp;rsquo;t print warnings if a configuration is incompatible with UTF-8.
Instead, the command exits with an error. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;level=warn msg=&amp;#34;UTF-8 strict mode enabled&amp;#34;
mimirtool: error: end of input: expected label value, try --help&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the command exits without error, and you&amp;rsquo;re satisfied with the changes made to the migrated
configuration and template files, reload it using the &lt;code&gt;load&lt;/code&gt; command.&lt;/p&gt;
&lt;h4 id=&#34;validate-alertmanager-configuration&#34;&gt;Validate Alertmanager configuration&lt;/h4&gt;
&lt;p&gt;The following command validates an Alertmanager configuration file. It does not load the configuration to the Alertmanager instance.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager verify &amp;lt;config_file&amp;gt; [template_files...]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;alert-verification&#34;&gt;Alert verification&lt;/h4&gt;
&lt;p&gt;The following command verifies if alerts in an Alertmanager cluster are deduplicated. This command is useful for verifying the correct configuration when transferring from Prometheus to Grafana Mimir alert evaluation.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alerts verify&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;render-template&#34;&gt;Render template&lt;/h4&gt;
&lt;p&gt;You can render your Alertmanager template with the &lt;code&gt;render&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;The argument to the &lt;code&gt;--template.glob&lt;/code&gt; option is a glob that expands to the alert template paths.&lt;/p&gt;
&lt;p&gt;The argument to the &lt;code&gt;--template.data&lt;/code&gt; option is a JSON file containing Alertmanager template data.&lt;/p&gt;
&lt;p&gt;The argument to the &lt;code&gt;--template.text&lt;/code&gt; option is a Go template.
The command renders this template with the templates found be expanding &lt;code&gt;--template-glob&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The following command render a template and prints it to the terminal.
It assumes you have written the templates to the directory &lt;code&gt;templates&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool alertmanager render --template.glob &amp;#39;templates/*&amp;#39; --template.data alert_data1.json --template.text &amp;#39;{{ template &amp;#34;my_message&amp;#34; . }}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;rules&#34;&gt;Rules&lt;/h3&gt;
&lt;p&gt;The rules command features sub-commands for working with Prometheus rule files and with the APIs in the Grafana Mimir ruler.&lt;/p&gt;
&lt;p&gt;The commands in this section enable you to perform the following actions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Load and show Prometheus rule files&lt;/li&gt;
&lt;li&gt;Interact with individual rule groups in the Mimir ruler&lt;/li&gt;
&lt;li&gt;Manipulate local rule files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some of the functionality that &lt;code&gt;mimirtool rules&lt;/code&gt; offers is also available as a GitHub Action.
For more information, refer to the &lt;a href=&#34;https://github.com/grafana/mimir/blob/main/operations/mimir-rules-action/README.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;documentation of Mimirtool Github Action&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Configuration options relevant to rules commands:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--auth-token&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Authentication token for bearer token or JWT authentication.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--enable-experimental-functions&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If set, enables parsing experimental PromQL functions.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h4 id=&#34;list-rules&#34;&gt;List rules&lt;/h4&gt;
&lt;p&gt;The following command retrieves the names of all rule groups in the Grafana Mimir instance and prints them to the terminal.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules list&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;print-rules&#34;&gt;Print rules&lt;/h4&gt;
&lt;p&gt;The following command retrieves all rule groups in the Grafana Mimir instance and prints them to the terminal.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules print&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To save all the rules for editing and re-upload to Mimir, use the &lt;code&gt;--output-dir&lt;/code&gt; option.
The default output directory is the current directory.
The output file has the format required by &lt;code&gt;mimirtool rules load&lt;/code&gt; or &lt;code&gt;mimirtool rules sync&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example, to save the file in the &lt;code&gt;rules&lt;/code&gt; subdirectory:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules print --output-dir=rules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;get-rule-group&#34;&gt;Get rule group&lt;/h4&gt;
&lt;p&gt;The following command retrieves a single rule group and prints it to the terminal.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules get &amp;lt;namespace&amp;gt; &amp;lt;rule_group_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To save the rule group for editing and re-upload to Mimir, use the &lt;code&gt;--output-dir&lt;/code&gt; option.
The default output directory is the current directory.
The output file has the format required by &lt;code&gt;mimirtool rules load&lt;/code&gt; or &lt;code&gt;mimirtool rules sync&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example, to save the file in the &lt;code&gt;rules&lt;/code&gt; subdirectory:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules get &amp;lt;namespace&amp;gt; &amp;lt;rule_group_name&amp;gt; --output-dir=rules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;delete-rule-group&#34;&gt;Delete rule group&lt;/h4&gt;
&lt;p&gt;The following command deletes a rule group.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules delete &amp;lt;namespace&amp;gt; &amp;lt;rule_group_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;load-rule-group&#34;&gt;Load rule group&lt;/h4&gt;
&lt;p&gt;The following command loads each rule group from the files into Grafana Mimir.
This command overwrites all existing rule groups with the same name.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules load &amp;lt;file_path&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;example-1&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules load ./example_rules_one.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;./example_rules_one.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;namespace: my_namespace
groups:
  - name: example
    interval: 5m
    rules:
      - record: job:http_inprogress_requests:sum
        expr: sum by (job) (http_inprogress_requests)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command, like the other &lt;code&gt;rules&lt;/code&gt; subcommands, can load multiple rule groups at once:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules load ./example_rules_one.yaml ./example_rules_two.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;delete-a-namespace&#34;&gt;Delete a namespace&lt;/h4&gt;
&lt;p&gt;The following command deletes all of the rule groups in a namespace, including the namespace itself:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules delete-namespace &amp;lt;namespace&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;lint&#34;&gt;Lint&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;lint&lt;/code&gt; command provides YAML and PromQL expression formatting within the rule file.&lt;/p&gt;
&lt;p&gt;This command edits the rule file in place.
To perform a trial run that does not make changes, you can use the dry run flag (&lt;code&gt;-n&lt;/code&gt;).&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This command doesn&amp;rsquo;t verify if a query is correct and doesn&amp;rsquo;t interact with your Grafana Mimir cluster.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;


&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules lint &amp;lt;file_path&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The format of the file is the same format as shown in &lt;a href=&#34;#load-rule-group&#34;&gt;rules load&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&#34;prepare&#34;&gt;Prepare&lt;/h4&gt;
&lt;p&gt;This &lt;code&gt;prepare&lt;/code&gt; command prepares a rules file that you upload to Grafana Mimir.
It lints all PromQL expressions and adds a label to your PromQL query aggregations in the file.
The format of the file is the same format as shown in &lt;a href=&#34;#load-rule-group&#34;&gt;rules load&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This command doesn&amp;rsquo;t interact with your Grafana Mimir cluster.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;


&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules prepare &amp;lt;file_path&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;configuration&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;-i&lt;/code&gt;, &lt;code&gt;--in-place&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Edits the file in place. If not set, the system generates a new file with the extension &lt;code&gt;.result&lt;/code&gt; that contains the results.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;-l&lt;/code&gt;, &lt;code&gt;--label=&amp;quot;cluster&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Specifies the label for aggregations. By default, the label is set to &lt;code&gt;cluster&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--label-excluded-rule-groups&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Comma separated list of rule group names to exclude when including the configured label to aggregations.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--rule-dirs&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Comma separated list of paths to directories containing rules yaml files. Each file in a directory with a .yml or .yaml suffix will be parsed.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-2&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules prepare ./example_rules_one.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;./example_rules_one.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;namespace: my_namespace
groups:
  - name: example
    interval: 5m
    rules:
      - record: job:http_inprogress_requests:sum
        expr: sum by (job) (http_inprogress_requests)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;./example_rules_one.yaml.result&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;namespace: my_namespace
groups:
  - name: example
    interval: 5m
    rules:
      - record: job:http_inprogress_requests:sum
        # note the added cluster label
        expr: sum by(job, cluster) (http_inprogress_requests)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;After the command runs, an output message indicates if the operation was successful:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;INFO[0000] SUCCESS: 1 rules found, 0 modified expressions&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;check&#34;&gt;Check&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;check&lt;/code&gt; command checks rules against the recommended &lt;a href=&#34;https://prometheus.io/docs/practices/rules/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;best practices&lt;/a&gt; for
rules.
This command does not interact with your Grafana Mimir cluster.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules check &amp;lt;file_path&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;example-3&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules check rules.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;rules.yaml&lt;/code&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;namespace: my_namespace
groups:
  - name: example
    interval: 5m
    rules:
      - record: job_http_inprogress_requests_sum
        expr: sum by (job) (http_inprogress_requests)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;ERRO[0000] bad recording rule name error=&amp;#34;recording rule name does not match level:metric:operation format, must contain at least one colon&amp;#34; file=rules.yaml rule=job_http_inprogress_requests_sum ruleGroup=example&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The format of the file is the same format as shown in &lt;a href=&#34;#load-rule-group&#34;&gt;rules load&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&#34;diff&#34;&gt;Diff&lt;/h4&gt;
&lt;p&gt;The following command compares rules against the rules in your Grafana Mimir cluster.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules diff &amp;lt;file_path&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The format of the file is the same format as shown in &lt;a href=&#34;#load-rule-group&#34;&gt;rules load&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To restrict the affected namespaces, use the &lt;code&gt;--namespaces&lt;/code&gt; and &lt;code&gt;--ignore-namespaces&lt;/code&gt; parameters as well as their RegEx variants &lt;code&gt;--namespaces-regex&lt;/code&gt; and &lt;code&gt;--ignore-namespaces-regex&lt;/code&gt;.&lt;/p&gt;
&lt;h5 id=&#34;configuration-1&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--namespaces&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;comma-separated list of namespaces to check during a diff&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--ignored-namespaces&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;comma-separated list of namespaces to ignore during a diff&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--namespaces-regex&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;regex matching namespaces to check during a diff&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--ignored-namespaces-regex&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;regex matching namespaces to ignore during a diff&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Only one of the namespace selection flags can be specified.&lt;/p&gt;
&lt;h4 id=&#34;sync&#34;&gt;Sync&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;sync&lt;/code&gt; command compares rules against the rules in your Grafana Mimir cluster.
The command applies any differences to your Grafana Mimir cluster.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool rules sync &amp;lt;file_path&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The format of the file is the same format as shown in &lt;a href=&#34;#load-rule-group&#34;&gt;rules load&lt;/a&gt;.&lt;/p&gt;
&lt;h5 id=&#34;configuration-2&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--namespaces&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;comma-separated list of namespaces to check during a sync&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--ignored-namespaces&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;comma-separated list of namespaces to ignore during a sync&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--namespaces-regex&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;regex matching namespaces to check during a sync&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--ignored-namespaces-regex&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;regex matching namespaces to ignore during a sync&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Only one of the namespace selection flags can be specified.&lt;/p&gt;
&lt;h3 id=&#34;remote-read&#34;&gt;Remote-read&lt;/h3&gt;
&lt;p&gt;Grafana Mimir exposes a &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;remote read API&lt;/a&gt; which allows the system to access the stored series.
The &lt;code&gt;remote-read&lt;/code&gt; subcommand &lt;code&gt;mimirtool&lt;/code&gt; enables you to interact with its API, and to determine which series are stored.&lt;/p&gt;
&lt;p&gt;The remote-read commands support multiple &lt;code&gt;--selector&lt;/code&gt; flags to query multiple series selectors in a single request, leveraging the remote read protocol&amp;rsquo;s native batching capabilities for improved performance. When multiple selectors are specified, their results are combined into a single unified output.&lt;/p&gt;
&lt;p&gt;Additionally, you can control the response format using the &lt;code&gt;--use-chunks&lt;/code&gt; flag:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--use-chunks=true&lt;/code&gt; (default): Requests chunked streaming response for better performance with large datasets&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--use-chunks=false&lt;/code&gt;: Requests traditional sampled response format&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;stats&#34;&gt;Stats&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;remote-read stats&lt;/code&gt; command summarizes statistics of the stored series that match the specified selector(s).&lt;/p&gt;
&lt;h5 id=&#34;example-4&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Single selector
mimirtool remote-read stats --selector &amp;#39;{job=&amp;#34;node&amp;#34;}&amp;#39; --address http://demo.robustperception.io:9090 --remote-read-path /api/v1/read

# Multiple selectors in a single request
mimirtool remote-read stats --selector &amp;#39;{job=&amp;#34;node&amp;#34;}&amp;#39; --selector &amp;#39;up&amp;#39; --selector &amp;#39;go_memstats_alloc_bytes&amp;#39; --address http://demo.robustperception.io:9090 --remote-read-path /api/v1/read&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Running the command results in the following output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;INFO[0000] Create remote read client using endpoint &amp;#39;http://demo.robustperception.io:9090/api/v1/read&amp;#39;
INFO[0000] Querying time from=2020-12-30T14:00:00Z to=2020-12-30T15:00:00Z with selector={job=&amp;#34;node&amp;#34;}
INFO[0000] MIN TIME                           MAX TIME                           DURATION     NUM SAMPLES  NUM SERIES   NUM STALE NAN VALUES  NUM NAN VALUES
INFO[0000] 2020-12-30 14:00:00.629 &amp;#43;0000 UTC  2020-12-30 14:59:59.629 &amp;#43;0000 UTC  59m59s       159480       425          0                     0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;dump&#34;&gt;Dump&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;remote-read dump&lt;/code&gt; command prints all series and samples that match the specified selector(s).&lt;/p&gt;
&lt;h5 id=&#34;example-5&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Single selector
mimirtool remote-read dump --selector &amp;#39;up{job=&amp;#34;node&amp;#34;}&amp;#39; --address http://demo.robustperception.io:9090 --remote-read-path /api/v1/read

# Multiple selectors
mimirtool remote-read dump --selector &amp;#39;up{job=&amp;#34;node&amp;#34;}&amp;#39; --selector &amp;#39;go_memstats_alloc_bytes&amp;#39; --address http://demo.robustperception.io:9090 --remote-read-path /api/v1/read&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Running the command results in the following output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;{__name__=&amp;#34;up&amp;#34;, instance=&amp;#34;demo.robustperception.io:9100&amp;#34;, job=&amp;#34;node&amp;#34;} 1 1609336914711
{__name__=&amp;#34;up&amp;#34;, instance=&amp;#34;demo.robustperception.io:9100&amp;#34;, job=&amp;#34;node&amp;#34;} NaN 1609336924709 # StaleNaN
...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;export&#34;&gt;Export&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;remote-read export&lt;/code&gt; command exports all series and samples that match the specified selector(s) into a local TSDB.
You can use local tooling such as &lt;code&gt;prometheus&lt;/code&gt; and &lt;a href=&#34;https://github.com/prometheus/prometheus/tree/main/cmd/promtool&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;promtool&lt;/code&gt;&lt;/a&gt; to further analyze the TSDB.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Use Remote Read API to download all metrics with label job=node into local tsdb
mimirtool remote-read export --selector &amp;#39;{job=&amp;#34;node&amp;#34;}&amp;#39; --address http://demo.robustperception.io:9090 --remote-read-path /api/v1/read --tsdb-path ./local-tsdb

# Download multiple metric families in a single request
mimirtool remote-read export --selector &amp;#39;{job=&amp;#34;node&amp;#34;}&amp;#39; --selector &amp;#39;up&amp;#39; --selector &amp;#39;prometheus_build_info&amp;#39; --address http://demo.robustperception.io:9090 --remote-read-path /api/v1/read --tsdb-path ./local-tsdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Running the command results in the following output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;INFO[0000] Create remote read client using endpoint &amp;#39;http://demo.robustperception.io:9090/api/v1/read&amp;#39;
INFO[0000] Created TSDB in path &amp;#39;./local-tsdb&amp;#39;
INFO[0000] Using existing TSDB in path &amp;#39;./local-tsdb&amp;#39;
INFO[0000] Querying time from=2020-12-30T13:53:59Z to=2020-12-30T14:53:59Z with selector={job=&amp;#34;node&amp;#34;}
INFO[0001] Store TSDB blocks in &amp;#39;./local-tsdb&amp;#39;
INFO[0001] BLOCK ULID                  MIN TIME                       MAX TIME                       DURATION     NUM SAMPLES  NUM CHUNKS   NUM SERIES   SIZE
INFO[0001] 01ETT28D6B8948J87NZXY8VYD9  2020-12-30 13:53:59 &amp;#43;0000 UTC  2020-12-30 13:59:59 &amp;#43;0000 UTC  6m0.001s     15950        429          425          105KiB867B
INFO[0001] 01ETT28D91Z9SVRYF3DY0KNV41  2020-12-30 14:00:00 &amp;#43;0000 UTC  2020-12-30 14:53:58 &amp;#43;0000 UTC  53m58.001s   143530       1325         425          509KiB679B&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;local-tsdb-examples&#34;&gt;Local TSDB examples&lt;/h5&gt;
&lt;p&gt;The following command uses promtool to analyze file contents.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;promtool tsdb analyze ./local-tsdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following command dumps all values of the TSDB.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;promtool tsdb dump ./local-tsdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following command runs a local Prometheus with the local TSDB.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;prometheus --storage.tsdb.path ./local-tsdb --config.file=&amp;lt;(echo &amp;#34;&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;acl&#34;&gt;ACL&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;acl&lt;/code&gt; command generates the label-based access control header used in Grafana Enterprise Metrics and Grafana Cloud Metrics.&lt;/p&gt;
&lt;h4 id=&#34;generate-header&#34;&gt;Generate header&lt;/h4&gt;
&lt;p&gt;The following command enables you to generate a header that you can use to enforce access control rules in Grafana Enterprise Metrics or Grafana Cloud.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Grafana Mimir doesn&amp;rsquo;t support ACLs.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;


&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool acl generate-header --id=&amp;lt;tenant_id&amp;gt; --rule=&amp;lt;promql_selector&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;example-6&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool acl generate-header --id=1234 --rule=&amp;#39;{namespace=&amp;#34;A&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Example output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;The header to set:
X-Prom-Label-Policy: 1234:%7Bnamespace=%22A%22%7D&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;analyze&#34;&gt;Analyze&lt;/h3&gt;
&lt;p&gt;You can analyze your Grafana or Hosted Grafana instance to determine which metrics are used and exported. You can also extract metrics from dashboard JSON files and rules YAML files.&lt;/p&gt;
&lt;p&gt;Configuration options relevant to analyze commands:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--enable-experimental-functions&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enables parsing PromQL queries containing experimental functions.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h4 id=&#34;grafana&#34;&gt;Grafana&lt;/h4&gt;
&lt;p&gt;The following command runs against your Grafana instance, downloads its dashboards, and extracts the Prometheus
metrics used in its queries.
The output is a JSON file. You can use this file with &lt;code&gt;analyze prometheus --grafana-metrics-file&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool analyze grafana --address=&amp;lt;url&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;configuration-3&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;GRAFANA_ADDRESS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--address&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the address of the Grafana instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;GRAFANA_API_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--key&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the API Key for the Grafana instance. To create a key, refer to &lt;a href=&#34;/docs/grafana/latest/http_api/auth/&#34;&gt;Authentication API&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--output&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the output file path, which by default is &lt;code&gt;metrics-in-grafana.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--folder-title&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the folder filter to limit dashboards analysis for unused metrics based on their exact folder title. When repeated any of the matching folders will be analyzed.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-output-file&#34;&gt;Example output file&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;metricsUsed&amp;#34;: [
    &amp;#34;apiserver_request:availability30d&amp;#34;,
    &amp;#34;workqueue_depth&amp;#34;,
    &amp;#34;workqueue_queue_duration_seconds_bucket&amp;#34;
  ],
  &amp;#34;dashboards&amp;#34;: [
    {
      &amp;#34;slug&amp;#34;: &amp;#34;&amp;#34;,
      &amp;#34;uid&amp;#34;: &amp;#34;09ec8aa1e996d6ffcd6817bbaff4db1b&amp;#34;,
      &amp;#34;title&amp;#34;: &amp;#34;Kubernetes / API server&amp;#34;,
      &amp;#34;metrics&amp;#34;: [
        &amp;#34;apiserver_request:availability30d&amp;#34;,
        &amp;#34;apiserver_request_total&amp;#34;,
        &amp;#34;cluster_quantile:apiserver_request_duration_seconds:histogram_quantile&amp;#34;,
        &amp;#34;workqueue_depth&amp;#34;,
        &amp;#34;workqueue_queue_duration_seconds_bucket&amp;#34;
      ],
      &amp;#34;parse_errors&amp;#34;: [&amp;#34;unsupported panel type: \&amp;#34;news\&amp;#34;&amp;#34;]
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;ruler&#34;&gt;Ruler&lt;/h4&gt;
&lt;p&gt;The following command runs against your Grafana Mimir, Grafana Enterprise Metrics, or Grafana Cloud Prometheus instance. The command fetches the rule groups and extracts the Prometheus metrics used in the rule queries.
The output is a JSON file. You can use this file with &lt;code&gt;analyze prometheus --ruler-metrics-file&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool analyze ruler --address=&amp;lt;url&amp;gt; --id=&amp;lt;tenant_id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;configuration-4&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_ADDRESS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--address&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the address of the Prometheus instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TENANT_ID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the basic authentication username. If you&amp;rsquo;re using Grafana Cloud, this variable is your instance ID.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_API_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--key&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the basic authentication password. If you&amp;rsquo;re using Grafana Cloud, this variable is your API key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_AUTH_TOKEN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--auth-token&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the bearer or JWT token that is required for Mimir clusters authenticating with this method.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--output&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the output file path, which by default is &lt;code&gt;metrics-in-ruler.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-output-file-1&#34;&gt;Example output file&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;metricsUsed&amp;#34;: [
    &amp;#34;apiserver_request_duration_seconds_bucket&amp;#34;,
    &amp;#34;container_cpu_usage_seconds_total&amp;#34;,
    &amp;#34;scheduler_scheduling_algorithm_duration_seconds_bucket&amp;#34;
  ],
  &amp;#34;ruleGroups&amp;#34;: [
    {
      &amp;#34;namspace&amp;#34;: &amp;#34;prometheus_rules&amp;#34;,
      &amp;#34;name&amp;#34;: &amp;#34;kube-apiserver.rules&amp;#34;,
      &amp;#34;metrics&amp;#34;: [
        &amp;#34;apiserver_request_duration_seconds_bucket&amp;#34;,
        &amp;#34;apiserver_request_duration_seconds_count&amp;#34;,
        &amp;#34;apiserver_request_total&amp;#34;
      ],
      &amp;#34;parse_errors&amp;#34;: null
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;dashboard&#34;&gt;Dashboard&lt;/h4&gt;
&lt;p&gt;The following command accepts Grafana dashboard JSON files as input and extracts Prometheus metrics used in the queries.
The output is a JSON file.
You can use the output file with &lt;code&gt;analyze prometheus --grafana-metrics-file&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool analyze dashboard &amp;lt;file&amp;gt;...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;configuration-5&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--output&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the output file path, which by default is &lt;code&gt;metrics-in-grafana.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h4 id=&#34;rule-file&#34;&gt;Rule-file&lt;/h4&gt;
&lt;p&gt;The following command accepts Prometheus rule YAML files as input and extracts Prometheus metrics used in the queries.
The output is a JSON file. You can use the output file with &lt;code&gt;analyze prometheus --ruler-metrics-file&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool analyze rule-file &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;configuration-6&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--output&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the output file path, which by default is &lt;code&gt;metrics-in-ruler.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h4 id=&#34;prometheus&#34;&gt;Prometheus&lt;/h4&gt;
&lt;p&gt;The following command runs against your Grafana Mimir, Grafana Metrics Enterprise, Prometheus, or Cloud Prometheus instance.
The command uses the output from a previous run of &lt;code&gt;analyze grafana&lt;/code&gt;, &lt;code&gt;analyze dashboard&lt;/code&gt;, &lt;code&gt;analyze ruler&lt;/code&gt;
or &lt;code&gt;analyze rule-file&lt;/code&gt; to show the number of series in the Prometheus instance that are used in dashboards or rules, or both.
This command also shows which metrics exist in Grafana Cloud that are &lt;em&gt;not&lt;/em&gt; in dashboards or rules. The output is a JSON file.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The command makes a request for every active series in the Prometheus instance.
For Prometheus instances with a large number of active series, this command might take time to complete.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;


&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool analyze prometheus --address=&amp;lt;url&amp;gt; --id=&amp;lt;tenant_id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;configuration-7&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Environment variable&lt;/th&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_ADDRESS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--address&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the address of the Prometheus instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_TENANT_ID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the basic authentication username. If you&amp;rsquo;re using Grafana Cloud this variable is your instance ID, also set as tenant ID.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_API_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--key&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the basic authentication password. If you&amp;rsquo;re using Grafana Cloud, this variable is your API key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;MIMIR_AUTH_TOKEN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--auth-token&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the bearer or JWT token that is required for Mimir clusters authenticating with this method.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--grafana-metrics-file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;mimirtool analyze grafana&lt;/code&gt; or &lt;code&gt;mimirtool analyze dashboard&lt;/code&gt; output file, which by default is &lt;code&gt;metrics-in-grafana.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--ruler-metrics-file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;mimirtool analyze ruler&lt;/code&gt; or &lt;code&gt;mimirtool analyze rule-file&lt;/code&gt; output file, which by default is &lt;code&gt;metrics-in-ruler.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--output&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the output file path, which by default is &lt;code&gt;prometheus-metrics.json&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;-&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;--prometheus-http-prefix&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the HTTP URL path under which the Prometheus api will be served.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-output&#34;&gt;Example output&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;total_active_series&amp;#34;: 38184,
  &amp;#34;in_use_active_series&amp;#34;: 14047,
  &amp;#34;additional_active_series&amp;#34;: 24137,
  &amp;#34;in_use_metric_counts&amp;#34;: [
    {
      &amp;#34;metric&amp;#34;: &amp;#34;apiserver_request_duration_seconds_bucket&amp;#34;,
      &amp;#34;count&amp;#34;: 11400,
      &amp;#34;job_counts&amp;#34;: [
        {
          &amp;#34;job&amp;#34;: &amp;#34;apiserver&amp;#34;,
          &amp;#34;count&amp;#34;: 11400
        }
      ]
    },
    {
      &amp;#34;metric&amp;#34;: &amp;#34;apiserver_request_total&amp;#34;,
      &amp;#34;count&amp;#34;: 684,
      &amp;#34;job_counts&amp;#34;: [
        {
          &amp;#34;job&amp;#34;: &amp;#34;apiserver&amp;#34;,
          &amp;#34;count&amp;#34;: 684
        }
      ]
    }
  ],
  &amp;#34;additional_metric_counts&amp;#34;: [
    {
      &amp;#34;metric&amp;#34;: &amp;#34;etcd_request_duration_seconds_bucket&amp;#34;,
      &amp;#34;count&amp;#34;: 2688,
      &amp;#34;job_counts&amp;#34;: [
        {
          &amp;#34;job&amp;#34;: &amp;#34;apiserver&amp;#34;,
          &amp;#34;count&amp;#34;: 2688
        }
      ]
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;bucket-validation&#34;&gt;Bucket validation&lt;/h3&gt;
&lt;p&gt;The following command validates that the object store bucket works correctly.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool bucket-validation&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--object-count&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the number of objects to create and delete. By default, the value is 2000.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--report-every&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the number operations afterwhich an operations progress report is printed. By default, the value is 100.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--test-runs&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the number of times to run the test. By default, the value is 1.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--prefix&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the path prefix to use for test objects in the object store.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--retries-on-error&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the number of times to retry if the object store returns an error.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--bucket-config&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the CLI arguments to configure a storage bucket.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--bucket-config-help&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Displays help text that explains how to use the -bucket-config parameter.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;config&#34;&gt;Config&lt;/h3&gt;
&lt;h4 id=&#34;convert&#34;&gt;Convert&lt;/h4&gt;
&lt;p&gt;The config convert command converts configuration parameters that work with Cortex v1.10.0 and above to parameters that work with Grafana Mimir v2.0.0.
It supports converting both CLI flags and &lt;a href=&#34;../../../configure/configuration-parameters/&#34;&gt;YAML configuration files&lt;/a&gt;.&lt;/p&gt;
&lt;h5 id=&#34;configuration-8&#34;&gt;Configuration&lt;/h5&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--yaml-file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The YAML configuration file to convert.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--flags-file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A file containing a newline-delimited list of CLI flags to convert.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--yaml-out&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File to use for the converted YAML configuration. If not set, output to &lt;code&gt;stdout&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--flags-out&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File to use for list of converted CLI flags. If not set, output to &lt;code&gt;stdout&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--update-defaults&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If you set this flag and you set a configuration parameter to a default value that has changed in Mimir 2.0, the parameter updates to the new default value.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--include-defaults&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If you set this flag, all default values are included in the output YAML, regardless of whether you explicitly set the values in the input files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;-v&lt;/code&gt;, &lt;code&gt;--verbose&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If you set this flag, the CLI flags and YAML paths from the old configuration that do not exist in the new configuration are printed to &lt;code&gt;stderr&lt;/code&gt;. This flag also prints default values that have changed between the old and the new configuration.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;--gem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If you set this flag, the tool will convert from Grafana Metrics Enterprise (GEM) v1.7.x to v2.0.0.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;changes-to-default-values&#34;&gt;Changes to default values&lt;/h5&gt;
&lt;p&gt;&lt;code&gt;mimirtool config convert&lt;/code&gt; helps you migrate from Cortex to Grafana Mimir. There are changes to the default values of
some configuration parameters in Mimir v2.0.0 that you might not want to use as part of this migration:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Parameter&lt;/th&gt;
              &lt;th&gt;Cortex/GEM 1.7 default&lt;/th&gt;
              &lt;th&gt;Mimir/GEM 2.0 default&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;blocks_storage.backend&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;s3&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;filesystem&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ruler_storage.backend&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;s3&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;filesystem&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;alertmanager_storage.backend&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;s3&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;filesystem&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server.http_listen_port&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;80&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;8080&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;activity_tracker.filepath&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;./active-query-tracker&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;./metrics-activity.log&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;alertmanager.data_dir&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;data/&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;./data-alertmanager/&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;blocks_storage.filesystem.dir&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;lt;empty&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;blocks&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;compactor.data_dir&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;./data&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;./data-compactor/&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ruler.rule_path&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;/rules&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;./data-ruler/&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ruler_storage.filesystem.dir&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;lt;empty&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;ruler&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;(GEM only) &lt;code&gt;auth.type&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;trust&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;enterprise&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;(GEM only) &lt;code&gt;graphite.querier.schemas.backend&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;s3&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;filesystem&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;For these parameters &lt;code&gt;mimirtool config convert&lt;/code&gt; will output the Cortex default value even when the configuration parameter is not explicitly set in the input
configuration. If in the input configuration you explicitly set the Cortex default value, and you have provided
the &lt;code&gt;--update-defaults&lt;/code&gt; flag, &lt;code&gt;mimirtool config convert&lt;/code&gt; will not update the value to the Mimir default.&lt;/p&gt;
&lt;h5 id=&#34;example-7&#34;&gt;Example&lt;/h5&gt;
&lt;p&gt;The following example shows a command that converts Cortex &lt;a href=&#34;../../../references/architecture/components/query-frontend/&#34;&gt;query-frontend&lt;/a&gt; YAML configuration file and CLI flag to a Mimir-compatible YAML and CLI flag.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool config convert --yaml-file=cortex.yaml --flags-file=cortex.flags --yaml-out=mimir.yaml --flags-out=mimir.flags&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;cortex.yaml&lt;/code&gt; input file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;query_range:
  results_cache:
    cache:
      memcached:
        expiration: 10s # Expiration was removed in Grafana Mimir, so this parameter will be missing from the output YAML
        batch_size: 2048
        parallelism: 10
      memcached_client:
        max_idle_conns: 32&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;cortex.flags&lt;/code&gt; input file:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;-frontend.background.write-back-concurrency=45&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;After you run the command, the converted output should be:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mimir.yaml&lt;/code&gt; converted output file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;frontend:
  results_cache:
    memcached:
      max_get_multi_batch_size: 2048
      max_get_multi_concurrency: 10
      max_idle_connections: 32

server:
  http_listen_port: 80&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;As a precaution,the output file includes &lt;code&gt;server.http_listen_port&lt;/code&gt;.
The default value in Grafana Mimir changed from 80 to 8080.&lt;/p&gt;
&lt;p&gt;Unless you explicitly set the port in the input configuration, the tool outputs the original default value.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;mimir.flags&lt;/code&gt; converted output file:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;-query-frontend.results-cache.memcached.max-async-concurrency=45&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h5 id=&#34;verbose-output&#34;&gt;Verbose output&lt;/h5&gt;
&lt;p&gt;When you set the &lt;code&gt;--verbose&lt;/code&gt; flag, the output explains which configuration parameters were removed and which default values were changed.
The verbose output is printed to &lt;code&gt;stderr&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The output includes the following entries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;field is no longer supported: &amp;lt;yaml_path&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This parameter was used in the input Cortex YAML file and removed from the output configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;flag is no longer supported: &amp;lt;flag_name&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This parameter was used in the input Cortex CLI flags file, but the parameter was removed in Grafana Mimir. The tool removed this CLI flag from the output configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;using a new default for &amp;lt;yaml_path&amp;gt;: &amp;lt;new_value&amp;gt; (used to be &amp;lt;old_value&amp;gt;)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The default value for a configuration parameter changed in Grafana Mimir. This parameter was not explicitly set in the input configuration files.
When you run Grafana Mimir with the output configuration from &lt;code&gt;mimirtool config convert&lt;/code&gt; Grafana Mimir uses the new default.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;default value for &amp;lt;yaml_path&amp;gt; changed: &amp;lt;new_value&amp;gt; (used to be &amp;lt;old_value&amp;gt;); not updating&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The default value for a configuration parameter that was set in the input configuration file has changed in Grafana Mimir.
The tool has not converted the old default value to the new default value. To automatically update the default value to the new default value, pass the &lt;code&gt;--update-defaults&lt;/code&gt; flag.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&#34;extracting-flags-from-jsonnet&#34;&gt;Extracting flags from Jsonnet&lt;/h5&gt;
&lt;p&gt;When using the Grafana Mimir Jsonnet library, all configuration uses flags set as object member key-value pairs.
To perform conversion with mimirtool, you first need to extract the flags from the JSON manifested from the Jsonnet evaluation.&lt;/p&gt;
&lt;p&gt;Use the following bash script to extract the arguments from a specific component:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt; #!/usr/bin/env bash

 set -euf -o pipefail

 function usage {
   cat &amp;lt;&amp;lt;EOF
 Extract the CLI flags from individual components.

 Usage:
   $0 &amp;lt;resources JSON&amp;gt; &amp;lt;component&amp;gt;

 Examples:
   $0 resources.json ingester
   $0 &amp;lt;(tk eval environments/default) distributor
   $0 &amp;lt;(jsonnet environments/default/main.jsonnet) query-frontend
 EOF
 }

 if ! command -v jq &amp;amp;&amp;gt;/dev/null; then
   echo &amp;#34;jq command not found in PATH&amp;#34;
   echo &amp;#34;To download jq, refer to https://stedolan.github.io/jq/download/.&amp;#34;
 fi

 if [[ $# -ne 2 ]]; then
   usage
   exit 1
 fi

 jq -rf /dev/stdin -- &amp;#34;$1&amp;#34; &amp;lt;&amp;lt;EOF
 ..
 | if type == &amp;#34;object&amp;#34; and .metadata.name == &amp;#34;$2&amp;#34; then .spec.template.spec.containers[]?.args[] else null end
 | select(. != null)
 EOF&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The first parameter of the script is a JSON file containing Kubernetes resources.
The second parameter of the script is the name of a container.&lt;/p&gt;
&lt;p&gt;To retrieve the arguments from the distributor for a Tanka environment:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;&amp;lt;PATH TO SCRIPT&amp;gt; &amp;lt;(tk eval environments/default) distributor&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The script outputs results that are similar to the following:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;-consul.hostname=consul.cortex-to-mimir.svc.cluster.local:8500
-distributor.ha-tracker.enable=false
-distributor.ha-tracker.enable-for-all-users=true
-distributor.ha-tracker.etcd.endpoints=etcd-client.cortex-to-mimir.svc.cluster.local.:2379
-distributor.ha-tracker.prefix=prom_ha/
-distributor.ha-tracker.store=etcd
-distributor.health-check-ingesters=true
-distributor.ingestion-burst-size=200000
-distributor.ingestion-rate-limit=10000
-distributor.ingestion-rate-limit-strategy=global
-distributor.remote-timeout=20s
-distributor.replication-factor=3
-distributor.ring.consul.hostname=consul.cortex-to-mimir.svc.cluster.local:8500
-distributor.ring.prefix=
-distributor.shard-by-all-labels=true
-mem-ballast-size-bytes=1073741824
-ring.heartbeat-timeout=10m
-ring.prefix=
-runtime-config.file=/etc/cortex/overrides.yaml
-server.grpc.keepalive.max-connection-age=2m
-server.grpc.keepalive.max-connection-age-grace=5m
-server.grpc.keepalive.max-connection-idle=1m
-server.grpc.keepalive.min-time-between-pings=10s
-server.grpc.keepalive.ping-without-stream-allowed=true
-target=distributor
-validation.reject-old-samples=true
-validation.reject-old-samples.max-age=12h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Use the output of the script as input to run the &lt;code&gt;mimirtool&lt;/code&gt; configuration conversion.&lt;/p&gt;
&lt;p&gt;After conversion, you can use the following script to transform the converted flags back into JSON:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;#!/usr/bin/env bash

set -euf -o pipefail

function usage {
 cat &amp;lt;&amp;lt;EOF
Transform Go flags into JSON key value pairs

Usage:
 $0 &amp;lt;flags file&amp;gt;

Examples:
 $0 flags.flags
EOF
}

if [[ $# -ne 1 ]]; then
 usage
 exit 1
fi

key_values=$(sed -E -e &amp;#39;s/^-*(.*)=(.*)$/  &amp;#34;\1&amp;#34;: &amp;#34;\2&amp;#34;,/&amp;#39; &amp;#34;$1&amp;#34;)
printf &amp;#34;{\n%s\n}&amp;#34; &amp;#34;${key_values::-1}&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The only parameter of the script is a file containing the flags, with each flag on its own line.&lt;/p&gt;
&lt;h3 id=&#34;backfill&#34;&gt;Backfill&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;backfill&lt;/code&gt; command uploads Prometheus TSDB blocks into Grafana Mimir, by using the &lt;a href=&#34;../../../references/http-api/#compactor&#34;&gt;block-upload API that is exposed by the compactor component&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If the command is interrupted, you can restart it. Mimirtool detects which blocks are already uploaded, and will only upload unfinished or new blocks.&lt;/p&gt;
&lt;p&gt;The block-upload feature is disabled by default.
To enable the block-upload feature for a user or an entire system, refer to &lt;a href=&#34;../../../configure/configure-tsdb-block-upload/&#34;&gt;Configure TSDB block upload&lt;/a&gt;.
If block upload is not enabled for the user, &lt;code&gt;mimirtool backfill&lt;/code&gt; will fail.&lt;/p&gt;
&lt;h5 id=&#34;example-8&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool backfill --address=http://mimir-compactor/ --id=anonymous /var/prometheus/{01G803NFXZ0MVKN71GT91HMV3Z,01G8BQ8PRR4TAP7EXZVBNTRBZ4,01G8CB7GTTC5ZXY23WTXHSYQXQ}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The results of the &lt;code&gt;backfill&lt;/code&gt; command are as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;INFO[0000] Backfilling                              blocks=&amp;#34;/var/prometheus/01G803NFXZ0MVKN71GT91HMV3Z,/var/prometheus/01G8BQ8PRR4TAP7EXZVBNTRBZ4,/var/prometheus/01G8CB7GTTC5ZXY23WTXHSYQXQ&amp;#34; user=anonymous
INFO[0000] making request to start block upload     block=01G803NFXZ0MVKN71GT91HMV3Z file=meta.json path=/var/prometheus/01G803NFXZ0MVKN71GT91HMV3Z
WARN[0000] block already exists on the server       path=/var/prometheus/01G803NFXZ0MVKN71GT91HMV3Z
INFO[0000] making request to start block upload     block=01G8BQ8PRR4TAP7EXZVBNTRBZ4 file=meta.json path=/var/prometheus/01G8BQ8PRR4TAP7EXZVBNTRBZ4
INFO[0000] uploading block file                     block=01G8BQ8PRR4TAP7EXZVBNTRBZ4 file=index path=/var/prometheus/01G8BQ8PRR4TAP7EXZVBNTRBZ4 size=259867
INFO[0000] uploading block file                     block=01G8BQ8PRR4TAP7EXZVBNTRBZ4 file=chunks/000001 path=/var/prometheus/01G8BQ8PRR4TAP7EXZVBNTRBZ4 size=5024391
INFO[0000] block uploaded successfully              block=01G8BQ8PRR4TAP7EXZVBNTRBZ4 path=/var/prometheus/01G8BQ8PRR4TAP7EXZVBNTRBZ4
INFO[0000] making request to start block upload     block=01G8CB7GTTC5ZXY23WTXHSYQXQ file=meta.json path=/var/prometheus/01G8CB7GTTC5ZXY23WTXHSYQXQ
INFO[0000] uploading block file                     block=01G8CB7GTTC5ZXY23WTXHSYQXQ file=index path=/var/prometheus/01G8CB7GTTC5ZXY23WTXHSYQXQ size=151181
INFO[0000] uploading block file                     block=01G8CB7GTTC5ZXY23WTXHSYQXQ file=chunks/000001 path=/var/prometheus/01G8CB7GTTC5ZXY23WTXHSYQXQ size=1986792
INFO[0000] block uploaded successfully              block=01G8CB7GTTC5ZXY23WTXHSYQXQ path=/var/prometheus/01G8CB7GTTC5ZXY23WTXHSYQXQ
INFO[0001] finished uploading blocks                already_exists=1 failed=0 succeeded=2&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Backfilled data visibility depends on the sample timestamps in the uploaded blocks. Sometimes data can appear more than 12 hours after upload.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;partition-ring&#34;&gt;Partition ring&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;partition-ring&lt;/code&gt; command provides subcommands for forcefully modifying the ingest storage partition ring via memberlist. These commands are intended for emergency use only and bypass normal ingester lifecycle management.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;These are dangerous operations &lt;strong&gt;not intended for production systems&lt;/strong&gt;. Modifying the partition ring directly can cause data loss or query failures if used incorrectly.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;All &lt;code&gt;partition-ring&lt;/code&gt; subcommands require joining the memberlist cluster of the Grafana Mimir deployment. The tool must be able to reach at least one memberlist node via TCP and UDP.&lt;/p&gt;
&lt;p&gt;For further information on how to run commands within a cell see &lt;a href=&#34;https://github.com/grafana/deployment_tools/blob/master/docs/cortex/distroless-images.md#debugging-distroless-containers-in-kubernetes&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Debugging distroless containers in Kubernetes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;An example of running &lt;code&gt;mimirtool&lt;/code&gt; from within a debug container attached to a cell pod is as follows;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Attach a debug container to an existing pod and shell into it
kubectl -n &amp;lt;namespace&amp;gt; debug -it pod/&amp;lt;pod&amp;gt; --image=alpine:latest --target=ingester -c debug-container -ti -- sh

# Copy over the `mimirtool` binary (make sure you have it compiled for the correct architecture)
kubectl -n &amp;lt;namespace&amp;gt; cp ./mimirtool &amp;lt;pod&amp;gt;:/tmp/mimirtool -c debug-container

# Find an ingester IP address and memberlist cluster label
kubectl -n &amp;lt;namespace&amp;gt; get pods ingester-zone-a-0 -o yaml | grep podIP
kubectl -n &amp;lt;namespace&amp;gt; get pods ingester-zone-a-0 -o yaml | grep memberlist.cluster

# Run mimirtool (in the shell from the first step)
cd /tmp
chmod u&amp;#43;x mimirtool
./mimirtool partition-ring remove-owner --owner.id=ingester-zone-c-40 --memberlist.join=&amp;lt;ingester-ip&amp;gt;:7946 --memberlist.cluster-label=&amp;lt;memberlist-cluster-label&amp;gt; --memberlist.bind-port=0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href=&#34;https://github.com/grafana/deployment_tools/blob/master/docs/cortex/distroless-images.md#cleanup-and-limitations&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Cleanup and Limitations&lt;/a&gt; after finishing with the debug container.&lt;/p&gt;
&lt;h4 id=&#34;add-partition&#34;&gt;&lt;code&gt;add-partition&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Forcefully adds one or more partitions to the partition ring.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Flag&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--partition.id&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Comma-separated list of partition IDs to add (must be &amp;gt;= 0).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--partition.state&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. State for the new partition(s). Must be one of: &lt;code&gt;pending&lt;/code&gt;, &lt;code&gt;active&lt;/code&gt;, &lt;code&gt;inactive&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.join&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Address of a memberlist node to join. Can be specified multiple times.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.cluster-label&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The cluster label to use when joining the memberlist cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.bind-port&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Port to listen on for memberlist gossip messages. Default: &lt;code&gt;7946&lt;/code&gt;. Use &lt;code&gt;0&lt;/code&gt; to pick a random available port.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--verbose&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Enable verbose logging.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-9&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool partition-ring add-partition \
  --partition.id=39 \
  --partition.state=active \
  --memberlist.join=&amp;lt;ingester-pod-ip&amp;gt;:7946 \
  --memberlist.cluster-label=&amp;lt;cluster&amp;gt;.&amp;lt;namespace&amp;gt; \
  --memberlist.bind-port=0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;remove-partition&#34;&gt;&lt;code&gt;remove-partition&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Forcefully removes one or more partitions from the partition ring. A partition cannot be removed if it still has owners; use &lt;code&gt;remove-owner&lt;/code&gt; first.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Flag&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--partition.id&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Comma-separated list of partition IDs to remove (must be &amp;gt;= 0).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.join&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Address of a memberlist node to join. Can be specified multiple times.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.cluster-label&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The cluster label to use when joining the memberlist cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.bind-port&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Port to listen on for memberlist gossip messages. Default: &lt;code&gt;7946&lt;/code&gt;. Use &lt;code&gt;0&lt;/code&gt; to pick a random available port.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--verbose&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Enable verbose logging.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-10&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool partition-ring remove-partition \
  --partition.id=39 \
  --memberlist.join=&amp;lt;ingester-pod-ip&amp;gt;:7946 \
  --memberlist.cluster-label=&amp;lt;cluster&amp;gt;.&amp;lt;namespace&amp;gt; \
  --memberlist.bind-port=0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;add-owner&#34;&gt;&lt;code&gt;add-owner&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Forcefully adds one or more owners (ingester instances) to the partition ring, associating them with the specified partition.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Flag&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--owner.id&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Comma-separated list of owner IDs (ingester instance names) to add.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--partition.id&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. The partition ID that the owner(s) will own (must be &amp;gt;= 0). Exactly one ID may be specified.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.join&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Address of a memberlist node to join. Can be specified multiple times.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.cluster-label&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The cluster label to use when joining the memberlist cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.bind-port&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Port to listen on for memberlist gossip messages. Default: &lt;code&gt;7946&lt;/code&gt;. Use &lt;code&gt;0&lt;/code&gt; to pick a random available port.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--verbose&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Enable verbose logging.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-11&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool partition-ring add-owner \
  --owner.id=ingester-zone-a-0 \
  --partition.id=0 \
  --memberlist.join=&amp;lt;ingester-pod-ip&amp;gt;:7946 \
  --memberlist.cluster-label=&amp;lt;cluster&amp;gt;.&amp;lt;namespace&amp;gt; \
  --memberlist.bind-port=0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;remove-owner&#34;&gt;&lt;code&gt;remove-owner&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;Forcefully removes one or more owners (ingester instances) from the partition ring. This is useful for cleaning up stale owner entries left behind when an ingester is removed without going through a normal shutdown.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Flag&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--owner.id&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Comma-separated list of owner IDs (ingester instance names) to remove.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.join&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Required. Address of a memberlist node to join. Can be specified multiple times.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.cluster-label&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The cluster label to use when joining the memberlist cluster.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--memberlist.bind-port&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Port to listen on for memberlist gossip messages. Default: &lt;code&gt;7946&lt;/code&gt;. Use &lt;code&gt;0&lt;/code&gt; to pick a random available port.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;--verbose&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;Enable verbose logging.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h5 id=&#34;example-12&#34;&gt;Example&lt;/h5&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool partition-ring remove-owner \
  --owner.id=ingester-zone-c-38 \
  --memberlist.join=&amp;lt;ingester-pod-ip&amp;gt;:7946 \
  --memberlist.cluster-label=&amp;lt;cluster&amp;gt;.&amp;lt;namespace&amp;gt; \
  --memberlist.bind-port=0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To remove multiple owners in one operation, pass a comma-separated list:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;mimirtool partition-ring remove-owner \
  --owner.id=ingester-zone-c-38,ingester-zone-c-39,ingester-zone-c-40 \
  --memberlist.join=&amp;lt;ingester-pod-ip&amp;gt;:7946 \
  --memberlist.cluster-label=&amp;lt;cluster&amp;gt;.&amp;lt;namespace&amp;gt; \
  --memberlist.bind-port=0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;license&#34;&gt;License&lt;/h2&gt;
&lt;p&gt;This software is licensed as AGPLv3. For more information, see &lt;a href=&#34;https://github.com/grafana/mimir/blob/main/LICENSE&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;LICENSE&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="grafana-mimirtool">Grafana Mimirtool&lt;/h1>
&lt;p>Mimirtool is a command-line tool that operators and tenants can use to execute a number of common tasks that involve Grafana Mimir or Grafana Cloud Metrics.&lt;/p></description></item><item><title>Grafana Markblocks</title><link>https://grafana.com/docs/mimir/v3.1.x/manage/tools/markblocks/</link><pubDate>Wed, 03 Jun 2026 09:01:40 +0200</pubDate><guid>https://grafana.com/docs/mimir/v3.1.x/manage/tools/markblocks/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-markblocks&#34;&gt;Grafana Markblocks&lt;/h1&gt;
&lt;p&gt;You can use the markblocks tool in Grafana Mimir to manage the state of time series data blocks in object storage.&lt;/p&gt;
&lt;p&gt;Use markblocks for the following purposes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mark blocks for non-compaction. This is useful for corrupted blocks, preventing them from being processed by the compactor and potentially causing issues. Newer Mimir versions might automatically mark corrupted blocks.&lt;/li&gt;
&lt;li&gt;Mark blocks for deletion. Use the tool to explicitly mark specific blocks for deletion from the object storage.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The markblocks tool helps to maintain data integrity and to manage storage effectively, especially in scenarios involving data corruption or manual cleanup.&lt;/p&gt;
&lt;h2 id=&#34;download-markblocks&#34;&gt;Download markblocks&lt;/h2&gt;
&lt;p&gt;Download markblocks as part of the Mimir binary. To download the binary, refer to &lt;a href=&#34;https://github.com/grafana/mimir/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Mimir releases&lt;/a&gt; on GitHub.&lt;/p&gt;
&lt;h2 id=&#34;use-markblocks&#34;&gt;Use markblocks&lt;/h2&gt;
&lt;p&gt;To use markblocks, you need to specify the tenant ID, bucket configuration, and block IDs you&amp;rsquo;d like to mark. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Mark a block for non-compaction (example for a corrupted block)
mimir markblocks --tenant-id=&amp;lt;your-tenant-id&amp;gt; --blocks-storage.backend=s3 --blocks-storage.s3.bucket-name=&amp;lt;your-bucket&amp;gt; --blocks-storage.s3.endpoint=&amp;lt;your-s3-endpoint&amp;gt; --mark-no-compact=&amp;lt;block-id&amp;gt;

# Mark a block for deletion
mimir markblocks --tenant-id=&amp;lt;your-tenant-id&amp;gt; --blocks-storage.backend=s3 --blocks-storage.s3.bucket-name=&amp;lt;your-bucket&amp;gt; --blocks-storage.s3.endpoint=&amp;lt;your-s3-endpoint&amp;gt; --mark-for-deletion=&amp;lt;block-id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Use caution when using markblocks, as it affects data management within your Mimir storage.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="grafana-markblocks">Grafana Markblocks&lt;/h1>
&lt;p>You can use the markblocks tool in Grafana Mimir to manage the state of time series data blocks in object storage.&lt;/p>
&lt;p>Use markblocks for the following purposes:&lt;/p></description></item></channel></rss>