<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Work with your resources on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/</link><description>Recent content in Work with your resources on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/index.xml" rel="self" type="application/rss+xml"/><item><title>Resource management workflows</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-resources/</link><pubDate>Fri, 20 Nov 2026 10:19:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-resources/</guid><content><![CDATA[&lt;h1 id=&#34;resource-management-workflows-with-gcx&#34;&gt;Resource management workflows with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; allows you to interact with Grafana resources directly from your terminal. You can browse, inspect, update, and delete resources without using the Grafana UI, and move them between environments as files.&lt;/p&gt;
&lt;p&gt;Use this approach if you&amp;rsquo;re an advanced user and want to manage resources more efficiently, or to integrate Grafana operations into automated workflows.&lt;/p&gt;
&lt;h2 id=&#34;available-commands&#34;&gt;Available commands&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;gcx resources&lt;/code&gt; command group includes the following 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;Command&lt;/th&gt;
              &lt;th&gt;Use it to&lt;/th&gt;
              &lt;th&gt;Refer to&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources list-types&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List the resource types your Grafana instance serves&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#discover-resource-types&#34;&gt;Discover resource types&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources list-examples&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Show example manifests for provider-backed resource types&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#discover-resource-types&#34;&gt;Discover resource types&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources search&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Find resources by relevance to a phrase (experimental)&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#search-resources-by-relevance&#34;&gt;Search resources by relevance&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources get&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Fetch resources from Grafana and display them&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#find-and-delete-dashboards-using-incorrect-data-sources&#34;&gt;Find and delete dashboards using incorrect data sources&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources delete&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Delete resources by selector or from local files&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#find-and-delete-dashboards-using-incorrect-data-sources&#34;&gt;Find and delete dashboards using incorrect data sources&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources edit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Edit a remote resource in your default editor&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#edit-remote-resources&#34;&gt;Edit remote resources&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources validate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Check local files against a Grafana instance without writing them&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#validate-and-preview-changes&#34;&gt;Validate and preview changes&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources pull&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Save resources from Grafana to local files&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#migrate-resources-between-environments&#34;&gt;Migrate resources between environments&lt;/a&gt;, &lt;a href=&#34;#back-up-and-restore-resources&#34;&gt;Back up and restore resources&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gcx resources push&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Create or update resources in Grafana from local files&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#validate-and-preview-changes&#34;&gt;Validate and preview changes&lt;/a&gt;, &lt;a href=&#34;#migrate-resources-between-environments&#34;&gt;Migrate resources between environments&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;For every flag of each command, refer to the &lt;a href=&#34;../../cli-reference/#gcx-resources&#34;&gt;CLI reference&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;discover-resource-types&#34;&gt;Discover resource types&lt;/h2&gt;
&lt;p&gt;To list the resource types that your Grafana instance serves, including provider-backed types such as SLOs and Synthetic Monitoring checks, run:&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;shell&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-shell&#34;&gt;gcx resources list-types&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command requires a connection to Grafana. It also fetches each type&amp;rsquo;s schema, so add &lt;code&gt;--no-schema&lt;/code&gt; for faster results. Pass a selector to filter the list, and use &lt;code&gt;-o wide&lt;/code&gt;, &lt;code&gt;-o json&lt;/code&gt;, or &lt;code&gt;-o yaml&lt;/code&gt; for more detail:&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;shell&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-shell&#34;&gt;gcx resources list-types incidents -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To write a manifest from scratch, start from an example. Without arguments, &lt;code&gt;list-examples&lt;/code&gt; lists every resource type that has an example. Pass a selector to show the examples for that type:&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;shell&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-shell&#34;&gt;gcx resources list-examples
gcx resources list-examples slo -o yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;search-resources-by-relevance&#34;&gt;Search resources by relevance&lt;/h2&gt;
&lt;p&gt;Use the experimental &lt;code&gt;gcx resources search&lt;/code&gt; command to find ranked matches from a phrase:&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;shell&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-shell&#34;&gt;gcx resources search &amp;#34;kubernetes memory problems&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Search returns top matches, without pagination or an exhaustive resource inventory. Scores rank matches in the response.&lt;/p&gt;
&lt;h3 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h3&gt;
&lt;p&gt;You need to enable the Grafana global hybrid search endpoint to use &lt;code&gt;gcx resources search&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On supported Grafana Cloud stacks, &lt;code&gt;gcx resources search&lt;/code&gt; can combine text and semantic matching.&lt;/li&gt;
&lt;li&gt;On self-managed deployments with the endpoint, only use text matching. Semantic matching isn&amp;rsquo;t available on-premises.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your deployment must have default resource types, or you must select types with &lt;code&gt;--resource&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;search-for-specific-resources&#34;&gt;Search for specific resources&lt;/h3&gt;
&lt;p&gt;Select resource types and exact folder UIDs for a narrower search:&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;shell&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-shell&#34;&gt;gcx resources search &amp;#34;memory&amp;#34; \
  --resource dashboards.dashboard.grafana.app \
  --resource folders.folder.grafana.app \
  --folder team-platform \
  --limit 10
gcx resources search &amp;#34;memory&amp;#34; --folder general&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Repeat &lt;code&gt;--resource&lt;/code&gt; to search your selected types instead of the server defaults.&lt;/p&gt;
&lt;p&gt;Repeat &lt;code&gt;--folder&lt;/code&gt; to match any listed folder UID. Folders match exactly, without descendants; &lt;code&gt;general&lt;/code&gt; or &lt;code&gt;--folder &#39;&#39;&lt;/code&gt; selects the root folder. The default limit is 50, and the maximum is 200.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;-o wide&lt;/code&gt; to see matching text, or &lt;code&gt;-o json&lt;/code&gt; or &lt;code&gt;-o yaml&lt;/code&gt; for the full response:&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;shell&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-shell&#34;&gt;gcx resources search &amp;#34;memory&amp;#34; -o wide
gcx resources search &amp;#34;memory&amp;#34; -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;find-and-delete-dashboards-using-incorrect-data-sources&#34;&gt;Find and delete dashboards using incorrect data sources&lt;/h2&gt;
&lt;p&gt;To identify and remove production dashboards relying on non-production data sources, use the command below to list dashboard UIDs along with the data source UIDs used in their panels:&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;shell&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-shell&#34;&gt;gcx resources get dashboards --context prod | jq &amp;#39;.items | map({ uid: .metadata.name, datasources: .spec.panels | map(.datasource.uid)  })&amp;#39;
[
   {
      &amp;#34;uid&amp;#34;: &amp;#34;important-production-dashboard&amp;#34;,
      &amp;#34;datasources&amp;#34;: [
         &amp;#34;mimir-prod&amp;#34;
      ]
   },
   {
      &amp;#34;uid&amp;#34;: &amp;#34;test-dashboard-from-dev&amp;#34;,
      &amp;#34;datasources&amp;#34;: [
         &amp;#34;mimir-dev&amp;#34;
      ]
   },
   {
      &amp;#34;uid&amp;#34;: &amp;#34;test-dashboard-from-stg&amp;#34;,
      &amp;#34;datasources&amp;#34;: [
         &amp;#34;mimir-stg&amp;#34;
      ]
   }
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, identify the dashboards that are using unexpected data sources, and delete them:&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;shell&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-shell&#34;&gt;gcx resources delete dashboards/test-dashboard-from-stg,test-dashboard-from-dev
✔ 2 resources deleted, 0 errors&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;edit-remote-resources&#34;&gt;Edit remote resources&lt;/h2&gt;
&lt;p&gt;You can edit resources directly from the default editor, without having to pull them first. To do so, run:&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;shell&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-shell&#34;&gt;gcx resources edit dashboard/edit-me-please&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command opens the default editor set in the &lt;code&gt;EDITOR&lt;/code&gt; environment variable, or falls back to &amp;lsquo;vi&amp;rsquo; for Linux and &amp;rsquo;notepad&amp;rsquo; for Windows.&lt;/p&gt;
&lt;p&gt;After the editor process terminates, the resource is updated in the Grafana instance targeted by the current context. Edition is cancelled if no changes are written to the file, or if the file after edition is empty.&lt;/p&gt;
&lt;h2 id=&#34;validate-and-preview-changes&#34;&gt;Validate and preview changes&lt;/h2&gt;
&lt;p&gt;Before you push local files, check them against the target Grafana instance. &lt;code&gt;gcx resources validate&lt;/code&gt; reads resources from disk and asks Grafana to validate each one, without creating or updating anything:&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;shell&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-shell&#34;&gt;gcx resources validate --path ./resources
gcx resources validate dashboards folders -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To preview the outcome of a push, add &lt;code&gt;--dry-run&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;shell&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-shell&#34;&gt;gcx resources push --path ./resources --dry-run&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Both commands use server-side dry-run. Resources that aren&amp;rsquo;t known to support server-side dry-run aren&amp;rsquo;t sent, and the summary reports them as skipped instead of verified. If you know a resource honors server-side dry-run, add it with &lt;code&gt;--assume-server-dry-run&lt;/code&gt;, for example &lt;code&gt;--assume-server-dry-run alertrules.rules.alerting.grafana.app&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;migrate-resources-between-environments&#34;&gt;Migrate resources between environments&lt;/h2&gt;
&lt;p&gt;Grafana resources can be migrated from one environment to another, for example from a development to production environment.&lt;/p&gt;
&lt;p&gt;You need to &lt;a href=&#34;../../configuration#define-contexts-to-use-different-instances&#34;&gt;configure one context per environment&lt;/a&gt;. In this example scenario, use &lt;code&gt;dev&lt;/code&gt; for the development environment and &lt;code&gt;prod&lt;/code&gt; for production.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make changes to dashboards and other resources using the Grafana UI in your &lt;strong&gt;development instance&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pull those resources from the development environment to your local machine:

&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;shell&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-shell&#34;&gt;gcx resources pull --context dev # Add `-o yaml` export resources as YAML &lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Push the resources to production:

&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;shell&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-shell&#34;&gt;gcx resources push --context prod&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&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;Resources are pulled and pushed from the &lt;code&gt;./resources&lt;/code&gt; directory by default.
Configure this path with the &lt;code&gt;--path&lt;/code&gt;/&lt;code&gt;-p&lt;/code&gt; flags.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;name-pulled-files-by-title&#34;&gt;Name pulled files by title&lt;/h2&gt;
&lt;p&gt;By default, &lt;code&gt;gcx resources pull&lt;/code&gt; names each file after the resource&amp;rsquo;s &lt;code&gt;metadata.name&lt;/code&gt;, which is usually a generated UID such as &lt;code&gt;adkg9x2&lt;/code&gt;. These names are hard to recognize when you browse a directory or review a Git diff.&lt;/p&gt;
&lt;p&gt;To name files after the resource title instead, add &lt;code&gt;--filename-by=title&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;shell&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-shell&#34;&gt;gcx resources pull dashboards --filename-by=title --path ./dashboard-backup&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For example, a dashboard titled &lt;code&gt;Ventas Overview&lt;/code&gt; is saved as &lt;code&gt;ventas-overview.json&lt;/code&gt; instead of &lt;code&gt;adkg9x2.json&lt;/code&gt;. Only the filename changes: the file still contains the original &lt;code&gt;metadata.name&lt;/code&gt;, so &lt;code&gt;push&lt;/code&gt; and &lt;code&gt;validate&lt;/code&gt; treat it exactly like a file pulled by name.&lt;/p&gt;
&lt;h3 id=&#34;how-titles-become-filenames&#34;&gt;How titles become filenames&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; converts the title to lowercase letters, digits, and hyphens, and limits it to 100 characters. If a resource has no usable title, &lt;code&gt;gcx&lt;/code&gt; uses its &lt;code&gt;metadata.name&lt;/code&gt; instead.&lt;/p&gt;
&lt;p&gt;If two resources produce the same filename, for example two dashboards titled &lt;code&gt;Overview&lt;/code&gt;, &lt;code&gt;gcx&lt;/code&gt; appends each resource&amp;rsquo;s &lt;code&gt;metadata.name&lt;/code&gt; to keep them apart, such as &lt;code&gt;overview-adkg9x2.json&lt;/code&gt; and &lt;code&gt;overview-b71fq0m.json&lt;/code&gt;. &lt;code&gt;gcx&lt;/code&gt; never overwrites a file that belongs to a different resource. For the complete rules, refer to the &lt;a href=&#34;https://github.com/grafana/gcx/blob/main/docs/design/naming.md#92-file-naming&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;file naming rules&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;remove-stale-files-before-you-push&#34;&gt;Remove stale files before you push&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;gcx resources pull&lt;/code&gt; writes files but never deletes them. If a resource is renamed, or you switch between &lt;code&gt;--filename-by=name&lt;/code&gt; and &lt;code&gt;--filename-by=title&lt;/code&gt;, the directory can end up with two files for the same resource: the old one and the new one.&lt;/p&gt;
&lt;p&gt;When you pull with &lt;code&gt;--filename-by=title&lt;/code&gt;, &lt;code&gt;gcx&lt;/code&gt; warns on &lt;code&gt;stderr&lt;/code&gt; about files that hold the same resource under a different name. A pull in name mode does not check for this. Before you push, remove the outdated files, for example with &lt;code&gt;git rm&lt;/code&gt;, or pull into an empty directory.&lt;/p&gt;
&lt;h2 id=&#34;back-up-and-restore-resources&#34;&gt;Back up and restore resources&lt;/h2&gt;
&lt;p&gt;Follow this workflow to back up all Grafana resources from one instance and later restore them. This can be useful to replicate a configuration or perform disaster recovery.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure the current context points to the Grafana instance to backup/restore:

&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;shell&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-shell&#34;&gt;gcx config use-context YOUR_CONTEXT  # for example &amp;#34;prod&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Pull all resources from your target environment:

&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;shell&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-shell&#34;&gt;gcx resources pull --path ./backup-prod # Add `-o yaml` to export resources as YAML&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Save the exported resources to version control or cloud storage.&lt;/li&gt;
&lt;li&gt;Push the resources to restore them:

&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;shell&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-shell&#34;&gt;gcx resources push --path ./backup-prod&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;incident-descriptions&#34;&gt;Incident descriptions&lt;/h2&gt;
&lt;p&gt;Incident descriptions remain visible in &lt;code&gt;gcx resources get&lt;/code&gt; and
&lt;code&gt;gcx irm incidents list&lt;/code&gt; results.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gcx resources pull&lt;/code&gt; omits descriptions from saved manifests. These backups
cannot restore incident descriptions.&lt;/p&gt;
&lt;p&gt;Old backup files can contain &lt;code&gt;spec.description&lt;/code&gt;. Remove that field before you
push the file to create an incident or to change an incident with a different
description. You can update other fields when &lt;code&gt;spec.description&lt;/code&gt; is absent or equal to the current value.&lt;/p&gt;
]]></content><description>&lt;h1 id="resource-management-workflows-with-gcx">Resource management workflows with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>&lt;code>gcx&lt;/code> allows you to interact with Grafana resources directly from your terminal. You can browse, inspect, update, and delete resources without using the Grafana UI, and move them between environments as files.&lt;/p></description></item><item><title>Lint resources</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/lint-resources/</link><pubDate>Fri, 20 Nov 2026 10:19:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/lint-resources/</guid><content><![CDATA[&lt;h1 id=&#34;lint-resources-with-gcx&#34;&gt;Lint resources with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;Use the Grafana CLI linter to verify that resources, such as dashboards and alert rules, comply with good practices and environment-specific policies.&lt;/p&gt;
&lt;h2 id=&#34;use-the-linter&#34;&gt;Use the linter&lt;/h2&gt;
&lt;p&gt;To lint resources run:&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;shell&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-shell&#34;&gt;gcx dev lint run ./resources&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Directories are recursively explored.&lt;/li&gt;
&lt;li&gt;All &lt;a href=&#34;https://github.com/grafana/gcx/blob/main/docs/reference/linter-rules/index.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;built-in rules&lt;/a&gt; are enabled by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;configure-linter-rules&#34;&gt;Configure linter rules&lt;/h3&gt;
&lt;p&gt;For a finer control, you can configure the linter rules:&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;shell&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-shell&#34;&gt;# Disable all rules for a resource type:
gcx dev lint run --disable-resource dashboard ./resources

# Disable all rules in a category:
gcx dev lint run --disable-category idiomatic ./resources

# Disable specific rules:
gcx dev lint run --disable uneditable-dashboard --disable panel-title-description ./resources

# Enable rules for specific resource types:
gcx dev lint run --disable-all --enable-resource dashboard ./resources

# Enable only some categories:
gcx dev lint run --disable-all --enable-category idiomatic ./resources

# Enable only specific rules:
gcx dev lint run --disable-all --enable uneditable-dashboard ./resources&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can modify the severity level of a rule by updating the &lt;code&gt;custom.severity&lt;/code&gt; annotation. Valid values are &lt;code&gt;warning&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;define-custom-linting-rules&#34;&gt;Define custom linting rules&lt;/h2&gt;
&lt;p&gt;Custom and built-in rules are defined in &lt;a href=&#34;https://www.openpolicyagent.org/docs/policy-language&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Rego&lt;/a&gt;, the policy language used by &lt;a href=&#34;https://www.openpolicyagent.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Open Policy Agent (OPA)&lt;/a&gt;. This ensures that resources comply with policies specific to your environment.&lt;/p&gt;
&lt;p&gt;You can scaffold new custom rules with &lt;code&gt;gcx&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;shell&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-shell&#34;&gt;# Creates a new &amp;#34;dashboard&amp;#34; linter rule in the current directory:
gcx dev lint new dashboard custom-rule&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This generates a file with the bootstrapped rule:&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;rego&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-rego&#34;&gt;# METADATA
# description: Briefly describe the rule here.
# custom:
#  severity: warning
package custom.gcx.rules.dashboard.idiomatic[&amp;#34;custom-rule&amp;#34;]

import data.gcx.result
import data.gcx.utils

# Dashboard v1
report contains violation if {
	utils.resource_is_dashboard_v1(input)

	input.spec.timezone != &amp;#34;utc&amp;#34;

	violation := result.fail(rego.metadata.chain(), sprintf(&amp;#34;timezone is &amp;#39;%s&amp;#39;, expected &amp;#39;utc&amp;#39;&amp;#34;, input.spec.timezone))
}

# Dashboard v2
report contains violation if {
	utils.resource_is_dashboard_v2(input)

	input.spec.timeSettings.timezone != &amp;#34;utc&amp;#34;

	violation := result.fail(rego.metadata.chain(), sprintf(&amp;#34;timezone is &amp;#39;%s&amp;#39;, expected &amp;#39;utc&amp;#39;&amp;#34;, input.spec.timeSettings.timezone))
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Refer to the existing &lt;a href=&#34;https://github.com/grafana/gcx/tree/main/internal/linter/bundle/gcx/rules&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Built-in rules&lt;/a&gt; for inspiration to write custom ones.&lt;/p&gt;
&lt;h3 id=&#34;rules-for-other-resources&#34;&gt;Rules for other resources&lt;/h3&gt;
&lt;p&gt;You can create rules for other resource types than dashboards, or in categories other than &lt;code&gt;idiomatic&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;shell&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-shell&#34;&gt;# Creates a new &amp;#34;alertrule&amp;#34; linter rule, categorized under &amp;#34;bug&amp;#34;:
gcx dev lint new alertrule custom-rule -c bug&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="lint-resources-with-gcx">Lint resources with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>Use the Grafana CLI linter to verify that resources, such as dashboards and alert rules, comply with good practices and environment-specific policies.&lt;/p></description></item><item><title>Manage dashboards as code with gcx</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/dashboards-as-code/</link><pubDate>Fri, 20 Nov 2026 10:19:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/dashboards-as-code/</guid><content><![CDATA[&lt;h1 id=&#34;manage-dashboards-as-code-with-gcx&#34;&gt;Manage dashboards as code with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;With this workflow, you can define and manage dashboards as code, saving them to a version control system like Git. This is useful for teams that want to maintain a history of changes, collaborate on dashboard design, and ensure consistency across environments.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;In order to use the &lt;code&gt;gcx dev serve&lt;/code&gt; functionality, you need to enable a feature toggle in your configuration 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;ini&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-ini&#34;&gt;[feature_toggles]
kubernetesDashboards = true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Refer to &lt;a href=&#34;/docs/grafana/latest/setup-grafana/configure-grafana/#feature_toggles&#34;&gt;Configure Grafana&lt;/a&gt; to learn more about enabling feature toggles.&lt;/p&gt;
&lt;p&gt;Although the local preview proxy supports service account token, Basic, and mTLS contexts, use a service account token instead of OAuth for &lt;code&gt;gcx dev serve&lt;/code&gt;. OAuth is rejected before startup until refresh-token rotation can be persisted safely by the long-running server.&lt;/p&gt;
&lt;h2 id=&#34;workflow&#34;&gt;Workflow&lt;/h2&gt;
&lt;p&gt;To manage dashboards as code with &lt;code&gt;gcx&lt;/code&gt; follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use a dashboard generation script (for example, with the &lt;a href=&#34;https://github.com/grafana/grafana-foundation-sdk&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Foundation SDK&lt;/a&gt;). You can find an example implementation in the Grafana as code &lt;a href=&#34;https://github.com/grafana/dashboards-as-code-workshop/tree/main/part-one-golang-starter&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;hands-on lab repository&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Serve and preview the output of the dashboard generator locally:

&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;shell&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-shell&#34;&gt;gcx config use-context YOUR_CONTEXT  # for example &amp;#34;dev&amp;#34;
gcx dev serve --script &amp;#39;go run scripts/generate-dashboard.go&amp;#39; --watch &amp;#39;./scripts&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;When the output looks correct, generate dashboard manifest files:

&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;shell&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-shell&#34;&gt;go run scripts/generate-dashboard.go --generate-resource-manifests --output &amp;#39;./resources&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Push the generated resources to your Grafana instance:

&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;shell&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-shell&#34;&gt;gcx config use-context YOUR_CONTEXT  # for example &amp;#34;dev&amp;#34;
gcx resources push -p ./resources/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="manage-dashboards-as-code-with-gcx">Manage dashboards as code with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>With this workflow, you can define and manage dashboards as code, saving them to a version control system like Git. This is useful for teams that want to maintain a history of changes, collaborate on dashboard design, and ensure consistency across environments.&lt;/p></description></item><item><title>Manage Machine Learning resources as code</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-machine-learning/</link><pubDate>Fri, 20 Nov 2026 10:19:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-machine-learning/</guid><content><![CDATA[&lt;h1 id=&#34;manage-machine-learning-resources-as-code&#34;&gt;Manage Machine Learning resources as code&lt;/h1&gt;
&lt;p&gt;Use &lt;code&gt;gcx resources pull&lt;/code&gt; and &lt;code&gt;gcx resources push&lt;/code&gt; to manage Grafana Cloud Machine Learning forecasts, holidays, and outlier detectors as manifests, and to copy them between stacks.&lt;/p&gt;
&lt;p&gt;To list, inspect, create, update, and delete Machine Learning resources and their alerts with &lt;code&gt;gcx ml&lt;/code&gt;, refer to &lt;a href=&#34;/docs/grafana-cloud/ai-tools/machine-learning/additional-configuration/gcx/&#34;&gt;Use gcx to manage Machine Learning resources&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Your Grafana stack must have &lt;a href=&#34;/docs/grafana-cloud/ai-tools/machine-learning/&#34;&gt;Machine Learning&lt;/a&gt; enabled.&lt;/li&gt;
&lt;li&gt;You don&amp;rsquo;t need a separate provider token. The commands use the active Grafana credential through the Machine Learning plugin proxy.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;start-from-an-example-manifest&#34;&gt;Start from an example manifest&lt;/h2&gt;
&lt;p&gt;To create a manifest, start from a resource example. Set the data source UID and the query for your target stack:&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;shell&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-shell&#34;&gt;gcx resources list-examples jobs.ml.ext.grafana.app --jq &amp;#39;.[&amp;#34;ml.ext.grafana.app&amp;#34;].v1alpha1[0].example&amp;#39; -o json &amp;gt; job.json
gcx ml jobs create -f job.json --dry-run&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;--dry-run&lt;/code&gt; checks the input without a server mutation. The result reports that server validation is not available.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Creating or updating a forecast job, including with &lt;code&gt;gcx resources push&lt;/code&gt;, can start model training.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;export-and-push-manifests&#34;&gt;Export and push manifests&lt;/h2&gt;
&lt;p&gt;Jobs, holidays, and outlier detectors use the standard resource pipeline. The provider removes server IDs and connection fields from each spec.&lt;/p&gt;
&lt;h3 id=&#34;target-stack&#34;&gt;Target stack&lt;/h3&gt;
&lt;p&gt;Each write uses the target stack URL. The server ID from the source stack is stored in &lt;code&gt;metadata.name&lt;/code&gt;. If that ID doesn&amp;rsquo;t exist on the target, the pipeline matches the normalized value of &lt;code&gt;spec.name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Each write resolves the numeric datasource ID from the UID on the target stack.
Writes need read access to the selected datasource.&lt;/p&gt;
&lt;p&gt;Matching:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Converts names to lowercase slugs.&lt;/li&gt;
&lt;li&gt;Updates one matching resource or creates a resource when there is no match.&lt;/li&gt;
&lt;li&gt;Multiple matches are rejected.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-cross-stack&#34;&gt;Push cross-stack&lt;/h3&gt;
&lt;p&gt;Data source UIDs and job-to-holiday references remain in the spec. Set these references for the target stack before a cross-stack push.&lt;/p&gt;
&lt;p&gt;After a cross-stack push, pull from the target to save its assigned IDs:&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;shell&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-shell&#34;&gt;gcx resources push -p ./ml --dry-run
gcx resources push -p ./ml
gcx resources pull jobs.ml.ext.grafana.app holidays.ml.ext.grafana.app outlierdetectors.ml.ext.grafana.app -p ./ml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;alerts-arent-part-of-the-pipeline&#34;&gt;Alerts aren&amp;rsquo;t part of the pipeline&lt;/h2&gt;
&lt;p&gt;Machine Learning alerts belong to a job or an outlier detector, and have no independent collection endpoint or resource adapter. &lt;code&gt;gcx resources pull&lt;/code&gt; and &lt;code&gt;push&lt;/code&gt; don&amp;rsquo;t include them. Use the &lt;code&gt;gcx ml jobs&lt;/code&gt; and &lt;code&gt;gcx ml outlier-detectors&lt;/code&gt; alert commands with the parent ID instead. For the full list of alert commands, refer to &lt;a href=&#34;/docs/grafana-cloud/ai-tools/machine-learning/additional-configuration/gcx/#manage-alerts&#34;&gt;Manage alerts&lt;/a&gt; in the Grafana Cloud Machine Learning guide.&lt;/p&gt;
&lt;p&gt;Alert files contain the Machine Learning alert object, including its &lt;code&gt;title&lt;/code&gt;. Use &lt;code&gt;get-alert&lt;/code&gt; to export an alert object before you edit 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;shell&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-shell&#34;&gt;gcx ml jobs get-alert &amp;lt;job-id&amp;gt; &amp;lt;alert-id&amp;gt; -o yaml &amp;gt; alert.yaml
gcx ml jobs update-alert &amp;lt;job-id&amp;gt; &amp;lt;alert-id&amp;gt; -f alert.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Outlier alerts require a nonzero &lt;code&gt;window&lt;/code&gt;, such as &lt;code&gt;5m&lt;/code&gt;. Don&amp;rsquo;t set &lt;code&gt;threshold&lt;/code&gt; or &lt;code&gt;anomalyCondition&lt;/code&gt; for an outlier alert.&lt;/p&gt;
]]></content><description>&lt;h1 id="manage-machine-learning-resources-as-code">Manage Machine Learning resources as code&lt;/h1>
&lt;p>Use &lt;code>gcx resources pull&lt;/code> and &lt;code>gcx resources push&lt;/code> to manage Grafana Cloud Machine Learning forecasts, holidays, and outlier detectors as manifests, and to copy them between stacks.&lt;/p></description></item><item><title>Manage OnCall notification rules</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-oncall-notification-rules/</link><pubDate>Fri, 20 Nov 2026 10:19:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-oncall-notification-rules/</guid><content><![CDATA[&lt;h1 id=&#34;manage-oncall-personal-notification-rules&#34;&gt;Manage OnCall personal notification rules&lt;/h1&gt;
&lt;p&gt;You can use &lt;code&gt;gcx&lt;/code&gt; to manage OnCall personal notification rules&lt;/p&gt;
&lt;h2 id=&#34;authentication-and-permissions&#34;&gt;Authentication and permissions&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;gcx login&lt;/code&gt; to sign in as a Grafana user.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The command uses the shared Grafana authentication transport and the IRM plugin proxy, and it doesn&amp;rsquo;t need a separate OnCall API key.&lt;/li&gt;
&lt;li&gt;Service account requests are rejected by the server.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The server requires &lt;code&gt;grafana-oncall-app.user-settings:read&lt;/code&gt; for reads and &lt;code&gt;grafana-oncall-app.user-settings:write&lt;/code&gt; for changes. Changes to another user&amp;rsquo;s rules also require &lt;code&gt;grafana-oncall-app.user-settings:admin&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;manage-oncall-notification-rules&#34;&gt;Manage OnCall notification rules&lt;/h2&gt;
&lt;p&gt;To get a list of rules for all users and priority levels, run:&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;gcx irm oncall personal-notification-rules list
gcx irm oncall personal-notification-rules get &amp;lt;rule-id&amp;gt;
gcx resources list-examples personalnotificationrules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Manage rules with these commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create rules with &lt;code&gt;create -f rule.yaml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Update rules with &lt;code&gt;update &amp;lt;rule-id&amp;gt; -f rule.yaml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Delete rules with &lt;code&gt;delete &amp;lt;rule-id&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;rule-fields&#34;&gt;Rule fields&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Do not use the public API&amp;rsquo;s &lt;code&gt;type&lt;/code&gt; or &lt;code&gt;duration&lt;/code&gt; field names.&lt;/strong&gt; &lt;code&gt;step&lt;/code&gt;, &lt;code&gt;notify_by&lt;/code&gt;, and &lt;code&gt;wait_delay&lt;/code&gt; use the internal IRM API values.&lt;/p&gt;
&lt;p&gt;Rule fields such as &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;important&lt;/code&gt; are set when the rule is created, and are ignored in updates.&lt;/p&gt;
&lt;p&gt;Use a string of seconds for &lt;code&gt;wait_delay&lt;/code&gt;, such as &lt;code&gt;&amp;quot;300.0&amp;quot;&lt;/code&gt;, or &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The server assigns its own rule ID at creation. Use the returned ID for later updates. For resource pushes, pull the created rule and keep that manifest before the next push. Its &lt;code&gt;metadata.name&lt;/code&gt; contains the server ID. The server also controls &lt;code&gt;order&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The API can also return &lt;code&gt;notify_device&lt;/code&gt;. &lt;code&gt;gcx&lt;/code&gt; preserves this server field in exports and updates. It&amp;rsquo;s &lt;code&gt;null&lt;/code&gt; when the rule has no selected device.&lt;/p&gt;
&lt;h3 id=&#34;routes&#34;&gt;Routes&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;proxy route&lt;/strong&gt; is &lt;code&gt;notification_policies/&lt;/code&gt;, and uses the same &lt;code&gt;UserNotificationPolicy&lt;/code&gt; model as the public OnCall &lt;code&gt;/api/v1/personal_notification_rules/&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;public route&lt;/strong&gt; requires an OnCall API token in the raw &lt;code&gt;Authorization&lt;/code&gt; header. A Grafana OAuth token is used through the plugin proxy instead.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;internal route&lt;/strong&gt; defaults to the current user and &lt;code&gt;important=false&lt;/code&gt; when query parameters are absent.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; sends &lt;code&gt;?user=&amp;amp;important=&lt;/code&gt; to disable these defaults. The backend then returns the full collection. The resource adapter uses the same client methods as the provider commands.&lt;/p&gt;
&lt;h2 id=&#34;select-a-step-and-notification-channel&#34;&gt;Select a step and notification channel&lt;/h2&gt;
&lt;p&gt;Use these internal API values for &lt;code&gt;step&lt;/code&gt;:&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;Value&lt;/th&gt;
              &lt;th&gt;Step&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Wait for &lt;code&gt;wait_delay&lt;/code&gt; seconds&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Notify through &lt;code&gt;notify_by&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;A wait step returns &lt;code&gt;notify_by: null&lt;/code&gt;. The default table shows a dash for that value and shows the wait duration in &lt;code&gt;WAIT-DELAY&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;notification-channels&#34;&gt;Notification channels&lt;/h3&gt;
&lt;p&gt;Notification channels depend on the stack and its integrations. Read the live catalog to get the available values and display names:&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;gcx api /api/plugins/grafana-irm-app/resources/notification_policies/notify_by_options/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Common &lt;code&gt;notify_by&lt;/code&gt; values are:&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;Value&lt;/th&gt;
              &lt;th&gt;Channel&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Slack mentions&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;SMS&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Phone call&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;3&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Telegram&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;5&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Mobile push&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;6&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Mobile push important&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;7&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Microsoft Teams&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;8&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Email&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;11&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Webhook&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="manage-oncall-personal-notification-rules">Manage OnCall personal notification rules&lt;/h1>
&lt;p>You can use &lt;code>gcx&lt;/code> to manage OnCall personal notification rules&lt;/p>
&lt;h2 id="authentication-and-permissions">Authentication and permissions&lt;/h2>
&lt;p>Use &lt;code>gcx login&lt;/code> to sign in as a Grafana user.&lt;/p></description></item><item><title>Manage Assistant change review checks</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-change-review-checks/</link><pubDate>Tue, 24 Nov 2026 14:19:45 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-change-review-checks/</guid><content><![CDATA[&lt;h1 id=&#34;manage-assistant-change-review-checks&#34;&gt;Manage Assistant change review checks&lt;/h1&gt;
&lt;p&gt;Grafana Assistant change review reviews GitHub pull requests with a set of checks. Use &lt;code&gt;gcx&lt;/code&gt; to tune the built-in checks, add your own, and see which checks find real issues. &lt;strong&gt;Change review commands are experimental and require Grafana Cloud&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../configuration/&#34;&gt;Configure a gcx context&lt;/a&gt; for a Grafana Cloud stack with GitHub connected to Grafana Assistant and change review checks available.&lt;/li&gt;
&lt;li&gt;Reading checks and statistics requires the &lt;code&gt;grafana-assistant-app.github:read&lt;/code&gt; action. Creating, updating, and deleting checks requires both &lt;code&gt;grafana-assistant-app.github:read&lt;/code&gt; and &lt;code&gt;grafana-assistant-app.github:write&lt;/code&gt;, because each change reads the current checks before saving.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;review-the-checks&#34;&gt;Review the checks&lt;/h2&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;shell&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-shell&#34;&gt;gcx assistant change-review checks list
gcx assistant change-review checks get deploy-hazards&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;list&lt;/code&gt; shows every built-in check with the stack&amp;rsquo;s settings, followed by custom checks. Add &lt;code&gt;-o wide&lt;/code&gt; to see where each check applies and its repository overrides.&lt;/p&gt;
&lt;h2 id=&#34;tune-a-check&#34;&gt;Tune a check&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;update&lt;/code&gt; changes only the fields you set:&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;shell&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-shell&#34;&gt;# Fail the GitHub Check on a confirmed finding
gcx assistant change-review checks update instrumentation --blocking

# Turn a check off
gcx assistant change-review checks update production-impact --enabled=false

# Run a check only when matching files change
gcx assistant change-review checks update production-impact --path &amp;#39;api/**&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;On a built-in check, &lt;code&gt;--instructions&lt;/code&gt; adds to the check&amp;rsquo;s own guidance. To edit fields that have no flag, such as repository overrides, round-trip the check through a 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;shell&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-shell&#34;&gt;gcx assistant change-review checks get deploy-hazards &amp;gt; deploy-hazards.yaml
# edit deploy-hazards.yaml
gcx assistant change-review checks update deploy-hazards -f deploy-hazards.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;A file exported with &lt;code&gt;get&lt;/code&gt; carries every field, so saving it overwrites any change someone made to the check after you exported it. Save soon after exporting, or remove the fields you aren&amp;rsquo;t changing: a field missing from the file, like a flag you don&amp;rsquo;t set, keeps its current value.&lt;/p&gt;
&lt;h2 id=&#34;add-and-remove-custom-checks&#34;&gt;Add and remove custom checks&lt;/h2&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;shell&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-shell&#34;&gt;gcx assistant change-review checks create --name &amp;#34;Migration safety&amp;#34; \
  --instructions &amp;#34;Flag schema migrations that lock large tables.&amp;#34; --path &amp;#39;migrations/**&amp;#39;

gcx assistant change-review checks delete CHECK_ID&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The check ID comes from its name, with a number added when another check already uses that ID. Replace &lt;code&gt;CHECK_ID&lt;/code&gt; with the &lt;code&gt;id&lt;/code&gt; that &lt;code&gt;create&lt;/code&gt; returns. Built-in checks can&amp;rsquo;t be deleted. To stop one from running, use &lt;code&gt;update CHECK --enabled=false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Saves are guarded by a revision. If someone else saves the checks while a command is saving, &lt;code&gt;gcx&lt;/code&gt; applies your change to the latest checks when they changed a different check. When they changed the same check, the command fails without saving, so their change is kept; review the check with &lt;code&gt;get&lt;/code&gt; and run the command again. An &lt;code&gt;update&lt;/code&gt; that changes nothing saves nothing.&lt;/p&gt;
&lt;h2 id=&#34;see-how-checks-perform&#34;&gt;See how checks perform&lt;/h2&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;shell&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-shell&#34;&gt;gcx assistant change-review stats --since 7d
gcx assistant change-review checks list-pull-requests deploy-hazards --repository grafana/gcx&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;stats&lt;/code&gt; counts, for each check, the issues it confirmed and how many a later review found fixed or still present. &lt;code&gt;list-pull-requests&lt;/code&gt; shows the pull requests behind one check&amp;rsquo;s counts. Both commands default to the last 30 days and read at most 90 days. They return counts, never finding text.&lt;/p&gt;
]]></content><description>&lt;h1 id="manage-assistant-change-review-checks">Manage Assistant change review checks&lt;/h1>
&lt;p>Grafana Assistant change review reviews GitHub pull requests with a set of checks. Use &lt;code>gcx&lt;/code> to tune the built-in checks, add your own, and see which checks find real issues. &lt;strong>Change review commands are experimental and require Grafana Cloud&lt;/strong>.&lt;/p></description></item><item><title>Manage Watchers</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-assistant-watchers/</link><pubDate>Thu, 26 Nov 2026 08:23:58 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/manage-assistant-watchers/</guid><content><![CDATA[&lt;h1 id=&#34;manage-watchers&#34;&gt;Manage Watchers&lt;/h1&gt;
&lt;p&gt;Use &lt;code&gt;gcx&lt;/code&gt; to create Watchers and keep their configuration in version control. &lt;strong&gt;Watcher commands are experimental and require Grafana Cloud&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../configuration/&#34;&gt;Configure a gcx context&lt;/a&gt; for a Grafana Cloud stack with Watchers enabled.&lt;/li&gt;
&lt;li&gt;Make sure your identity can read and manage Watchers and access the data sources you want to monitor.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Commands use your selected context. Add &lt;code&gt;--context CONTEXT&lt;/code&gt; to select another context.&lt;/p&gt;
&lt;h2 id=&#34;create-a-watcher-and-follow-calibration&#34;&gt;Create a Watcher and follow calibration&lt;/h2&gt;
&lt;p&gt;To create a Watcher, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Save the following manifest as &lt;code&gt;watcher.yaml&lt;/code&gt;. Replace &lt;code&gt;DATASOURCE_UID&lt;/code&gt; with an accessible data source UID.&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;apiVersion: assistant.ext.grafana.app/v1alpha1
kind: Watcher
metadata:
  name: checkout-health
spec:
  title: Checkout health
  prompt: Watch request failures and sustained latency increases.
  datasourceUids: [DATASOURCE_UID]
  interval: 15m
  sensitivity: balanced&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create the Watcher:&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;shell&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-shell&#34;&gt;gcx assistant watchers create -f watcher.yaml -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The result includes the saved resource and a separate calibration request outcome. Creation requests background calibration without automatically starting monitoring. Notification destinations and investigations are disabled unless you enable them in the manifest. Watcher calibration and runs consume Grafana Assistant tokens; refer to &lt;a href=&#34;/docs/grafana-cloud/platform/pricing-and-usage/assistant/&#34;&gt;Assistant pricing&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;WATCHER&lt;/code&gt; with the returned resource name or ID and inspect progress:&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;shell&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-shell&#34;&gt;gcx assistant watchers status WATCHER -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;An &lt;code&gt;accepted&lt;/code&gt; request means calibration was requested, not that checks are ready. Wait while it is queued or running. If calibration fails, is cancelled, or needs input, continue in Grafana. When it completes, review the enabled checks in Grafana before &lt;a href=&#34;#start-and-pause-monitoring&#34;&gt;starting monitoring&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If the request outcome is &lt;code&gt;unavailable&lt;/code&gt;, calibrate the saved Watcher in Grafana. An &lt;code&gt;error&lt;/code&gt; or &lt;code&gt;not-requested&lt;/code&gt; outcome returns exit code 4 and retains the Watcher identity. Inspect the reported failure and status; resolve any failed configuration stage with &lt;code&gt;update&lt;/code&gt;, then continue in Grafana. Do not repeat &lt;code&gt;create&lt;/code&gt;: a request error can leave calibration running.&lt;/p&gt;
&lt;h2 id=&#34;inspect-and-update-configuration&#34;&gt;Inspect and update configuration&lt;/h2&gt;
&lt;p&gt;To change an existing Watcher, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Find its resource name or ID:&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;shell&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-shell&#34;&gt;gcx assistant watchers list&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Add &lt;code&gt;--archived&lt;/code&gt; to list archived Watchers. If a name matches several Watchers, use an ID.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Save its configuration to a 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;shell&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-shell&#34;&gt;gcx assistant watchers get WATCHER -o yaml &amp;gt; watcher.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit the file, then apply the complete manifest:&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;shell&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-shell&#34;&gt;gcx assistant watchers update WATCHER -f watcher.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;update&lt;/code&gt; and &lt;code&gt;resources push&lt;/code&gt; replace the modeled configuration. Omitted optional settings receive defaults, including disabled notification destinations. Start from an exported manifest to retain your existing choices. These operations preserve calibrated checks and learned state, and do not request calibration, start monitoring, or pause it. If an edit is rejected during calibration, wait for it to finish or cancel it in Grafana.&lt;/p&gt;
&lt;p&gt;If an apply reports a partial failure, changes may already be saved. Inspect the returned Watcher ID and failed stage, resolve the failure, and reapply with &lt;code&gt;update&lt;/code&gt; or &lt;code&gt;resources push&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;status&lt;/code&gt; for calibration, checks, and runtime observations; &lt;code&gt;get&lt;/code&gt; exports configuration only. A paused Watcher can retain an older health assessment.&lt;/p&gt;
&lt;p&gt;Use Grafana for custom automatic-recalibration schedules and other settings gcx cannot represent. gcx refuses configuration writes that would drop those settings.&lt;/p&gt;
&lt;h2 id=&#34;manage-configuration-files&#34;&gt;Manage configuration files&lt;/h2&gt;
&lt;p&gt;To store and reapply Watcher configuration, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Export the manifests:&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;shell&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-shell&#34;&gt;gcx resources pull watchers -p ./watchers -o yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit the files and validate them without writing to Grafana:&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;shell&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-shell&#34;&gt;gcx resources push -p ./watchers --dry-run&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Review your changes, then apply them:&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;shell&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-shell&#34;&gt;gcx resources push -p ./watchers&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;An unchanged apply sends no mutation unless you supply secret values. Push saves configuration only; calibrate new definitions in Grafana. Dry-run checks the manifest locally, so permissions, data source access, and other server checks still apply when you push.&lt;/p&gt;
&lt;h2 id=&#34;configure-slack-and-alerting-notifications&#34;&gt;Configure Slack and Alerting notifications&lt;/h2&gt;
&lt;p&gt;To select a Slack recipient and an Alerting notification policy tree, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following under &lt;code&gt;spec&lt;/code&gt; in your complete Watcher manifest. Replace the example IDs and policy tree with your destination values:&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;notifications:
  slack:
    enabled: true
    targetType: dm
    userId: U_EXAMPLE
    teamId: T_EXAMPLE
    severity: critical
  alerting:
    enabled: true
    severity: critical
    routingTree: example-policy-tree&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For a Slack channel, use &lt;code&gt;targetType: channel&lt;/code&gt; and &lt;code&gt;channelId&lt;/code&gt; instead of &lt;code&gt;userId&lt;/code&gt;. &lt;code&gt;teamId&lt;/code&gt; is optional. Enabled channels require a nonblank channel ID; direct messages require a nonblank user ID even when disabled.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Apply the complete manifest with &lt;code&gt;gcx assistant watchers update WATCHER -f watcher.yaml&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Verify the saved destinations with &lt;code&gt;gcx assistant watchers get WATCHER -o yaml&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Notification severity defaults to &lt;code&gt;warning-and-critical&lt;/code&gt;. Set &lt;code&gt;routingTree: &amp;quot;&amp;quot;&lt;/code&gt; to use the default notification policy tree. Manage notification policy trees and contact points in Grafana Alerting.&lt;/p&gt;
&lt;h2 id=&#34;supply-webhook-secrets&#34;&gt;Supply webhook secrets&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;fromEnv&lt;/code&gt; or &lt;code&gt;fromFile&lt;/code&gt; to supply a secret, for example &lt;code&gt;url: { fromEnv: WATCHER_WEBHOOK_URL }&lt;/code&gt;. Exports use &lt;code&gt;{ preserve: true }&lt;/code&gt; for saved secrets; omitting a secret on update also preserves it. Use &lt;code&gt;{ clear: true }&lt;/code&gt; to remove one. You can&amp;rsquo;t use preserve markers when creating a Watcher.&lt;/p&gt;
&lt;p&gt;When supplying or clearing a webhook URL, also supply or clear every saved bearer token and signing secret. Keep resolved secrets out of manifests and version control.&lt;/p&gt;
&lt;h2 id=&#34;start-and-pause-monitoring&#34;&gt;Start and pause monitoring&lt;/h2&gt;
&lt;p&gt;After calibration completes with at least one enabled check, start your Watcher:&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;shell&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-shell&#34;&gt;gcx assistant watchers start WATCHER&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Starting can immediately run a scan; event-only Watchers wait for their trigger. Both start and run can send configured notifications or launch investigations. If start fails, inspect &lt;code&gt;gcx assistant watchers status WATCHER&lt;/code&gt; before retrying: monitoring might already be active.&lt;/p&gt;
&lt;p&gt;To stop future scans, pause the Watcher:&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;shell&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-shell&#34;&gt;gcx assistant watchers pause WATCHER&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finish or cancel calibration in Grafana before pausing. An in-flight scan can still finish and send notifications or launch investigations.&lt;/p&gt;
&lt;h2 id=&#34;request-a-run-and-inspect-history&#34;&gt;Request a run and inspect history&lt;/h2&gt;
&lt;p&gt;Request a scan without changing the schedule, then inspect recent executions:&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;shell&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-shell&#34;&gt;gcx assistant watchers run WATCHER -o json
gcx assistant watchers list-runs WATCHER --limit 20 -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The run receipt reports acceptance, skipped work, or failure. Acceptance doesn&amp;rsquo;t mean the scan completed. Its &lt;code&gt;taskId&lt;/code&gt; can&amp;rsquo;t be matched to history IDs; don&amp;rsquo;t assume the newest execution belongs to your request. Running might require create permission in addition to write permission.&lt;/p&gt;
&lt;p&gt;History shows execution status separately from assessment. The default limit is 20, and the maximum is 100. &lt;code&gt;coverage.hasMore&lt;/code&gt; indicates additional retained history; results aren&amp;rsquo;t a snapshot of all past runs. For full run evidence, open the Watcher in Grafana.&lt;/p&gt;
&lt;h2 id=&#34;archive-and-recover-a-watcher&#34;&gt;Archive and recover a Watcher&lt;/h2&gt;
&lt;p&gt;Pause before archiving to retain the Watcher&amp;rsquo;s configuration and history:&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;shell&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-shell&#34;&gt;gcx assistant watchers pause WATCHER
gcx assistant watchers archive WATCHER&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Archive only accepts a Watcher whose status is &lt;code&gt;paused&lt;/code&gt;; pause it first. If it is calibrating, finish or cancel calibration in Grafana before pausing. Keep other clients from starting it during this sequence: the pause check and archive aren&amp;rsquo;t atomic. Archiving can resolve active Grafana Alerting findings.&lt;/p&gt;
&lt;p&gt;Recover an archived Watcher without activating monitoring:&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;shell&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-shell&#34;&gt;gcx assistant watchers unarchive WATCHER&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Review its status and automatic-stop deadline before starting again. Recovery retains that deadline. Archive recovery doesn&amp;rsquo;t restore a previous definition version.&lt;/p&gt;
&lt;h2 id=&#34;compare-definition-versions&#34;&gt;Compare definition versions&lt;/h2&gt;
&lt;p&gt;To inspect saved definitions before restoring one, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;List retained versions:&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;shell&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-shell&#34;&gt;gcx assistant watchers list-versions WATCHER --limit 20 -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Results contain one page. If &lt;code&gt;coverage.nextBeforeVersion&lt;/code&gt; is present, pass it as &lt;code&gt;--before-version&lt;/code&gt; to read the next page. Server retention can exclude older versions.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Read the definition you want to inspect:&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;shell&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-shell&#34;&gt;gcx assistant watchers versions get WATCHER VERSION -o yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compare two definitions:&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;shell&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-shell&#34;&gt;gcx assistant watchers versions diff WATCHER FROM_VERSION TO_VERSION -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The diff compares definitions only. Add &lt;code&gt;--json path,operation&lt;/code&gt; to show changed paths and operations while retaining the compared versions and scope.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;restore-a-definition-version&#34;&gt;Restore a definition version&lt;/h2&gt;
&lt;p&gt;Restore creates a new current definition version. It requires a non-archived Watcher in &lt;code&gt;draft&lt;/code&gt;, &lt;code&gt;paused&lt;/code&gt;, or &lt;code&gt;ready&lt;/code&gt; state. It retains current notification actions and settings outside the definition; it doesn&amp;rsquo;t copy historical learned state.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Inspect the Watcher&amp;rsquo;s lifecycle and current version:&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;shell&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-shell&#34;&gt;gcx assistant watchers status WATCHER -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For a running Watcher, run &lt;code&gt;gcx assistant watchers pause WATCHER&lt;/code&gt; first. Finish or cancel calibration in Grafana before restoring.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;CURRENT_VERSION&lt;/code&gt; with the version reported by &lt;code&gt;status&lt;/code&gt;, then restore the selected &lt;code&gt;VERSION&lt;/code&gt; and confirm:&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;shell&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-shell&#34;&gt;gcx assistant watchers versions restore WATCHER VERSION --expected-current-version CURRENT_VERSION -o json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;A stale guard is rejected. Inspect status and compare again before choosing a new guard.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The restored Watcher stays inactive and can become a draft that needs calibration. You can restore another version from that draft without pausing it. Review it in Grafana before starting monitoring. If the write outcome is unknown, inspect &lt;code&gt;status&lt;/code&gt; and &lt;code&gt;list-versions&lt;/code&gt; before retrying. A confirmed save followed by failed verification returns exit code 4; inspect the saved version instead of repeating the restore.&lt;/p&gt;
&lt;h2 id=&#34;delete-a-watcher&#34;&gt;Delete a Watcher&lt;/h2&gt;
&lt;p&gt;To remove a Watcher, run the following command and confirm deletion:&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;shell&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-shell&#34;&gt;gcx assistant watchers delete WATCHER&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Use &lt;code&gt;--force&lt;/code&gt; only when you want to skip confirmation.&lt;/p&gt;
]]></content><description>&lt;h1 id="manage-watchers">Manage Watchers&lt;/h1>
&lt;p>Use &lt;code>gcx&lt;/code> to create Watchers and keep their configuration in version control. &lt;strong>Watcher commands are experimental and require Grafana Cloud&lt;/strong>.&lt;/p>
&lt;h2 id="before-you-begin">Before you begin&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="../../configuration/">Configure a gcx context&lt;/a> for a Grafana Cloud stack with Watchers enabled.&lt;/li>
&lt;li>Make sure your identity can read and manage Watchers and access the data sources you want to monitor.&lt;/li>
&lt;/ul>
&lt;p>Commands use your selected context. Add &lt;code>--context CONTEXT&lt;/code> to select another context.&lt;/p></description></item><item><title>Build Grafana Pages</title><link>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/build-grafana-pages/</link><pubDate>Wed, 25 Nov 2026 11:19:35 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/ai-tools/grafana-cli/gcx/resources/build-grafana-pages/</guid><content><![CDATA[&lt;h1 id=&#34;build-grafana-pages&#34;&gt;Build Grafana Pages&lt;/h1&gt;
&lt;p&gt;A Grafana Page is a live web page on your Grafana data, such as a report, an incident summary, or a slideshow. It&amp;rsquo;s a small React and TypeScript project that your stack builds and serves in Grafana, where its queries run as each viewer. Use &lt;code&gt;gcx&lt;/code&gt; to write a page in a local directory, with your own editor or a coding agent, and let the stack build it. &lt;strong&gt;Pages commands are experimental and require Grafana Cloud.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../configuration/&#34;&gt;Configure a gcx context&lt;/a&gt; for a Grafana Cloud stack with Grafana Pages enabled and a version of Grafana Assistant that accepts gcx&amp;rsquo;s Pages commands.&lt;/li&gt;
&lt;li&gt;To publish or pull a published page, sign in with &lt;code&gt;gcx login&lt;/code&gt;. A service account token can build new drafts, but can&amp;rsquo;t publish or edit published pages.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;gcx pages catalog&lt;/code&gt; finds and reads published pages. &lt;code&gt;gcx pages drafts&lt;/code&gt; writes, builds, and publishes the pages you work on in a local directory. Commands use your selected context. Add &lt;code&gt;--context CONTEXT&lt;/code&gt; to select another context. These commands don&amp;rsquo;t run Grafana Assistant.&lt;/p&gt;
&lt;h2 id=&#34;start-a-page&#34;&gt;Start a page&lt;/h2&gt;
&lt;p&gt;Create a draft page and write its project into a new directory:&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;shell&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-shell&#34;&gt;gcx pages drafts create --title &amp;#34;Checkout health&amp;#34; --dir ./checkout-health&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The directory holds the whole project: &lt;code&gt;page.json&lt;/code&gt;, &lt;code&gt;pages.bindings.json&lt;/code&gt; for the page&amp;rsquo;s queries, &lt;code&gt;src/App.tsx&lt;/code&gt;, and the Pages SDK with its documentation under &lt;code&gt;packages/pages-sdk/&lt;/code&gt;. Start with &lt;code&gt;packages/pages-sdk/README.md&lt;/code&gt;. The &lt;code&gt;.gcx-page.json&lt;/code&gt; file links the directory to the draft; keep it.&lt;/p&gt;
&lt;p&gt;The draft is private to you until you publish it.&lt;/p&gt;
&lt;h2 id=&#34;build-and-check-the-page&#34;&gt;Build and check the page&lt;/h2&gt;
&lt;p&gt;To build the page and check how it renders, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add a named query to &lt;code&gt;pages.bindings.json&lt;/code&gt;. Replace &lt;code&gt;DATASOURCE_UID&lt;/code&gt; with the UID of a Prometheus data source:&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;requests&amp;#34;: {
    &amp;#34;title&amp;#34;: &amp;#34;Checkout requests per second&amp;#34;,
    &amp;#34;datasourceUid&amp;#34;: &amp;#34;DATASOURCE_UID&amp;#34;,
    &amp;#34;query&amp;#34;: { &amp;#34;expr&amp;#34;: &amp;#34;sum(rate(http_requests_total{service=\&amp;#34;checkout\&amp;#34;}[5m]))&amp;#34;, &amp;#34;range&amp;#34;: true }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show it in &lt;code&gt;src/App.tsx&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;tsx&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-tsx&#34;&gt;import { GrafanaPanel, TimeRangePicker, useQuery } from &amp;#39;@grafana/pages&amp;#39;;

export function App() {
  const requests = useQuery(&amp;#39;requests&amp;#39;);
  return (
    &amp;lt;main&amp;gt;
      &amp;lt;h1&amp;gt;Checkout health&amp;lt;/h1&amp;gt;
      &amp;lt;TimeRangePicker /&amp;gt;
      &amp;lt;div data-page-sources=&amp;#39;[&amp;#34;requests&amp;#34;]&amp;#39;&amp;gt;
        &amp;lt;GrafanaPanel data={requests} pluginId=&amp;#34;timeseries&amp;#34; title=&amp;#34;Requests per second&amp;#34; /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/main&amp;gt;
  );
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Build it on your stack:&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;shell&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-shell&#34;&gt;gcx pages drafts push --dir ./checkout-health&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Push sends the files that changed. If the page doesn&amp;rsquo;t build, the command lists the type and build errors, and the draft keeps its previous version.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Render the latest build, with live data, as an image:&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;shell&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-shell&#34;&gt;gcx pages drafts snapshot --dir ./checkout-health --output-dir ./snapshots&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the image and check the layout and data. A page that builds can still render incorrectly.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The output of &lt;code&gt;push&lt;/code&gt; includes the draft&amp;rsquo;s address in Grafana.&lt;/p&gt;
&lt;h2 id=&#34;change-a-published-page&#34;&gt;Change a published page&lt;/h2&gt;
&lt;p&gt;Download a published page&amp;rsquo;s source:&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;shell&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-shell&#34;&gt;gcx pages catalog list --section mine
gcx pages drafts pull PAGE --dir ./checkout-health-copy&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace &lt;code&gt;PAGE&lt;/code&gt; with the page&amp;rsquo;s ID or link. The directory must be new or empty. &lt;code&gt;pull&lt;/code&gt; only reads: it writes the page&amp;rsquo;s source as text, without the Pages SDK under &lt;code&gt;packages/&lt;/code&gt; and the stylesheets, which stay on the stack.&lt;/p&gt;
&lt;p&gt;Edit the files, then push. The first push builds a draft from the page and sends only the files you changed; it refuses if someone published a newer version since you pulled. Check the draft as before. Publishing it makes your changes the page&amp;rsquo;s next version.&lt;/p&gt;
&lt;p&gt;After the first push, download the draft&amp;rsquo;s whole project, SDK included:&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;shell&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-shell&#34;&gt;gcx pages drafts pull --dir ./checkout-health-copy&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;A draft of another person&amp;rsquo;s page leaves out their agent guidance and the SDK&amp;rsquo;s Markdown docs, and lists them under &lt;code&gt;omitted&lt;/code&gt; in JSON or YAML output. The stack builds the draft with the template&amp;rsquo;s guidance.&lt;/p&gt;
&lt;p&gt;If the draft changes in Grafana, for example when you ask Grafana Assistant to change it, download it again before you edit:&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;shell&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-shell&#34;&gt;gcx pages drafts pull --dir ./checkout-health-copy&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This refuses while the directory has changes you haven&amp;rsquo;t pushed. Push them first, or add &lt;code&gt;--force&lt;/code&gt; to discard them.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gcx resources pull&lt;/code&gt; also downloads published pages, as &lt;code&gt;Page&lt;/code&gt; objects, but those hold only a page&amp;rsquo;s catalog details: its title, description, category, and tags. To copy or change a page, use &lt;code&gt;gcx pages drafts pull&lt;/code&gt; and &lt;code&gt;gcx pages drafts push&lt;/code&gt;, not &lt;code&gt;gcx resources push&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;publish-the-page&#34;&gt;Publish the page&lt;/h2&gt;
&lt;p&gt;Publishing shares the page:&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;shell&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-shell&#34;&gt;gcx pages drafts publish --dir ./checkout-health --folder FOLDER_UID --category report&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Everyone who can view the folder can open the page. To publish without a folder, use &lt;code&gt;--unlisted&lt;/code&gt;: only you can open the page, unless you add &lt;code&gt;--link-sharing&lt;/code&gt; to let anyone in your organization with the link open it.&lt;/p&gt;
&lt;p&gt;Publishing uses the draft&amp;rsquo;s last successful build, not your local files. If the directory has changes you haven&amp;rsquo;t pushed, &lt;code&gt;publish&lt;/code&gt; warns you and publishes the earlier build, so push first.&lt;/p&gt;
&lt;p&gt;A page you pulled, or published before, keeps its folder and sharing, and earlier versions stay in its history. To change its folder or sharing, use Grafana, then publish without &lt;code&gt;--folder&lt;/code&gt;, &lt;code&gt;--unlisted&lt;/code&gt;, or &lt;code&gt;--link-sharing&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-pages-with-coding-agents&#34;&gt;Use Pages with coding agents&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;grafana-pages&lt;/code&gt; agent skill explains the page project, the SDK, query bindings, and how pages run, and asks agents to build a Page instead of an artifact or a standalone HTML file when your stack has Pages. To install it, refer to &lt;a href=&#34;../../use-gcx-with-agents/&#34;&gt;Use gcx with agents&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;limits&#34;&gt;Limits&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;push&lt;/code&gt; writes text files of up to 120 KiB. Use SVG for images you add.&lt;/li&gt;
&lt;li&gt;Pages build with the packages in the project&amp;rsquo;s &lt;code&gt;package.json&lt;/code&gt;; gcx can&amp;rsquo;t install others.&lt;/li&gt;
&lt;li&gt;A page runs in an isolated frame without network access. Its data comes from its queries, which run as each viewer.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="build-grafana-pages">Build Grafana Pages&lt;/h1>
&lt;p>A Grafana Page is a live web page on your Grafana data, such as a report, an incident summary, or a slideshow. It&amp;rsquo;s a small React and TypeScript project that your stack builds and serves in Grafana, where its queries run as each viewer. Use &lt;code>gcx&lt;/code> to write a page in a local directory, with your own editor or a coding agent, and let the stack build it. &lt;strong>Pages commands are experimental and require Grafana Cloud.&lt;/strong>&lt;/p></description></item></channel></rss>