Compare commits

...

168 Commits

Author SHA1 Message Date
Kevin Minehart
43b083e54e update PR patch check / sync mirror workflows 2025-04-22 08:45:27 -05:00
grafana-delivery-bot[bot]
8bc94106e2 [v11.3.x] Alerting docs: clarify $labels and query labels (#97356)
Alerting docs: clarify `$labels` and query labels (#97350)

* Alerting docs: clarify `$labels` and query labels

* fix mispell

(cherry picked from commit 8fe36e1c83)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-12-03 16:11:23 +01:00
grafana-delivery-bot[bot]
54ff80afb1 [v11.3.x] Deprecate notice for metrics summary and Aggregate by (#94788)
Deprecate notice for metrics summary and Aggregate by (#94761)

(cherry picked from commit a5022d9dc6)

Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com>
2024-12-03 10:06:38 -05:00
grafana-delivery-bot[bot]
780e191177 [v11.3.x] Packaging: Remove sysvinit references / support from rhel packaging (#97309)
Packaging: Remove sysvinit references / support from rhel packaging (#97068)

Remove sysvinit references / support from rhel packaging

(cherry picked from commit 3448384e0d)

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>
2024-12-02 22:20:45 +02:00
Jev Forsberg
e80e6e532c [v11.3.x] Chore: Remove verification steps for deb/rpm in drone (#97297)
Chore: Remove verification steps for deb/rpm in drone (#96991)

remove verification steps for deb/rpm in drone

(cherry picked from commit feeb2c6ce0)

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2024-12-02 11:57:59 -07:00
grafana-delivery-bot[bot]
17d7ca7232 [v11.3.x] Docs: Canvas visualization refactor (#97286)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-12-02 12:11:29 -05:00
grafana-delivery-bot[bot]
bc3fd9d808 [v11.3.x] Docs: Add more information on wrap text override (#97273)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-12-02 11:12:36 -05:00
grafana-delivery-bot[bot]
1de9f9477f [v11.3.x] Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97262)
Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97162)

* Do not fetch Orgs if the user is authenticated by apikey/sa or render svc

* Lint

(cherry picked from commit fa634e1476)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2024-12-02 16:06:48 +01:00
grafana-delivery-bot[bot]
4428bf7025 [v11.3.x] Alerting: Fix incorrect 500 code on missing alert rule dashboardUID / panelID (#96775)
Alerting: Fix incorrect 500 code on missing alert rule dashboardUID / panelID (#96491)

(cherry picked from commit 64c93217ff)

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
2024-12-02 09:15:40 -05:00
grafana-delivery-bot[bot]
b35522672b [v11.3.x] doc: Fix spacing in sample values for enabling persistence (#97238)
Co-authored-by: Irene Rodriguez <irene.rodriguez@grafana.com>
Co-authored-by: horacimacias <horacimacias@gmail.com>
Fix spacing in sample values for enabling persistence (#97220)
2024-12-02 12:47:48 +02:00
grafana-delivery-bot[bot]
c8031ed338 [v11.3.x] Update index.md to add a note about provisioned data source (#97232)
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Gaurav Soni <raveformails@gmail.com>
2024-12-02 12:00:00 +02:00
Sergej-Vlasov
9c606f2302 Update to scenes 5.28.1 (#97204) (#97207)
update to scenes 5.28.1

(cherry picked from commit 174e9ae193)
2024-11-29 18:16:56 +02:00
grafana-delivery-bot[bot]
8395bda60f [v11.3.x] Alerting: Fix contact points secure settings migration (#97146)
Alerting: Fix contact points secure settings migration (#95787)

Add missing migration for secure settings, add types to notifiers mocks

(cherry picked from commit 3c8d29fa46)

Co-authored-by: Konrad Lalik <konradlalik@gmail.com>
2024-11-28 14:40:16 +01:00
grafana-delivery-bot[bot]
f8dfaebf4c [v11.3.x] DashboardScene: Fix layout issues with repeated panels when repeatDirection is missing (#97156)
DashboardScene: Fix layout issues with repeated panels when `repeatDirection` is missing (#97149)

fix

(cherry picked from commit 0bf9d68070)

Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
2024-11-28 14:48:02 +02:00
grafana-delivery-bot[bot]
1c201629d5 [v11.3.x] Docs: Fix broken link (#97121)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Fix broken link (#97119)
2024-11-27 12:07:19 -05:00
grafana-delivery-bot[bot]
37858e7e24 [v11.3.x] Docs: Add note to refresh page after saving dashboards (#97114)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-27 11:28:46 -05:00
grafana-delivery-bot[bot]
60370b4ea6 [v11.3.x] Docs: Add column lists to panel config pages (#97111)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-27 10:37:12 -05:00
Sergej-Vlasov
70c37c9b03 Update scenes to v5.26.0 (#96968) (#97089)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit b23805a78a)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-27 13:38:19 +00:00
Sergej-Vlasov
55cb58b8be Update scenes to v5.25.1 (#96782) (#97086)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit 68e7f6069c)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-27 09:53:29 +00:00
Sergej-Vlasov
1695d2716f Update scenes to v5.25.0 (#96463) (#97060)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit 8375fcd350)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-27 09:06:10 +00:00
Sergej-Vlasov
9ab6d23f77 Update scenes to v5.23.1 (#95951) (#97050)
* Update scenes to v5.23.1

* Fix e2e tests

* Fix unit tests

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Bogdan Matei <bogdan.matei@grafana.com>
(cherry picked from commit 70c21a2e4d)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-26 15:43:57 +00:00
Sergej-Vlasov
13e8921d27 Update scenes to v5.22.1 (#95655) (#97047)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit b4012b6ac8)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-26 14:58:43 +00:00
grafana-delivery-bot[bot]
d0e5c87992 [v11.3.x] [DOC] Remove simple configuration in Tempo data source docs (#97002)
[DOC] Remove simple configuration in Tempo data source docs (#96932)

* Remove simple configuration from Tempo data source docs

* Change deprecation to 11.5 for aggregate by

* Update docs/sources/shared/datasources/tempo-search-traceql.md

(cherry picked from commit 18c8ed3088)

Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com>
2024-11-25 21:11:36 -05:00
grafana-delivery-bot[bot]
4cb555fa8b [v11.3.x] Docs: Add correlations youtube link to What's new (#95281)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-25 10:07:12 -05:00
Alexander Akhmetov
98be4ac047 [v11.3.x] Alerting: Update state manager to have immutable state in cache (#96843)
* Alerting: Update state manager to have immutable state in cache (#95985)

* create a new state and set at the end
* propagate labels datasource_uid and ref_id from current state if it's error
* copy the state when apply to all

(cherry picked from commit 420db99d16)

* Remove unused states variables

---------

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-11-25 15:22:40 +01:00
Kevin Minehart
9c7c333856 [v11.3.x] CI: Add github app token generation in pipelines that use GITHUB_TOKEN (#96874)
CI: Add github app token generation in pipelines that use GITHUB_TOKEN (#96646)

* Add github app token generation in pipelines that use GITHUB_TOKEN

* ci?

* clone gh repo using x-access-token user

* address linting issues

* use mounted volume for exporting token

* remove unused github_token env var swagger gen step

* replace pat on release_pr pipepline

* cleanup GH PAT references

* linting

* Update scripts/drone/steps/lib.star

* make drone

---------

Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
(cherry picked from commit 2400483d6c)
2024-11-21 21:08:48 -06:00
Jacob Valdez
d15321179e [v11.3.x] Docs: Removing outdated versioning info in create reports (#96808)
Docs: Removing outdated versioning info in create reports (#96804)

Removing outdated versioning info in create reports

(cherry picked from commit e6a771cf4a)

Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-21 15:28:19 -06:00
grafana-delivery-bot[bot]
f0e56bdf64 [v11.3.x] Docs: Update InfluxDB data source documentation (#96864)
Docs:  Update InfluxDB data source documentation (#96343)

* created config doc, made initial changes

* initial draft of config doc completed

* additional edits

* moved config doc into directory, renamed

* made additional updates

* template variables updates/cleanup

* cleaned up intro page, some more minor edits

* edited and re-formatted configure the data source doc

* final edits

* more edits

* minor changes prior to PR

* fix typo

* Update docs/sources/datasources/influxdb/_index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/_index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/_index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/_index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/_index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/query-editor/index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/query-editor/index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/template-variables/index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/query-editor/index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/configure-influxdb-data-source/_index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* Update docs/sources/datasources/influxdb/query-editor/index.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

* updates based on feedback

* ran prettier

---------

Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
(cherry picked from commit 26be86ee15)

Co-authored-by: Larissa Wandzura <126723338+lwandz13@users.noreply.github.com>
2024-11-21 13:48:12 -06:00
grafana-delivery-bot[bot]
bc89fe04b9 [v11.3.x] Alerting docs: fix data source link (#96844)
Alerting docs: fix data source link (#96819)

* Alerting docs: fix data source link

* updates

* corrects menu path

* correct pattern destination

(cherry picked from commit b392a44737)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-21 15:10:28 +01:00
grafana-delivery-bot[bot]
e3367ccf9a [v11.3.x] Scenes: Fix angular migrations that are using the targets property on the old panel model (#96831)
Scenes: Fix angular migrations that are using the targets property on the old panel model (#96626)

Fix angular migrations using target

(cherry picked from commit 5986b03a8f)

Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
2024-11-21 13:32:12 +01:00
grafana-delivery-bot[bot]
dfb1f9a3c1 [v11.3.x] Docs: stat visualization refactor (#96801)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-20 15:40:58 -05:00
grafana-delivery-bot[bot]
f5cf121eb5 [v11.3.x] Docs: Moved and renamed navigation section (#96797)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-20 15:25:33 -05:00
grafana-delivery-bot[bot]
64b556c137 [v11.3.x] Added docket tag note to security section (#96726)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: margotphelps <123196595+margotphelps@users.noreply.github.com>
2024-11-19 15:45:02 -05:00
github-actions[bot]
8d6bbb7a4b Release: 11.3.1 (#96714)
* Update changelog

* Update version to 11.3.1

* Update version

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-11-19 18:36:29 +00:00
Isabel Matwawana
08e10ff665 [v11.3.x] Docs: Node graph visualization refactor (#96707) 2024-11-19 11:40:10 -05:00
grafana-delivery-bot[bot]
13d60c9bd4 [v11.3.x] Docs: Logs visualization refactor (#96637)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-18 10:22:53 -05:00
grafana-delivery-bot[bot]
96d1d5a07b [v11.3.x] Alerting docs: fix query syntax sentence (#96618)
Alerting docs: fix query syntax sentence (#96614)

* Alerting docs: fix query syntax sentence

* updates sentence

* pepes feedback

(cherry picked from commit d187716e73)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-18 12:26:24 +01:00
grafana-delivery-bot[bot]
c97b64e9ff [v11.3.x] Docs: Added New Release Dates,Security Versioning and Freezes (#96571)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Isabel Matwawana <isabel.matwawana@grafana.com>
Co-authored-by: margotphelps <123196595+margotphelps@users.noreply.github.com>
2024-11-15 11:09:33 -05:00
grafana-delivery-bot[bot]
54eca5c73f [v11.3.x] Docs: Bar chart visualization refactor (#96560)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-15 10:09:40 -05:00
grafana-delivery-bot[bot]
4b634e887d [v11.3.x] Docs: Plugin Installation - reorganize and add air-gapped environments (#96533)
Docs: Plugin Installation - reorganize and add air-gapped environments (#96437)

* rewriting installation docs and including info about airgapped environments

* Changing example to lokieexplore app

* run prettier

* adding corrections

* running prettier

---------

Co-authored-by: Irene Rodriguez <irene.rodriguez@grafana.com>
(cherry picked from commit 0f4517df98)

Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
2024-11-15 13:55:27 +01:00
Konrad Lalik
9225f4a1cb [v11.3.x] Alerting: Add useReturnTo hook to safely handle returnTo parameter (#96481)
Alerting: Add useReturnTo hook to safely handle returnTo parameter (#96474)

Add useReturnTo hook to safely handle returnTo parameter

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
(cherry picked from commit 54cc666aa0)

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>
2024-11-15 10:10:37 +02:00
grafana-delivery-bot[bot]
a09dcda92d [v11.3.x] Alerting: Fix per-receiver RBAC for receivers with long names (#95165)
Alerting: Fix per-receiver RBAC for receivers with long names (#95084)

* Implement uidToResourceID

* add middleware

* Move uidToResourceID to alerting package

* Only hash uid if it's too long

* Use hashed uid in access control

* Move ReceiverUidToResourceId to ScopeProvider

* resolve uid in middleware only if param exists

* Tests

* Linting

---------

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
(cherry picked from commit 4aad44e848)

Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
2024-11-14 13:01:31 -05:00
grafana-delivery-bot[bot]
a6bc76df32 [v11.3.x] Docs: Add canvas custom images and icon guidance (#96470)
Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-14 11:02:48 -05:00
grafana-delivery-bot[bot]
d5cbf07090 [v11.3.x] Docs/adding information on using variable expansion and env variable for TLS certs when provisioning data sources (#96471)
Docs/adding information on using variable expansion and env variable for TLS certs when provisioning data sources (#96400)

Docs/adding information on using variable expansion and env variables for TLS certs when provisioning data sources

(cherry picked from commit 28ad9684e9)

Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-11-14 17:36:23 +02:00
kay delaney
d32c02ae14 [v11.3.x] Dashboard datasource: Return annotations as series when query topic is "annotations" (#95971)
Dashboard datasource: Return annotations as series when query topic is "annotations" (#95965)

(cherry picked from commit 26b0e8f105)
2024-11-14 14:45:17 +00:00
grafana-delivery-bot[bot]
d815e1107d [v11.3.x] Alerting docs: adds cloud alert rule limits (#96442)
Alerting docs: adds cloud alert rule limits (#96441)

(cherry picked from commit 14d868a791)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-14 12:38:07 +02:00
Victor Marin
700f59a0ea [v11.3.x] Fix dashboards listing table appearing distorted (#96390)
Fix dashboards listing table appearing distorted (#96371)

* fix CSS

* approx height calc to account for header div

(cherry picked from commit 19c04168c3)
2024-11-14 09:37:27 +02:00
grafana-delivery-bot[bot]
a6cdb48249 [v11.3.x] Docs: Add auth entries to what's new 11.2 (#96394)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-11-13 09:29:15 -05:00
grafana-delivery-bot[bot]
ecf127c0fa [v11.3.x] Docs/removing outdated versioning info in OSS data source docs (#96352)
Docs/removing outdated versioning info in OSS data source docs (#96351)

docs/removing outdated versioning info in oss data source docs

(cherry picked from commit f83f7332a1)

Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-11-12 15:02:20 -06:00
lean.dev
9241bc5f5c [v11.3.x] MigrationAssistant: Restrict dashboards, folders and datasources by the org id of the signed in user (#96345)
apply security patch: v11.3.x/194-202410181505.patch
2024-11-12 16:33:00 -03:00
github-actions[bot]
a2b1cda210 Release: 11.3.0+security-01 (#96295)
* Update changelog

* add relevant CVE fix to the changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com>
2024-11-12 16:01:43 +00:00
grafana-delivery-bot[bot]
50762226a0 [v11.3.x] docs: Fixed title wording from bar gauge to canvas (#96319)
Co-authored-by: Señor Performo - Leandro Melendez <54183040+srperf@users.noreply.github.com>
Fixed title wording from bar gauge to canvas (#96312)
2024-11-12 10:13:31 -05:00
grafana-delivery-bot[bot]
58333e0507 [v11.3.x] Alerting: Fix setting datasource uid, when datasource is string in old version (#96273)
Alerting: Fix setting datasource uid, when datasource is string in old version (#96085)

fix setting datasource uid, when datasource is string in old versions rules

(cherry picked from commit 2f58311eea)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-11-12 14:23:44 +01:00
Adela Almasan
5cc78ea219 [v11.3.x] Actions: Fix interpolation (#96247)
øActions: Fix interpolation  (#96161)

(cherry picked from commit 754351273b)
2024-11-12 07:21:59 -06:00
grafana-delivery-bot[bot]
a8cb62f05a [v11.3.x] Alerting docs: adds prereqs to configure data source (#96274)
Alerting docs: adds prereqs to configure data source (#96272)

* Alerting docs: adds prereqs to configure data source

* fixes numbering

(cherry picked from commit 35572c9731)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-12 11:59:30 +01:00
grafana-delivery-bot[bot]
89ea2a15ce [v11.3.x] docs: Update CanvasDoc adding video link (#95994)
docs: Update CanvasDoc adding video link (#95953)

Update CanvasDoc adding video link

(cherry picked from commit cd3a71e7cb)

Co-authored-by: Señor Performo - Leandro Melendez <54183040+srperf@users.noreply.github.com>
2024-11-11 15:14:34 +01:00
grafana-delivery-bot[bot]
5e1479d887 [v11.3.x] Alerting docs: fixes broken oncall link (#96217)
Alerting docs: fixes broken oncall link (#96215)

(cherry picked from commit ca04cf780b)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-11 14:08:58 +01:00
grafana-delivery-bot[bot]
f1c4e83865 [v11.3.x] Flame Graph: Fix crash when it receives empty data (#96211)
Flame Graph: Fix crash when it receives empty data (#95604)

flame graph crash

(cherry picked from commit 3012d4c043)

Co-authored-by: jackyin <yincong@baidu.com>
2024-11-11 13:00:23 +00:00
grafana-delivery-bot[bot]
cfa3ef73a1 [v11.3.x] Alerting docs: updates to landing page (#96214)
Alerting docs: updates to landing page (#96200)

* Alerting docs: updates to landing page

* Update docs/sources/alerting/_index.md

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>

---------

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
(cherry picked from commit 19bed65d9b)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-11 13:45:21 +01:00
grafana-delivery-bot[bot]
c99c8c56e2 [v11.3.x] Alerting docs: Move Meta monitoring to Additional configuration section (#96207)
Alerting docs: Move `Meta monitoring` to `Additional configuration` section (#96150)

(cherry picked from commit 154a2e0d06)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-11 11:23:50 +01:00
grafana-delivery-bot[bot]
5b1a386dac [v11.3.x] BarChart: Fix threshold lines rendering for horizontal orientation (#96137)
BarChart: Fix threshold lines rendering for horizontal orientation (#95737)

* Use different threshold x/y coordinates depending on orientation

* invert wording / semantics

---------

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
(cherry picked from commit 95692b3d68)

Co-authored-by: Kristina <kristina.durivage@grafana.com>
2024-11-09 13:45:03 -06:00
Fayzal Ghantiwala
8bc0014845 [v11.3.x] Alerting: Make context deadline on AlertNG service startup configurable (#96135)
Alerting: Make context deadline on AlertNG service startup configurable (#96053)

* Make alerting context deadline configurable

* Remove debug logs

* Change default timeout

* Update tests

(cherry picked from commit 1fdc48faba)
2024-11-08 16:46:50 +00:00
grafana-delivery-bot[bot]
8f10dbe12d [v11.3.x] Alerting: Fix editing expressions refId (#95035)
Alerting: Fix editing expressions refId (#94941)

Fix refId editing

(cherry picked from commit 836881b713)

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
2024-11-08 16:54:01 +01:00
grafana-delivery-bot[bot]
546e0e214b [v11.3.x] Alerting: Force refetch prom rules when refreshing panel (#96125)
Alerting: Force refetch prom rules when refreshing panel (#96120)

Force refetch prom rules when refreshing panel

(cherry picked from commit ea0a6a1f7f)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-11-08 16:36:51 +01:00
grafana-delivery-bot[bot]
3704073e6f [v11.3.x] Alerting docs: reuse Additional configuration page for Cloud docs (#96121)
Alerting docs: reuse `Additional configuration` page for Cloud docs (#96101)

(cherry picked from commit b953190328)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-08 16:19:04 +01:00
grafana-delivery-bot[bot]
c9c1bbfa6e [v11.3.x] Alerting docs: changes advanced to additional (#96092)
Alerting docs: changes advanced to additional (#96083)

(cherry picked from commit 86bc087257)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-08 14:32:30 +02:00
grafana-delivery-bot[bot]
402b023b45 [v11.3.x] Alerting docs: adds advanced config section (#96050)
Alerting docs: adds advanced config section (#96013)

* Alerting docs: adds advanced config section

* corrects ref

* feedback from pepe

* renames detect and respond

(cherry picked from commit b2af163dc5)

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
2024-11-08 09:58:18 +01:00
grafana-delivery-bot[bot]
be895603c8 [v11.3.x] Docs: clarify the description of actions_allow_post_url (#96045)
Docs: clarify the description of actions_allow_post_url (#95995)

* Docs: clarify the description of actions_allow_post_url

* adding a word to clarify this extends the default behavior and doesn't replace it

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Beverly Buchanan <131809838+BeverlyJaneJ@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Beverly Buchanan <131809838+BeverlyJaneJ@users.noreply.github.com>

---------

Co-authored-by: Beverly Buchanan <131809838+BeverlyJaneJ@users.noreply.github.com>
(cherry picked from commit 4cc204affe)

Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-11-07 10:15:59 -06:00
grafana-delivery-bot[bot]
c2d85230b1 [v11.3.x] Alerting docs: Introduction - brief overview of notification messages. (#96042)
Alerting docs: Introduction - brief overview of notification messages. (#95987)

* Intro: simplify `Architecture`. Add a new guideline

* Define `Notification policies` as an advanced option

* Intro: include about "Notification messages"

* Minor copy changes

(cherry picked from commit ff2f612412)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-07 16:51:12 +01:00
Jack Westbrook
3824dc412d [v11.3.x] Chore: Resolve duplicate e2e-selectors packages to workspace (#94945)
chore(yarn): resolve scenes e2e selectors to workspace version
2024-11-07 16:40:35 +01:00
grafana-delivery-bot[bot]
0e0a2c0371 [v11.3.x] Alerting: Fix saving advanced mode toggle state in the alert rule editor (#95981)
Alerting: Fix saving advanced mode toggle state in the alert rule editor (#95924)

(cherry picked from commit 4ce1abc6f9)

Co-authored-by: Alexander Akhmetov <me@alx.cx>
2024-11-06 19:04:59 +01:00
grafana-delivery-bot[bot]
8273628550 [v11.3.x] Alerting docs: specify using multiple contact point integrations in the UI and HTTP API (#95967)
Alerting docs: specify using multiple contact point integrations in the UI and HTTP API (#95890)

* Sort list of contact points on the sidebar

* Update `Configure contact points` to clarify contact point integrations

* Alerting HTTP API: fix `EmbeddedContactPoint` properties table

* HTTP Alerting API: clarify how `ContactPoint.name` groups contact points

* Update docs/sources/alerting/configure-notifications/manage-contact-points/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit 290612e366)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-06 15:45:52 +01:00
grafana-delivery-bot[bot]
d489ecf794 [v11.3.x] Dashboard: Append orgId to URL (#95963)
Dashboard: Append orgId to URL (#95960)

(cherry picked from commit 52f4bd64e0)

Co-authored-by: Bogdan Matei <bogdan.matei@grafana.com>
2024-11-06 16:28:37 +02:00
grafana-delivery-bot[bot]
16411b1b4a [v11.3.x] ServerLock: Fix pg concurrency/locking issue (#95935)
ServerLock: Fix pg concurrency/locking issue (#95916)

Fix pg unique constraint validation in serverlock

(cherry picked from commit ab974ddf14)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2024-11-06 11:09:20 +02:00
grafana-delivery-bot[bot]
8567089ed2 [v11.3.x] Docs: Updating steps for pulling Grafana metrics into Prometheus (#95918)
Docs: Updating steps for pulling Grafana metrics into Prometheus (#95913)

* Docs: Updating steps for pulling Grafana metrics into Prometheus

* slight update based on review

(cherry picked from commit 9a1e7de79d)

Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-11-06 00:17:12 +02:00
grafana-delivery-bot[bot]
1100a0409f [v11.3.x] [DOC] Add Pyroscope to list of products (#95911)
[DOC] Add Pyroscope to list of products (#95884)

* Add Pyroscope to list of products

* Update docs/sources/shared/basics/what-is-grafana.md

* Apply suggestions from code review

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Bryan Huhta <32787160+bryanhuhta@users.noreply.github.com>

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Bryan Huhta <32787160+bryanhuhta@users.noreply.github.com>
(cherry picked from commit 78c5fe61df)

Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com>
2024-11-05 15:00:20 -05:00
grafana-delivery-bot[bot]
a7c1f37435 [v11.3.x] Azure: Handle namespace request rejection (#95909)
Azure: Handle namespace request rejection (#95574)

Handle rejection and add test

(cherry picked from commit da1a5426d0)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-11-05 21:06:30 +02:00
grafana-delivery-bot[bot]
cbf9e323b6 [v11.3.x] Docs: updating auto_refresh_license information (#95902)
Docs: updating auto_refresh_license information (#95804)

(cherry picked from commit a8578484bb)

Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-11-05 18:38:53 +01:00
grafana-delivery-bot[bot]
0826aa0078 [v11.3.x] Alerting docs: Update Create alert rules from panels (#95818)
Alerting docs: Update `Create alert rules from panels` (#95566)

* Alerting docs: Update `Create alert rules from panels`

* Remove screenshots except when the panel displays alert status

* Further changes sync with Brenda

* minor changes

* Relocate admonition

* Specify `dashboardUId` and `panelId` must be set together

* Update docs/sources/alerting/alerting-rules/link-alert-rules-to-dashboards.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* change title

* change URL

* fix spell error

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit facca37f4d)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-05 10:13:57 +01:00
grafana-delivery-bot[bot]
9bb7d77cdb [v11.3.x] Timeseries: Utilize min/max on stacking percentage (#95793)
Timeseries: Utilize min/max on stacking percentage (#95581)

* Bring in defined min/max into stacking range

* simplify logic

* different approach

---------

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
(cherry picked from commit 68aefc73b6)

Co-authored-by: Kristina <kristina.durivage@grafana.com>
2024-11-04 15:09:28 -06:00
grafana-delivery-bot[bot]
e31c4fc59b [v11.3.x] Alerting: Fix contact points secrets validation (#95777)
Alerting: Fix contact points secrets validation (#95651)

Add new condition to the determineRequired function

(cherry picked from commit e43bec2cd8)

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
2024-11-04 15:10:03 +01:00
grafana-delivery-bot[bot]
28f9eb3221 [v11.3.x] Alerting docs: add Time type documentation for notification templates (#95776)
Alerting docs: add `Time` type documentation for notification templates (#95688)

* Improve `tz` and `date` docs

* Add documentation for `Time` type

(cherry picked from commit 9d937725ad)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-04 12:48:55 +01:00
grafana-delivery-bot[bot]
693ed6dddd [v11.3.x] Alerting docs: fix alertname label name (#95767)
Alerting docs: fix `alertname` label name (#95665)

(cherry picked from commit 8a0c920106)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-04 10:54:58 +01:00
grafana-delivery-bot[bot]
8f030aa210 [v11.3.x] Alerting docs: Add one notification template example that prints a title or subject (#95766)
Alerting docs: Add one notification template example that prints a title or subject (#95680)

(cherry picked from commit d3a3e53354)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-11-04 10:54:40 +01:00
grafana-delivery-bot[bot]
ef12cfe67d [v11.3.x] E2E: remove duplicate loki e2e tests (#95667)
E2E: remove duplicate loki e2e tests (#95644)

* remove duplicate loki e2e tests to avoid flakiness

* unskip test

* adjust panel ids

(cherry picked from commit 9f5258717e)

Co-authored-by: Sergej-Vlasov <37613182+Sergej-Vlasov@users.noreply.github.com>
2024-11-01 09:56:38 +00:00
grafana-delivery-bot[bot]
4f80c4c55c [v11.3.x] Unified Storage: Use ssl_mode instead of sslmode (#95662)
Unified Storage: Use ssl_mode instead of sslmode (#95658)

change unistore to use ssl_mode instead of sslmode

(cherry picked from commit 76b43267c8)

Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2024-10-31 15:30:34 +00:00
grafana-delivery-bot[bot]
66518db34c [v11.3.x] Docs: Updating versions in activating AWS marketplace license (#95656)
Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-10-31 15:08:25 +01:00
grafana-delivery-bot[bot]
855dcd7b7b [v11.3.x] Migration: Remove table aliasing in delete statement to make it work for mariadb (#95232)
Migration: Remove table aliasing in delete statement to make it work for mariadb (#95226)

Migration: remove table aliasing in delete statement to make it work in mariadb
(cherry picked from commit 6f7528f896)

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2024-10-31 07:51:27 +00:00
grafana-delivery-bot[bot]
ab85eacea6 [v11.3.x] Docs: adding SAML name parameter configuration info (#95621)
Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-10-30 18:03:22 +01:00
grafana-delivery-bot[bot]
11aedea347 [v11.3.x] Graphite: Fix Multi Dimensional Alias Name (#95618)
Graphite: Fix Multi Dimensional Alias Name (#94563)

(cherry picked from commit 89da7d6fe5)

Co-authored-by: Alyssa (Bull) Joyner <58453566+alyssabull@users.noreply.github.com>
2024-10-30 16:12:41 +00:00
grafana-delivery-bot[bot]
fdc1859d0d [v11.3.x] GCM: Fix error checking for GCE project getter (#95617)
GCM: Fix error checking for GCE project getter (#95613)

Appropriately check error

(cherry picked from commit 08e880a823)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-10-30 15:50:25 +00:00
grafana-delivery-bot[bot]
1540c767cc [v11.3.x] Folders: Don't show error pop-up if the user can't fetch the root folder (#95600)
Folders: Don't show error pop-up if the user can't fetch the root folder (#95569)

don't show error pop-up if the user can't read general folder

(cherry picked from commit 092a1813ef)

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-10-30 11:06:06 +00:00
grafana-delivery-bot[bot]
7f36355451 [v11.3.x] Remove second aliases section (#95595)
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2024-10-30 10:00:21 +00:00
grafana-delivery-bot[bot]
397c96c1cc [v11.3.x] Docs: Adding memory requirements to image renderer docs (#95572)
Docs: Adding memory requirements to image renderer docs (#95571)

Adding memory requirements to image renderer docs

(cherry picked from commit d480900a9b)

Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
2024-10-29 13:10:44 -05:00
grafana-delivery-bot[bot]
13336dd198 [v11.3.x] Alerting docs: Update Recording Rules (#95535)
Alerting docs: Update Recording Rules (#95435)

* WIP - Restructure recording rule pages

* Add more `Recording rules` use cases

* Update `Intro > Alert rules`. Minor style changes and updates to the recording rules section

* Minor verb change

* Switch `aliases` and fix broken link

* Bold for clarity

* Complete `Create recording rules in Grafana Alerting`

* Complete data source-managed recording rules

* Final update

(cherry picked from commit 9b91be739d)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-10-29 09:58:35 +01:00
grafana-delivery-bot[bot]
cb5df488a8 [v11.3.x] Replace myself with Irene who oversees Grafana documentation (#95494)
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2024-10-28 15:35:58 +02:00
grafana-delivery-bot[bot]
5af40ed44f [v11.3.x] User: Check SignedInUser OrgID in RevokeInvite (#95490)
User: Check SignedInUser OrgID in RevokeInvite (#95476)

Check SignedInUser OrgID in RevokeInvite

(cherry picked from commit fedcf47702)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2024-10-28 14:42:19 +02:00
grafana-delivery-bot[bot]
c081bb53d0 [v11.3.x] Update _index.md (#95475)
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Jay <92761481+JayEkin@users.noreply.github.com>
2024-10-28 12:01:23 +02:00
grafana-delivery-bot[bot]
8ea5af7335 [v11.3.x] Update _index.md (#95470)
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Jay <92761481+JayEkin@users.noreply.github.com>
2024-10-28 11:28:27 +02:00
grafana-delivery-bot[bot]
d763aae5f2 [v11.3.x] Service Accounts: Run service account creation in transaction (#94803)
Service Accounts: Run service account creation in transaction (#94744)

* run service account creation DB queries in transaction

* extract the signed in user from the context

* undo unneeded change

* don't error out if a user is not found

* Update pkg/services/serviceaccounts/manager/service.go

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>

* Update pkg/services/serviceaccounts/manager/service.go

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

---------

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
(cherry picked from commit ca1fd028a2)

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-10-27 20:50:20 +01:00
Kevin Minehart
4a30c85b77 [v11.3.x] CI: Consolidate package and docker steps (#95419)
update .drone.yml
2024-10-25 12:44:15 -05:00
Drew Slobodnjak
a78607432e [v11.3.x] Table: Fix text wrapping applying to wrong field (#95425)
Table: Fix text wrapping applying to wrong field (#93707)

* Fix text wrap
---------

Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com>
(cherry picked from commit d7ee3ea086)

Co-authored-by: Kyle Cunningham <codeincarnate@users.noreply.github.com>
2024-10-25 08:55:39 -07:00
grafana-delivery-bot[bot]
12a54c2414 [v11.3.x] Docs: Fix shared file references (#95289)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Fix shared file references (#95287)
2024-10-25 11:15:23 -04:00
grafana-delivery-bot[bot]
bb4e253c76 [v11.3.x] Docs: Table visualization update (#95286)
Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com>
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-10-25 11:09:50 -04:00
Kevin Minehart
90a562257c [v11.3.x] CI: Remove drone steps for building windows because its done in grafana-… (#95413)
CI: Remove drone steps for building windows because it's done in grafana-… (#95373)

Remove drone steps for building windows because it's done in grafana-build now

(cherry picked from commit 67b3848fd9)
2024-10-25 07:53:52 -06:00
grafana-delivery-bot[bot]
5889d680e9 [v11.3.x] Folders: Add admin permissions upon creation of a folder w. SA (#95365)
Folders: Add admin permissions upon creation of a folder w. SA (#95072)

* add admin permissions upon creation of a folder w. SA

* Update pkg/services/folder/folderimpl/folder.go

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

* Grant service account permissions for creation of dashboards

* Grant service account admin permissions upon creating a datasource

* fetch user using the userservice with the userid

* Revert "fetch user using the userservice with the userid"

This reverts commit 23cba78752.

* revert back to original datasource creation

---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
(cherry picked from commit 9ab064bfc5)

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
2024-10-25 08:51:09 +01:00
grafana-delivery-bot[bot]
86deb2b4c4 [v11.3.x] Auth: Increase name_id and session_id length to 1024 in user_external_session (#95360)
Auth: Increase name_id and session_id length to 1024 in user_external_session (#95352)

Increase name_id and session_id length to 1024

(cherry picked from commit b8b7c7901c)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2024-10-24 18:36:43 +03:00
grafana-delivery-bot[bot]
c5d7a954ef [v11.3.x] Alerting: Fix escaping of silence matchers in utf8 mode (#95347)
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
Fix escaping of silence matchers in utf8 mode (#95067)
2024-10-24 16:33:15 +03:00
kay delaney
54e5e6c1b5 [v11.3.x] Update scenes to v5.20.4 (#95337)
Update scenes to v5.20.4
2024-10-24 12:57:24 +01:00
grafana-delivery-bot[bot]
c99956285b [v11.3.x] Dashboards: Fixes performance issue expanding a row (#95321)
Dashboards: Fixes performance issue expanding a row  (#95311)

* DashboardScene: Optimize change detection

* Remove arg

* remove console log

(cherry picked from commit 3523289e98)

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2024-10-24 12:23:21 +03:00
grafana-delivery-bot[bot]
9d867a4441 [v11.3.x] Remove doc-validator requirement to run on all pull requests (#95316)
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2024-10-24 11:38:12 +03:00
grafana-delivery-bot[bot]
a9088a7bbb [v11.3.x] CI: use linux to build msi installers (#95292)
CI: use linux to build msi installers (#95215)

* Build the MSI installers using Linux and wine

(cherry picked from commit 66c728d26b)

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>
2024-10-23 14:51:29 -05:00
grafana-delivery-bot[bot]
7cf08ebaf9 [v11.3.x] Prometheus: Fix passing query timeout to upstream queries (#95264)
Prometheus: Fix passing query timeout to upstream queries (#95104)

* remove queryTimeout from constructor

* use queryTimeout for range and instant queries

* remove comment

* remove default query timeout

* fix linting

(cherry picked from commit 78a00d09cd)

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
2024-10-23 17:02:18 +02:00
grafana-delivery-bot[bot]
c76d97bb13 [v11.3.x] Azure: Fix duplicated traces in multi-resource trace query (#95247)
Azure: Fix duplicated traces in multi-resource trace query (#95156)

Use first resource as base resource for query

(cherry picked from commit 8bb7475e4f)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-10-23 15:24:33 +03:00
Pepe Cano
f8cb0ccb71 [v11.3.x] Alerting Docs: Update Alert rule and Notification Templating (#95242)
Alerting Docs: Update Alert rule and Notification Templating (#94069)

* Update links to the new location of the Templates intro page

* Set alert rule template structure

* Update the `Template notifications` structure/sidebar

* Move examples to examples pages

* Update menu titles and URL paths

* WIP reference

* added intro to examples.md

* reference page section intros

* examples title

* Template

* Continue Alert Template Reference

* example sections

* Almost finish with Reference page

* weight pages

* WIP - template variables Intro

* Edits Alert rule templates + Differences with notification templates

* examples-draft-2

* how to map annotations to notif templates

* examples v2

* moved example

* Continue Template annotations and labels

* Preview annotation templates

* Complete `Template annotations and labels`

* Update `Differences with notification templates`

* Polish a bit `Differences with notification tempaltes`

* added logic examples to `Examples`

* Finish sharing Template language

* Minor: set `anchor` link

* Minor edit

* Minor edit

* Minor changes

* Template language changes

* Document missing functions for alert rule templates

* 'Examples' v3

* `Examples` v3.1

* `Examples` v3.2

* added context/intro to `Examples`

* added a how to section to `Examples`

* moved legacy info in `Examples`

* added examples, sections in `Examples`

* formatting

* examples v5

* examples v5.1

* Complete update to `Notification template reference`

* Update `$values` description

* moved steps to `index`

* fixed urls

* removed section in `examples`

* added refs

* fixed urls

* refs fix

* blended the use case into the explanation

* Notification template reference: Minor readibility changes

* Edit `$value` in Alert rule template reference

* Edit `Manage notification templates

* links to ref and lang pages

* Minor copy changes

* Edit Template annotation overview + Prepare Template notifications overview

* `Select` vs `Choose`

* Template Overview

* Fix `heading` does not match `title`

* examples v6

* examples v6.1

* Fix spell errors

* Run `prettier --write` to fix md format errors

* examples v7

* examples v7.1

* examples v7.2

* examples v7.4

* examples v7.5

* examples v7.6

* all pretty, no pity

* Update alert rule examples

* Complete `Labels and annotations template examples`

* Minor changes

* Use `.` notation instead of `index` in examples

* rename `extendeddata` to `notificationdata`

* Complete Notification examples

* minor changes

* Set `go` language when displaying template examples

* Revert "minor changes"

This reverts commit f647c55c87.

* Update example and admonition for consistency

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/shared/alerts/template-language.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/shared/alerts/template-language.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/language.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/_index.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/examples.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/examples.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/examples.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/templates/examples.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/examples.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/configure-notifications/template-notifications/manage-notification-templates.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* use `add` instead of `enrich`

* fix prettier content errors

* minor copy change

* Specify which Alert properties are exclusive to Grafana-managed alerts

* Use `Monitor` instead of `Meta monitoring`

* Be more detailed about notifation template limitations

---------

Co-authored-by: tonypowa <tonypowa@gmail.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit 813632dff1)
2024-10-23 13:03:58 +02:00
grafana-delivery-bot[bot]
f702577e83 [v11.3.x] format datasources list with columns (#95234)
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: Robby Milo <robbymilo@fastmail.com>
2024-10-23 10:07:21 +01:00
grafana-delivery-bot[bot]
b8c43bcf3d [v11.3.x] Alerting docs: Update Labels and Annotations to detail use cases (#95221)
Alerting docs: Update `Labels and Annotations` to detail use cases (#95213)

* Alerting docs: Update `Labels and Annotations` to detail use cases

* Update docs/sources/alerting/fundamentals/alert-rules/annotation-label.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit 8072286daf)

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
2024-10-23 09:07:06 +02:00
grafana-delivery-bot[bot]
d865fa64ce [v11.3.x] Docs: Add what's new video (#95210)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-10-22 16:43:14 -04:00
Kevin Yu
a292f838fe fix changelog (#95208) 2024-10-22 13:09:39 -07:00
github-actions[bot]
50c5d806c1 Release: 11.3.0 (#95196)
* Update changelog

* Update version to 11.3.0

* bump @grafana/plugin-configs from 11.3.0-pre to 11.3.0

* update changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kevin Yu <kevinwcyu@users.noreply.github.com>
Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
2024-10-22 12:39:12 -07:00
grafana-delivery-bot[bot]
6d5fa7b7a0 [v11.3.x] Docs: Add Correlations entry to what's new (#95172)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-10-22 10:58:26 -04:00
grafana-delivery-bot[bot]
035f6dde73 [v11.3.x] Canvas: Fix data links target (#95171)
Canvas: Fix data links target (#95113)

(cherry picked from commit b2e53997e2)

Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com>
2024-10-22 17:54:54 +03:00
grafana-delivery-bot[bot]
494ddad79d [v11.3.x] Azure Monitor: Support metric namespaces fallback (#95155)
Azure Monitor: Support metric namespaces fallback (#94722)

* Update display names

* Update multi-resource types

* Update default metric namespace list

* Initialise namespace list with fallback namespaces

* Add test

* Update test

(cherry picked from commit 986bd2f9f8)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-10-22 16:39:56 +03:00
grafana-delivery-bot[bot]
2e81653b68 [v11.3.x] Anonymous User: Adds validator service for anonymous users (#94994)
Anonymous User: Adds validator service for anonymous users (#94700)

(cherry picked from commit 3438196010)

Co-authored-by: lean.dev <34773040+leandro-deveikis@users.noreply.github.com>
2024-10-22 09:26:00 -03:00
grafana-delivery-bot[bot]
6924b9641a [v11.3.x] Alerting: Fix overflow for long receiver names (#95133)
Alerting: Fix overflow for long receiver names (#95064)

(cherry picked from commit 94f5e21493)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2024-10-22 14:23:38 +02:00
grafana-delivery-bot[bot]
f68938c842 [v11.3.x] DashboardScene: Re-add support for default datasource var (#95138)
DashboardScene: Re-add support for default datasource var (#94806)

re-add support for default datasource var

(cherry picked from commit 96893aef2a)

Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
2024-10-22 13:52:01 +03:00
grafana-delivery-bot[bot]
c426f12df7 [v11.3.x] DashboardScene: Rerender dashboard links on timerange change (#95140)
DashboardScene: Rerender dashboard links on timerange change (#94570)

* fix

* refactor

* refactor

(cherry picked from commit aaba5a43bd)

Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
2024-10-22 13:49:07 +03:00
grafana-delivery-bot[bot]
bbc76071b5 [v11.3.x] DashboardScene: Update timerange in datalinks on change (#95137)
DashboardScene: Update timerange in datalinks on change (#94419)

* fix types

* mods

* refactor

* refactor

(cherry picked from commit 516e0cf7e2)

Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
2024-10-22 13:27:29 +03:00
grafana-delivery-bot[bot]
ca7156d411 [v11.3.x] DashboardScenes: Fix missing query options in library panels (#95132)
DashboardScenes: Fix missing query options in library panels (#94808)

Fix missing query options in library panels

(cherry picked from commit d608668335)

Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
2024-10-22 13:09:16 +03:00
grafana-delivery-bot[bot]
8e7ba6f123 [v11.3.x] Docs note on Cross-account observability permissions for CW datasource (#95125)
Co-authored-by: Jara Suárez de Puga García <jara.suarezdepuga@grafana.com>
2024-10-22 10:07:02 +01:00
grafana-delivery-bot[bot]
6e0e8d0370 [v11.3.x] Loki query editor: update CompletionDataProvider time range when it changes (#95127)
Loki query editor: update CompletionDataProvider time range when it changes (#94905)

* Loki query editor: update CompletionDataProvider time range when it changes

* CompletionDataProvider: update test and add regression

* Formatting

* Completion Data Provider: clear cache when the time range changes

* Completion Data Provider: specifically test for undefined values vs empty string

(cherry picked from commit 89c215a9ff)

Co-authored-by: Matias Chomicki <matyax@gmail.com>
2024-10-22 12:06:54 +03:00
grafana-delivery-bot[bot]
073436f2f8 [v11.3.x] [docs] fix provisioning folder name (#95101)
Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
fix provisioning folder name (#95099)
2024-10-21 23:43:52 +03:00
grafana-delivery-bot[bot]
367c82bd51 [v11.3.x] BarChart: Skip formatting null-valued ticks (#95094)
BarChart: Skip formatting null-valued ticks (#94935)

Co-authored-by: Ihor Yeromin <yeryomin.igor@gmail.com>
(cherry picked from commit 594e9b1b73)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
2024-10-21 22:48:13 +03:00
grafana-delivery-bot[bot]
a2db7105a9 [v11.3.x] Docs: What’s new & Upgrade guide v11.3 (#95088)
Co-authored-by: Mitch Seaman <mjseaman@users.noreply.github.com>
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
2024-10-21 15:20:12 -04:00
grafana-delivery-bot[bot]
bdf41feda9 [v11.3.x] Alerting: Fix remote Alertmanager readiness check path (#95066)
Alerting: Fix remote Alertmanager readiness check path (#95063)

(cherry picked from commit 4f8f82f5f1)

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2024-10-21 18:45:49 +03:00
grafana-delivery-bot[bot]
aa8c58abd0 [v11.3.x] Alerting: Fix templates editing validation (#94963)
* Alerting: Fix templates editing validation (#94960)

Fix title validation when editing template files

(cherry picked from commit 5548e5976b)

* Adjust tests

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
2024-10-21 10:52:10 +02:00
grafana-delivery-bot[bot]
48d083d495 [v11.3.x] Chore: Fix population of details when converting from errutil errors to K8s error (#94998)
Chore: Fix population of details when converting from errutil errors to K8s error (#94996)

(cherry picked from commit 672d5f92f2)

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-10-18 23:11:44 +03:00
grafana-delivery-bot[bot]
e0da40ea8c [v11.3.x] CloudWatch: Interpolate region in log context query (#94990)
CloudWatch: Interpolate region in log context query (#94930)

CloudWatch: interpolate region in log context query
(cherry picked from commit fd5f351a6f)

Co-authored-by: Isabella Siu <Isabella.siu@grafana.com>
2024-10-18 14:25:21 -04:00
grafana-delivery-bot[bot]
aba5388a42 [v11.3.x] Alerting: Fix time-interval conversion to return bad request if payload is incorrect (#94999)
Alerting: Fix time-interval conversion to return bad request if payload is incorrect (#94995)

(cherry picked from commit 00bb3215cb)

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-10-18 20:35:15 +03:00
Isabel Matwawana
48ce1636bd Revert "[v11.3.x] Revert some scenes documentation" (#94984) 2024-10-18 11:42:32 -04:00
Josh Hunt
71e980ee9a bump whatsnew url (#94982) 2024-10-18 18:32:07 +03:00
grafana-delivery-bot[bot]
060846d056 [v11.3.x] Dashboards: Links to explore should respect subpath (#94975)
Dashboards: Links to explore should respect subpath (#94525)

* Links to explore should respect subpath

* Change to using assureBaseUrl

* Change back to normal single quotes

(cherry picked from commit 315778227b)

Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
2024-10-18 17:38:26 +03:00
Sam Jewell
df57ba1b70 [v11.3.x] ServerSideExpressions: Disable SQL Expressions to prevent RCE and LFI vulnerability (#94955)
ServerSideExpressions: Disable SQL Expressions to prevent RCE and LFI vulnerability (#94942)

* disable sql expressions

remove duckdb ref

* Run `make update-workspace`

---------

Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
(cherry picked from commit ea71201ddc)
2024-10-18 12:46:53 +01:00
grafana-delivery-bot[bot]
4a800ace30 [v11.3.x] Docs: Update Grafana-Managed Recording Rule docs (#94908)
Docs: Update Grafana-Managed Recording Rule docs (#94895)

* Config ini section

* Extend header

* Drop hysteresis line which doesnt apply to recording rules

* Touch up evaluation behavior section

* Dissolve incorrect/unrelated section

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Run linter

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit be0d8b4f19)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
2024-10-17 16:43:29 -05:00
grafana-delivery-bot[bot]
a577031ba9 [v11.3.x] CI: Additional changes for +security versions (#94923)
CI: Additional changes for +security versions (#94854)

* Build: Fix docker manifest create not using correct IMAGE_TAG

* Support publishing security versions of NPM packages

---------

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
(cherry picked from commit 8f7352e862)

Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
2024-10-17 17:12:44 -03:00
grafana-delivery-bot[bot]
efeb05386b [v11.3.x] DataLinks: Fix onClick functionality (#94907)
DataLinks: Fix onClick functionality (#94815)

* fix: add onclick functionality back to DataLinks in VizPanelFooter

---------

Co-authored-by: Adela Almasan <adela.almasan@grafana.com>
Co-authored-by: Matias Chomicki <matyax@gmail.com>
(cherry picked from commit 5fe5e8a5a6)

Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com>
2024-10-17 20:27:29 +03:00
grafana-delivery-bot[bot]
1ac972f086 [v11.3.x] Revert some scenes documentation (#94903)
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2024-10-17 17:12:20 +01:00
grafana-delivery-bot[bot]
4590698e10 [v11.3.x] Alerting: Update texts for gm rr in the form (#94886)
Alerting: Update texts for gm rr in the form (#94844)

* Update texts for gm rr in the form

* fix translations

* Fix test

* address review comments

* address review comments - part2

* translations

* update docs for new term: output

(cherry picked from commit 1860737117)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-10-17 16:29:16 +02:00
grafana-delivery-bot[bot]
ab368bfb06 [v11.3.x] Alerting: Update docs for grafana recording rules (#94841)
Alerting: Update docs for grafana recording rules (#94811)

* update docs for grafana recording rules

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* remove notes

* fix note tag

* update note for grafana-managed feature toggle

* Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit f9ba4e3e5d)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-10-17 11:14:03 +02:00
grafana-delivery-bot[bot]
489c9db173 [v11.3.x] Geomap: Fix tooltip positioning when screen is scrolled (#94842)
Geomap: Fix tooltip positioning when screen is scrolled (#94827)

* account for y-scrolling when positioning geomap tooltip

* remove config import

(cherry picked from commit 241dca57cf)

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2024-10-17 12:02:13 +03:00
grafana-delivery-bot[bot]
8bbf0a1869 [v11.3.x] Update Pyroscope data source for Exlore Profiles (#94832)
Update Pyroscope data source for Exlore Profiles (#94825)

* Update Pyroscope data source for Exlore Profiles

* Update docs/sources/datasources/pyroscope/query-profile-data.md

* Update docs/sources/datasources/pyroscope/query-profile-data.md

(cherry picked from commit e8f23bb2cf)

Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com>
2024-10-16 20:57:07 -04:00
grafana-delivery-bot[bot]
8b8a67fad6 [v11.3.x] [DOC] Add streamingEnabled to Tempo ds docs (#94830)
[DOC] Add streamingEnabled to Tempo ds docs (#94751)

* Add streamingEnabled to Tempo ds docs

* Update docs/sources/datasources/tempo/configure-tempo-data-source.md

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>

---------

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
(cherry picked from commit 17eff37104)

Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com>
2024-10-16 16:53:37 -04:00
grafana-delivery-bot[bot]
2e956696a4 [v11.3.x] GCM: Time field naming (#94819)
GCM: Time field naming (#94548)

* Name time field correctly

* Update tests

* Lint

(cherry picked from commit 7c79f8f7a5)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2024-10-16 18:34:50 +03:00
grafana-delivery-bot[bot]
d58468b60b [v11.3.x] Plugins: Skip install errors if dependency plugin already exists (#94718)
Plugins: Skip install errors if dependency plugin already exists (#94710)

* skip install errors if dependency plugin already exists

* add test

(cherry picked from commit f97f489c2c)

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2024-10-16 13:13:41 +03:00
Kevin Minehart
d784d370d3 [v11.3.x] CI: Support more version formats in publishing (#94750)
CI: Support more version formats in publishing (#94575)

* cleanup dead code
* add tests and rewrite publish grafanacom steps to reuse
* add pkg/build tests; don't upload CDN assets on grafana releases

(cherry picked from commit 7a2edd35d5)
2024-10-15 13:57:07 -05:00
grafana-delivery-bot[bot]
d4beddfb0e [v11.3.x] Docs: Update alerting notifications documentation (#94733)
Docs: Update alerting notifications documentation  (#93944)

* add new permissions and fixed roles

* Apply suggestions from code review

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* address comments

* add actions to complete list

* fmt

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
(cherry picked from commit ced5497ba1)

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-10-15 11:20:31 -04:00
grafana-delivery-bot[bot]
ae3419cd79 [v11.3.x] Folders: Correctly show new folder button under root folder (#94713)
Folders: Correctly show new folder button under root folder (#94687)

show new folder button under root folder if nested folders are disabled and user has the right perms

(cherry picked from commit 284c2d6f71)

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-10-15 13:05:13 +03:00
grafana-delivery-bot[bot]
65c759c76a [v11.3.x] Fix list indentation to ensure continuous numbering (#94696)
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
Fix list indentation to ensure continuous numbering (#94692)
2024-10-14 19:27:48 +01:00
grafana-delivery-bot[bot]
e6475b80c2 [v11.3.x] Alerting: Use advanced options when query params are not transformable (#94670)
Alerting: Use advanced options when query params are not transformable (#94588)

* Use advanced options when query params are not transformable

* Update public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
(cherry picked from commit fb5fb76ad1)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-10-14 12:16:36 +02:00
grafana-delivery-bot[bot]
749714fe50 [v11.3.x] Create strategies-for-upgrading-grafana (#94635)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Irene Rodriguez <irene.rodriguez@grafana.com>
2024-10-11 17:33:50 +02:00
grafana-delivery-bot[bot]
e1a4fcda48 [v11.3.x] fix missing hyperlink to permissions page in docs (#94630)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Vishal N <vnaccounts@tutanota.com>
fix missing hyperlink to permissions page in docs (#94077)
2024-10-11 10:40:01 -04:00
grafana-delivery-bot[bot]
9af2af8b9f [v11.3.x] docs: added configure structure and youtube video link (#94629)
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Señor Performo - Leandro Melendez <54183040+srperf@users.noreply.github.com>
2024-10-11 10:30:42 -04:00
Jack Baldry
50de92f873 Revert Sharing documentation changes (#94585)
Fix Sharing page aliases (#94118)"
2024-10-11 14:58:36 +01:00
grafana-delivery-bot[bot]
2a7d8279a2 [v11.3.x] OrgSync: Do not set default Organization for a user to a non-existent Organization (#94613)
OrgSync: Do not set default Organization for a user to a non-existent Organization (#94537)

Do not set default org for a user to a missing org

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
(cherry picked from commit c872cad879)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2024-10-11 15:44:17 +03:00
grafana-delivery-bot[bot]
f5d29152c9 [v11.3.x] SSO: Fix client side validations for LDAP (#94596)
SSO: Fix client side validations for LDAP (#94561)

* fix client side validations for LDAP

* add translations for new messages

* simplify code in isInvalidField()

(cherry picked from commit 0bd3ad1d5a)

Co-authored-by: Mihai Doarna <mihai.doarna@grafana.com>
2024-10-11 13:04:31 +03:00
grafana-delivery-bot[bot]
c938b751cf [v11.3.x] Alerting: Fix detail view not showing instances nor history tab (#94586)
Alerting: Fix detail view not showing instances nor history tab (#94424)

* Fix detail view not showing instances nor history tab

* small refactor

* Update public/app/features/alerting/unified/hooks/useCombinedRule.ts

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>

* refactor

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
(cherry picked from commit 3924751827)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-10-11 11:12:17 +03:00
grafana-delivery-bot[bot]
f24f59225d [v11.3.x] Alerting: Fix getSimpleConditionFromExpressions (#94584)
Alerting: Fix getSimpleConditionFromExpressions (#94516)

fix getSimpleConditionFromExpressions

(cherry picked from commit 419598c745)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
2024-10-11 11:07:16 +03:00
grafana-delivery-bot[bot]
5f7e46f886 [v11.3.x] Explore metrics: set options directly because of scenes error when options not set (#94571)
Explore metrics: set options directly because of scenes error when options not set (#94284)

* scenes error when options not set

* add all of the options that are updated in onOptionsChange

* add options to all the other places we are building timeseries panels

* Update public/app/features/trails/AutomaticMetricQueries/graph-builders/percentiles.ts

Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>

* remove activation handlers and unused code

* Update public/app/features/trails/AutomaticMetricQueries/graph-builders/simple.ts

Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>

* Update public/app/features/trails/AutomaticMetricQueries/graph-builders/percentiles.ts

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>

---------

Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
(cherry picked from commit ce857c2680)

Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
2024-10-10 20:35:08 +03:00
467 changed files with 10500 additions and 11617 deletions

View File

@@ -1697,9 +1697,6 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "10"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "11"]
],
"public/app/features/alerting/unified/components/expressions/ExpressionStatusIndicator.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
],
"public/app/features/alerting/unified/components/extensions/AlertInstanceExtensionPointMenu.tsx:5381": [
[0, 0, 0, "Do not re-export imported variable (\`app/features/explore/extensions/ToolbarExtensionPointMenu\`)", "0"]
],
@@ -1935,8 +1932,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "10"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "11"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "12"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "13"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "14"]
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "13"]
],
"public/app/features/alerting/unified/components/rule-editor/NeedHelpInfo.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
@@ -2035,16 +2031,13 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "5"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "6"]
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"]
],
"public/app/features/alerting/unified/components/rule-editor/labels/LabelsFieldInForm.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"],
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"]
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"]
],
"public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPolicyMatchers.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],

View File

@@ -18,18 +18,10 @@ load(
"publish_packages_pipeline",
)
load("scripts/drone/events/rrc-patch.star", "rrc_patch_pipelines")
load(
"scripts/drone/pipelines/ci_images.star",
"publish_ci_windows_test_image_pipeline",
)
load(
"scripts/drone/pipelines/publish_images.star",
"publish_image_pipelines_public",
)
load(
"scripts/drone/pipelines/windows.star",
"windows_test_backend",
)
load(
"scripts/drone/rgm.star",
"rgm",
@@ -46,12 +38,7 @@ def main(_ctx):
publish_npm_pipelines() +
publish_packages_pipeline() +
rgm() +
[windows_test_backend({
"event": ["promote"],
"target": ["test-windows"],
}, "oss", "testing")] +
integration_test_pipelines() +
publish_ci_windows_test_image_pipeline() +
cronjobs() +
secrets()
)

1246
.drone.yml

File diff suppressed because it is too large Load Diff

8
.github/CODEOWNERS vendored
View File

@@ -38,17 +38,11 @@
/docs/.codespellignore @grafana/docs-tooling
/docs/sources/ @irenerl24
/docs/sources/administration/ @jdbaldry
/docs/sources/alerting/ @brendamuir
/docs/sources/dashboards/ @imatwawana
/docs/sources/datasources/ @jdbaldry
/docs/sources/explore/ @grafana/explore-squad @lwandz13
/docs/sources/fundamentals @irenerl24
/docs/sources/getting-started/ @irenerl24
/docs/sources/introduction/ @irenerl24
/docs/sources/panels-visualizations/ @imatwawana
/docs/sources/release-notes/ @Eve832 @GrafanaWriter
/docs/sources/setup-grafana/ @irenerl24
/docs/sources/release-notes/ @irenerl24 @GrafanaWriter
/docs/sources/upgrade-guide/ @imatwawana
/docs/sources/whatsnew/ @imatwawana

View File

@@ -1,13 +1,18 @@
name: "doc-validator"
on:
pull_request:
paths: ["docs/sources/**"]
workflow_dispatch:
inputs:
include:
description: |
Regular expression that matches paths to include in linting.
For example: docs/sources/(?:alerting|fundamentals)/.+\.md
required: true
jobs:
doc-validator:
runs-on: "ubuntu-latest"
container:
image: "grafana/doc-validator:v5.0.0"
image: "grafana/doc-validator:v5.2.0"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
@@ -15,15 +20,7 @@ jobs:
# Only run doc-validator on specific directories.
run: >
doc-validator
'--include=^docs/sources/(?:alerting|fundamentals|getting-started|introduction|setup-grafana|upgrade-guide|whatsnew/whats-new-in-v(?:9|10))/.+\.md$'
'--include=${{ inputs.include }}'
'--skip-checks=^(?:image.+|canonical-does-not-match-pretty-URL)$'
./docs/sources
/docs/grafana/latest
| reviewdog
-f=rdjsonl
--fail-on-error
--filter-mode=nofilter
--name=doc-validator
--reporter=github-pr-review
env:
REVIEWDOG_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -0,0 +1,49 @@
# Owned by grafana-delivery-squad
# Intended to be dropped into the base repo Ex: grafana/grafana
name: Dispatch check for patch conflicts
run-name: dispatch-check-patch-conflicts-${{ github.base_ref }}-${{ github.head_ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- "main"
- "v*.*.*"
- "release-*"
# Since this is run on a pull request, we want to apply the patches intended for the
# target branch onto the source branch, to verify compatibility before merging.
jobs:
dispatch-job:
runs-on: ubuntu-latest
steps:
- name: "Generate token"
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
# App needs Actions: Read/Write for the grafana/security-patch-actions repo
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
- name: "Dispatch job"
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'grafana',
repo: 'security-patch-actions',
workflow_id: 'test-patches-event.yml',
ref: 'main',
inputs: {
src_repo: "${{ github.repository }}",
src_ref: "${{ github.head_ref }}",
src_merge_sha: "${{ github.sha }}",
src_pr_commit_sha: "${{ github.event.pull_request.head.sha }}",
patch_repo: "${{ github.repository }}-security-patches",
patch_ref: "${{ github.base_ref }}",
triggering_github_handle: "${{ github.event.sender.login }}"
}
})

View File

@@ -1,27 +0,0 @@
# Owned by grafana-release-guild
# Intended to be dropped into the base repo Ex: grafana/grafana
name: Check for patch conflicts
run-name: check-patch-conflicts-${{ github.base_ref }}-${{ github.head_ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- "main"
- "v*.*.*"
- "release-*"
# Since this is run on a pull request, we want to apply the patches intended for the
# target branch onto the source branch, to verify compatibility before merging.
jobs:
trigger_downstream_patch_check:
uses: grafana/security-patch-actions/.github/workflows/test-patches.yml@main
if: github.repository == 'grafana/grafana'
with:
src_repo: "${{ github.repository }}"
src_ref: "${{ github.head_ref }}" # this is the source branch name, Ex: "feature/newthing"
patch_repo: "${{ github.repository }}-security-patches"
patch_ref: "${{ github.base_ref }}" # this is the target branch name, Ex: "main"
secrets: inherit

43
.github/workflows/sync-mirror-event.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
# Owned by grafana-delivery-squad
# Intended to be dropped into the base repo, Ex: grafana/grafana
name: Dispatch sync to mirror
run-name: dispatch-sync-to-mirror-${{ github.ref_name }}
on:
workflow_dispatch:
push:
branches:
- "main"
- "v*.*.*"
- "release-*"
# This is run after the pull request has been merged, so we'll run against the target branch
jobs:
dispatch-job:
runs-on: ubuntu-latest
steps:
- name: "Generate token"
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
# App needs Actions: Read/Write for the grafana/security-patch-actions repo
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
- uses: actions/github-script@v7
if: github.repository == 'grafana/grafana'
with:
github-token: ${{ steps.generate_token.outputs.token }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'grafana',
repo: 'security-patch-actions',
workflow_id: 'mirror-branch-and-apply-patches-event.yml',
ref: 'main',
inputs: {
src_ref: "${{ github.ref_name }}",
src_repo: "${{ github.repository }}",
src_sha: "${{ github.sha }}",
dest_repo: "${{ github.repository }}-security-mirror",
patch_repo: "${{ github.repository }}-security-patches"
}
})

View File

@@ -1,25 +0,0 @@
# Owned by grafana-release-guild
# Intended to be dropped into the base repo, Ex: grafana/grafana
name: Sync to mirror
run-name: sync-to-mirror-${{ github.ref_name }}
on:
workflow_dispatch:
push:
branches:
- "main"
- "v*.*.*"
- "release-*"
# This is run after the pull request has been merged, so we'll run against the target branch
jobs:
trigger_downstream_patch_mirror:
concurrency: patch-mirror-${{ github.ref_name }}
uses: grafana/security-patch-actions/.github/workflows/mirror-branch-and-apply-patches.yml@main
if: github.repository == 'grafana/grafana'
with:
ref: "${{ github.ref_name }}" # this is the target branch name, Ex: "main"
src_repo: "${{ github.repository }}"
dest_repo: "${{ github.repository }}-security-mirror"
patch_repo: "${{ github.repository }}-security-patches"
secrets: inherit

View File

@@ -1,3 +1,87 @@
<!-- 11.3.1 START -->
# 11.3.1 (2024-11-19)
### Features and enhancements
- **Alerting:** Make context deadline on AlertNG service startup configurable [#96135](https://github.com/grafana/grafana/pull/96135), [@fayzal-g](https://github.com/fayzal-g)
- **MigrationAssistant:** Restrict dashboards, folders and datasources by the org id of the signed in user [#96345](https://github.com/grafana/grafana/pull/96345), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **User:** Check SignedInUser OrgID in RevokeInvite [#95490](https://github.com/grafana/grafana/pull/95490), [@mgyongyosi](https://github.com/mgyongyosi)
### Bug fixes
- **Alerting:** Fix escaping of silence matchers in utf8 mode [#95347](https://github.com/grafana/grafana/pull/95347), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Fix overflow for long receiver names [#95133](https://github.com/grafana/grafana/pull/95133), [@gillesdemey](https://github.com/gillesdemey)
- **Alerting:** Fix saving advanced mode toggle state in the alert rule editor [#95981](https://github.com/grafana/grafana/pull/95981), [@alexander-akhmetov](https://github.com/alexander-akhmetov)
- **Alerting:** Fix setting datasource uid, when datasource is string in old version [#96273](https://github.com/grafana/grafana/pull/96273), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Force refetch prom rules when refreshing panel [#96125](https://github.com/grafana/grafana/pull/96125), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Anonymous User:** Adds validator service for anonymous users [#94994](https://github.com/grafana/grafana/pull/94994), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **Anonymous User:** Adds validator service for anonymous users (Enterprise)
- **Azure Monitor:** Support metric namespaces fallback [#95155](https://github.com/grafana/grafana/pull/95155), [@aangelisc](https://github.com/aangelisc)
- **Azure:** Fix duplicated traces in multi-resource trace query [#95247](https://github.com/grafana/grafana/pull/95247), [@aangelisc](https://github.com/aangelisc)
- **Azure:** Handle namespace request rejection [#95909](https://github.com/grafana/grafana/pull/95909), [@aangelisc](https://github.com/aangelisc)
- **CloudWatch:** Interpolate region in log context query [#94990](https://github.com/grafana/grafana/pull/94990), [@iwysiu](https://github.com/iwysiu)
- **Dashboard datasource:** Return annotations as series when query topic is "annotations" [#95971](https://github.com/grafana/grafana/pull/95971), [@kaydelaney](https://github.com/kaydelaney)
- **Dashboard:** Append orgId to URL [#95963](https://github.com/grafana/grafana/pull/95963), [@bfmatei](https://github.com/bfmatei)
- **Dashboards:** Fixes performance issue expanding a row [#95321](https://github.com/grafana/grafana/pull/95321), [@torkelo](https://github.com/torkelo)
- **Flame Graph:** Fix crash when it receives empty data [#96211](https://github.com/grafana/grafana/pull/96211), [@yincongcyincong](https://github.com/yincongcyincong)
- **Folders:** Add admin permissions upon creation of a folder w. SA [#95365](https://github.com/grafana/grafana/pull/95365), [@eleijonmarck](https://github.com/eleijonmarck)
- **Folders:** Don't show error pop-up if the user can't fetch the root folder [#95600](https://github.com/grafana/grafana/pull/95600), [@IevaVasiljeva](https://github.com/IevaVasiljeva)
- **Migration:** Remove table aliasing in delete statement to make it work for mariadb [#95232](https://github.com/grafana/grafana/pull/95232), [@kalleep](https://github.com/kalleep)
- **ServerLock:** Fix pg concurrency/locking issue [#95935](https://github.com/grafana/grafana/pull/95935), [@mgyongyosi](https://github.com/mgyongyosi)
- **Service Accounts:** Run service account creation in transaction [#94803](https://github.com/grafana/grafana/pull/94803), [@IevaVasiljeva](https://github.com/IevaVasiljeva)
- **Table:** Fix text wrapping applying to wrong field [#95425](https://github.com/grafana/grafana/pull/95425), [@codeincarnate](https://github.com/codeincarnate)
- **Unified Storage:** Use ssl_mode instead of sslmode [#95662](https://github.com/grafana/grafana/pull/95662), [@chaudyg](https://github.com/chaudyg)
<!-- 11.3.1 END -->
<!-- 11.3.0+security-01 START -->
# 11.3.0+security-01 (2024-11-12)
### Bug fixes
- **MigrationAssistant:** Fix Migration Assistant issue [CVE-2024-9476]
<!-- 11.3.0+security-01 END -->
<!-- 11.3.0 START -->
# 11.3.0 (2024-10-22)
### Features and enhancements
- **Alerting:** Add manage permissions UI logic for Contact Points [#92885](https://github.com/grafana/grafana/pull/92885), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Allow linking to silence form with `__alert_rule_uid__` value preset [#93526](https://github.com/grafana/grafana/pull/93526), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Hide query name when using simplified mode in the alert rule [#93779](https://github.com/grafana/grafana/pull/93779), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Limit and clean up old alert rules versions [#89754](https://github.com/grafana/grafana/pull/89754), [@igloo12](https://github.com/igloo12)
- **Alerting:** Style nits for the simple query mode [#93930](https://github.com/grafana/grafana/pull/93930), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Update texts in annotations step [#93977](https://github.com/grafana/grafana/pull/93977), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Use useProduceNewAlertmanagerConfiguration for contact points [#88456](https://github.com/grafana/grafana/pull/88456), [@gillesdemey](https://github.com/gillesdemey)
- **Auth:** Attach external session info to Grafana session [#93849](https://github.com/grafana/grafana/pull/93849), [@mgyongyosi](https://github.com/mgyongyosi)
- **Auth:** Replace jmespath/go-jmespath with jmespath-community/go-jmespath [#94203](https://github.com/grafana/grafana/pull/94203), [@mgyongyosi](https://github.com/mgyongyosi)
- **CloudMigrations:** Add support for migration of Library Elements (Panels) resources [#93898](https://github.com/grafana/grafana/pull/93898), [@macabu](https://github.com/macabu)
- **Cloudwatch:** Update grafana-aws-sdk [#94155](https://github.com/grafana/grafana/pull/94155), [@iwysiu](https://github.com/iwysiu)
- **Explore Logs:** Preinstall for onprem Grafana instances [#94221](https://github.com/grafana/grafana/pull/94221), [@svennergr](https://github.com/svennergr)
- **ExploreMetrics:** Ensure compatibility with Incremental Querying [#94355](https://github.com/grafana/grafana/pull/94355), [@NWRichmond](https://github.com/NWRichmond)
- **FieldConfig:** Add support for Actions [#92874](https://github.com/grafana/grafana/pull/92874), [@adela-almasan](https://github.com/adela-almasan)
- **Plugin Extensions:** Require meta-data to be defined in `plugin.json` during development mode [#93429](https://github.com/grafana/grafana/pull/93429), [@leventebalogh](https://github.com/leventebalogh)
- **Reporting:** Display template variables in the PDF (Enterprise)
- **Tempo:** Add deprecation notice for Aggregate By [#94050](https://github.com/grafana/grafana/pull/94050), [@joey-grafana](https://github.com/joey-grafana)
### Bug fixes
- **Alerting/Chore:** Fix TimeRangeInput not working across multiple months [#93622](https://github.com/grafana/grafana/pull/93622), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Fix default value for input in simple condition [#94248](https://github.com/grafana/grafana/pull/94248), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Fix eval interval not being saved when creating a new group [#93821](https://github.com/grafana/grafana/pull/93821), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93940](https://github.com/grafana/grafana/pull/93940), [@alexweav](https://github.com/alexweav)
- **Alerting:** Fix panics when attempting to create an Alertmanager after failing [#94023](https://github.com/grafana/grafana/pull/94023), [@santihernandezc](https://github.com/santihernandezc)
- **DashboardScene:** Fixes url issue with subpath when exiting edit mode [#93962](https://github.com/grafana/grafana/pull/93962), [@torkelo](https://github.com/torkelo)
- **Dashboards:** Enable scenes by default [#93818](https://github.com/grafana/grafana/pull/93818), [@ivanortegaalba](https://github.com/ivanortegaalba)
- **Dashboards:** Fixes view & edit keyboard shortcuts when grafana is behind a subpath [#93955](https://github.com/grafana/grafana/pull/93955), [@torkelo](https://github.com/torkelo)
- **ElasticSearch:** Fix errorsource in newInstanceSettings [#93859](https://github.com/grafana/grafana/pull/93859), [@iwysiu](https://github.com/iwysiu)
- **Reporting:** Fix reports on multi-org instance (Enterprise)
- **SubMenu:** Fix expanding sub menu items on touch devices [#93208](https://github.com/grafana/grafana/pull/93208), [@yincongcyincong](https://github.com/yincongcyincong)
<!-- 11.3.0 END -->
<!-- 11.2.2 START -->
# 11.2.2 (2024-10-01)

View File

@@ -1209,6 +1209,9 @@ enabled =
# Comma-separated list of organization IDs for which to disable unified alerting. Only supported if unified alerting is enabled.
disabled_orgs =
# Specify how long to wait for the alerting service to initialize
initialization_timeout = 30s
# Specify the frequency of polling for admin config changes.
# The interval string is a possibly signed sequence of decimal numbers, followed by a unit suffix (ms, s, m, h, d), e.g. 30s or 1m.
admin_config_poll_interval = 60s

View File

@@ -1197,6 +1197,9 @@
# Comma-separated list of organization IDs for which to disable unified alerting. Only supported if unified alerting is enabled.
;disabled_orgs =
# Specify how long to wait for the alerting service to initialize
;initialization_timeout = 30s
# Specify the frequency of polling for admin config changes.
# The interval string is a possibly signed sequence of decimal numbers, followed by a unit suffix (ms, s, m, h, d), e.g. 30s or 1m.
;admin_config_poll_interval = 60s

View File

@@ -15,6 +15,8 @@ weight: 250
LBAC for data sources is available in private preview on Grafana Cloud for Loki created with basic authentication. Loki data sources for LBAC for data sources can only be created, provisioning is currently not available.
You cannot configure LBAC rules for Grafana-provisioned data sources from the UI. Alternatively, you can replicate the setting of the provisioned data source in a new data source as described in [LBAC Configuration for New Loki Data Source](https://grafana.com/docs/grafana/latest/administration/data-source-management/teamlbac/configure-teamlbac-for-loki/#task-1-lbac-configuration-for-new-loki-data-source) and then add the LBAC configuration to the new data source.
## Before you begin
To be able to use LBAC for data sources rules, you need to enable the feature toggle `teamHttpHeaders` on your Grafana instance. Contact support to enable the feature toggle for you.

View File

@@ -35,9 +35,9 @@ To activate your license, complete the following tasks.
For more information about deploying an application on Amazon ECS, refer to [Creating an Amazon ECS service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service.html).
1. As you create the Amazon ECS service, use the Grafana Enterprise version 8.3.0 or later container image.
1. As you create the Amazon ECS service, use the intended Grafana Enterprise container image version.
For example, enter `grafana/grafana-enterprise:8.3.3`.
For example, enter `grafana/grafana-enterprise:11.3.0`.
> Only Grafana Enterprise versions 8.3.0 and later support licenses granted through AWS Marketplace.

View File

@@ -20,7 +20,7 @@ weight: 200
# Activate a Grafana Enterprise license from AWS Marketplace on EKS
If you have purchased a Grafana Enterprise subscription through AWS Marketplace, you must activate it in order to use Grafana Enterprise data source plugins and features in Grafana.
If you have purchased a Grafana Enterprise subscription through AWS Marketplace, you must activate it to use Grafana Enterprise data source plugins and features in Grafana.
## Before you begin:
@@ -37,9 +37,9 @@ To activate your license, complete the following tasks:
For more information about installing Grafana on Kubernetes using the Helm Chart, refer to the [Grafana Helm Chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#readme).
1. Use `kubectl set image deployment/my-release grafana=grafana/grafana-enterprise:<version>` to update the container image to Grafana Enterprise version 8.3.0 or later.
1. Use `kubectl set image deployment/my-release grafana=grafana/grafana-enterprise:<version>` to update the container image.
For example, enter `grafana/grafana-enterprise:8.3.3`.
For example, enter `grafana/grafana-enterprise:11.3.0`.
> Only Grafana Enterprise versions 8.3.0 and later support licenses granted through AWS Marketplace.

View File

@@ -103,53 +103,45 @@ To browse for available plugins:
### Install a plugin
To install a plugin:
The most common way to install a plugin is through the Grafana UI, but alternative methods are also available.
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Browse and find a plugin.
1. Click the plugin's logo.
1. Click **Install**.
When the update is complete, you'll see a confirmation message that the installation was successful.
There are also additional ways to install plugins depending on your setup.
### Update a plugin
#### Install a plugin using Grafana CLI
To update a plugin:
Grafana CLI allows you to install, upgrade, and manage your Grafana plugins using a command line. For more information about Grafana CLI plugin commands, refer to [Plugin commands]({{< relref "../../cli/#plugins-commands" >}}).
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the **Installed** filter to show only installed plugins.
1. Click the plugin's logo.
1. Click **Update**.
#### Install a plugin from a ZIP file
When the update is complete, you'll see a confirmation message that the update was successful.
This method is typically used for plugins not available in the Plugin Catalog or in environments without internet access.
### Uninstall a plugin
Download the archive containing the plugin assets, and install it by extracting the archive into the plugin directory. For example:
To uninstall a plugin:
```bash
unzip my-plugin-0.2.0.zip -d YOUR_PLUGIN_DIR/my-plugin
```
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the plugin's logo.
1. Click the **Installed** filter to show only installed plugins.
1. Click **Uninstall**.
The path to the plugin directory is defined in the configuration file. For more information, refer to [Configuration]({{< relref "../../setup-grafana/configure-grafana/#plugins" >}}).
When the update is complete, you'll see a confirmation message that the uninstall was successful.
#### Install a plugin in air-gapped environment
## Install Grafana plugins
Plugin installation usually requires an internet connection. You can check which endpoints are used during the installation on your instance and add them to your instances allowlist.
Grafana supports data source, panel, and app plugins.
If this is not possible you can go via installing a plugin using [Grafana CLI](#install-a-plugin-using-grafana-cli) or as a [ZIP file](#install-a-plugin-from-a-zip-file).
1. In a web browser, navigate to the [Grafana plugin catalog](https://grafana.com/plugins) and find a plugin that you want to install.
1. Click the plugin, and then click the **Installation** tab.
You can fetch any plugin from Grafana.com API following the download link referenced in the API.
Here is an example based on `grafana-lokiexplore-app` plugins.
### Install plugin on Grafana Cloud
1. Open `https://grafana.com/api/plugins/grafana-lokiexplore-app` and look for `links` section
1. Find a `download` url which looks something like `https://grafana.com/api/plugins/grafana-lokiexplore-app/versions/1.0.2/download`
1. Use this URL to download the plugin ZIP file, which you can then install as described above.
On the **Installation tab**, in the **For** field, click the name of the Grafana instance on which you want to install the plugin.
Grafana Cloud handles the plugin installation automatically.
If you're logged in to Grafana Cloud when you add a plugin, log out and then log back in again to use the new plugin.
### Install plugins using the Grafana Helm chart
#### Install plugins using the Grafana Helm chart
With the Grafana Helm chart, add the plugins you want to install as a list using the `plugins` field in the your values file. For more information about the configuration, refer to [the Helm chart configuration reference](https://github.com/grafana/helm-charts/tree/main/charts/grafana#configuration).
@@ -162,21 +154,29 @@ plugins:
- redis-datasource
```
### Install plugin on local Grafana
When the update is complete, a confirmation message will indicate the installation was successful.
Follow the instructions on the **Install** tab. You can either install the plugin with a Grafana CLI command or by downloading and uncompressing a zip file into the Grafana plugins directory. We recommend using Grafana CLI in most instances. The zip option is available if your Grafana server doesn't have access to the internet.
### Update a plugin
For more information about Grafana CLI plugin commands, refer to [Plugin commands]({{< relref "../../cli/#plugins-commands" >}}).
To update a plugin:
#### Install a packaged plugin
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the **Installed** filter to show only installed plugins.
1. Click the plugin's logo.
1. Click **Update**.
After the user has downloaded the archive containing the plugin assets, they can install it by extracting the archive into their plugin directory. For example:
When the update is complete, a confirmation message will indicate the installation was successful.
```bash
unzip my-plugin-0.2.0.zip -d YOUR_PLUGIN_DIR/my-plugin
```
### Uninstall a plugin
The path to the plugin directory is defined in the configuration file. For more information, refer to [Configuration]({{< relref "../../setup-grafana/configure-grafana/#plugins" >}}).
To uninstall a plugin:
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the plugin's logo.
1. Click the **Installed** filter to show only installed plugins.
1. Click **Uninstall**.
When the update is complete, a confirmation message will indicate the installation was successful.
## Plugin signatures

View File

@@ -73,7 +73,7 @@ Therefore, we heavily rely on the expertise of the community.
## Data sources
You can manage data sources in Grafana by adding YAML configuration files in the [`provisioning/data sources`]({{< relref "../../setup-grafana/configure-grafana#provisioning" >}}) directory.
You can manage data sources in Grafana by adding YAML configuration files in the [`provisioning/datasources`]({{< relref "../../setup-grafana/configure-grafana#provisioning" >}}) directory.
Each configuration file can contain a list of `datasources` to add or update during startup.
If the data source already exists, Grafana reconfigures it to match the provisioned configuration file.
@@ -257,17 +257,17 @@ All of these settings are optional.
The _HTTP\*_ tag denotes data sources that communicate using the HTTP protocol, including all core data source plugins except MySQL, PostgreSQL, and MS SQL.
{{< /admonition >}}
| Name | Type | Data source | Description |
| ----------------- | ------ | ---------------------------------- | -------------------------------------------------------- |
| tlsCACert | string | _HTTP\*_, MySQL, PostgreSQL | CA cert for out going requests |
| tlsClientCert | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client cert for outgoing requests |
| tlsClientKey | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client key for outgoing requests |
| password | string | _HTTP\*_, MySQL, PostgreSQL, MSSQL | password |
| basicAuthPassword | string | _HTTP\*_ | password for basic authentication |
| accessKey | string | Cloudwatch | Access key for connecting to Cloudwatch |
| secretKey | string | Cloudwatch | Secret key for connecting to Cloudwatch |
| sigV4AccessKey | string | Elasticsearch and Prometheus | SigV4 access key. Required when using keys auth provider |
| sigV4SecretKey | string | Elasticsearch and Prometheus | SigV4 secret key. Required when using keys auth provider |
| Name | Type | Data source | Description |
| ----------------- | ------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tlsCACert | string | _HTTP\*_, MySQL, PostgreSQL | CA cert for out going requests. You can point directly to your stored cert by using an environment variable following the `$__file{path/to/ca}` format. |
| tlsClientCert | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client cert for outgoing requests. You can point directly to your stored cert by using an environment variable following the `$__file{path/to/cert}` format. |
| tlsClientKey | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client key for outgoing requests. You can point directly to your stored key by using an environment variable following the `$__file{path/to/key}` format. |
| password | string | _HTTP\*_, MySQL, PostgreSQL, MSSQL | password |
| basicAuthPassword | string | _HTTP\*_ | password for basic authentication |
| accessKey | string | Cloudwatch | Access key for connecting to Cloudwatch |
| secretKey | string | Cloudwatch | Secret key for connecting to Cloudwatch |
| sigV4AccessKey | string | Elasticsearch and Prometheus | SigV4 access key. Required when using keys auth provider |
| sigV4SecretKey | string | Elasticsearch and Prometheus | SigV4 secret key. Required when using keys auth provider |
#### Custom HTTP headers for data sources

View File

@@ -79,7 +79,7 @@ The following list contains role-based access control actions.
| `dashboards.permissions:write` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li><li>`folders:*`</li><li>`folders:uid:*`</li></ul> | Update permissions for one or more dashboards. |
| `dashboards:read` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li><li>`folders:*`</li><li>`folders:uid:*`</li></ul> | Read one or more dashboards. |
| `dashboards:write` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li><li>`folders:*`</li><li>`folders:uid:*`</li></ul> | Update one or more dashboards. |
| `dashboards.public:write` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li></ul> | Write shared dashboard configuration. |
| `dashboards.public:write` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li></ul> | Write public dashboard configuration. |
| `datasources.caching:read` | <ul><li>`datasources:*`</li><li>`datasources:uid:*`</li></ul> | Read data source query caching settings. |
| `datasources.caching:write` | <ul><li>`datasources:*`</li><li>`datasources:uid:*`</li></ul> | Update data source query caching settings. |
| `datasources:create` | None | Create data sources. |
@@ -199,6 +199,26 @@ The following list contains role-based access control actions used by Grafana Ad
| `grafanaadaptivemetricsapp.exemptions:read` | None | Read recommendation exemptions. |
| `grafanaadaptivemetricsapp.exemptions:write` | None | Create, update, and delete recommendation exemptions. |
### Grafana Alerting Notification action definitions
To enable these permissions, enable the `alertingApiServer` feature toggle.
| Action | Applicable scopes | Description |
| -------------------------------------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `alert.notifications.receivers:read` | `receivers:*`<br>`receivers:uid:*` | Read contact points. None |
| `alert.notifications.receivers.secrets:read` | `receivers:*`<br>`receivers:uid:*` | Export contact points with decrypted secrets.None |
| `alert.notifications.receivers:create` | None | Create a new contact points. The creator is automatically granted full access to the created contact point.None |
| `alert.notifications.receivers:write` | `receivers:*`<br>`receivers:uid:*` | Update existing contact points.None |
| `alert.notifications.receivers:delete` | `receivers:*`<br>`receivers:uid:*` | Update and delete existing contact points.None |
| `receivers.permissions:read` | `receivers:*`<br>`receivers:uid:*` | Read permissions for contact points.None |
| `receivers.permissions:write` | `receivers:*`<br>`receivers:uid:*` | Manage permissions for contact points.None |
| `alert.notifications.time-intervals:read` | None | Read mute time intervals.None |
| `alert.notifications.time-intervals:write` | None | Create new or update existing mute time intervals.None |
| `alert.notifications.time-intervals:delete` | None | Delete existing time intervals.None |
| `alert.notifications.templates:read` | None | Read templates. |
| `alert.notifications.templates:write` | None | Create new or update existing templates.None |
| `alert.notifications.templates:delete` | None | Delete existing templates.None |
## Scope definitions
The following list contains role-based access control scopes.

View File

@@ -98,7 +98,7 @@ To learn how to use the roles API to determine the role UUIDs, refer to [Manage
| `fixed:dashboards.insights:reader` | `fixed_JlBJ2_gizP8zhgaeGE2rjyZe2Rs` | `dashboards.insights:read` | Read dashboard insights data and see presence indicators. |
| `fixed:dashboards.permissions:reader` | `fixed_f17oxuXW_58LL8mYJsm4T_mCeIw` | `dashboards.permissions:read` | Read all dashboard permissions. |
| `fixed:dashboards.permissions:writer` | `fixed_CcznxhWX_Yqn8uWMXMQ-b5iFW9k` | All permissions from `fixed:dashboards.permissions:reader` and <br>`dashboards.permissions:write` | Read and update all dashboard permissions. |
| `fixed:dashboards.public:writer` | `fixed_f_GHHRBciaqESXfGz2oCcooqHxs` | `dashboards.public:write` | Create, update, delete or pause a shared dashboard. |
| `fixed:dashboards.public:writer` | `fixed_f_GHHRBciaqESXfGz2oCcooqHxs` | `dashboards.public:write` | Create, update, delete or pause a public dashboard. |
| `fixed:datasources:creator` | `fixed_XX8jHREgUt-wo1A-rPXIiFlX6Zw` | `datasources:create` | Create data sources. |
| `fixed:datasources:explorer` | `fixed_qDzW9mzx9yM91T5Bi8dHUM2muTw` | `datasources:explore` | Enable the Explore feature. Data source permissions still apply, you can only query data sources for which you have query permissions. |
| `fixed:datasources:reader` | `fixed_C2x8IxkiBc1KZVjyYH775T9jNMQ` | `datasources:read`<br>`datasources:query` | Read and query data sources. |

View File

@@ -27,10 +27,6 @@ cards:
href: ./fundamentals/
description: Learn more about the fundamentals and available features that help you create, manage, and respond to alerts; and improve your teams ability to resolve issues quickly.
height: 24
- title: Set up
href: ./set-up/
description: Set up your implementation of Grafana Alerting.
height: 24
- title: Configure alert rules
href: ./alerting-rules/
description: Create, manage, view, and adjust alert rules to alert on your metrics data or log entries from multiple data sources — no matter where your data is stored.
@@ -39,13 +35,13 @@ cards:
href: ./configure-notifications/
description: Choose how, when, and where to send your alert notifications.
height: 24
- title: Detect and respond
- title: Monitor status
href: ./manage-notifications/
description: Monitor, respond to, and triage issues within your services.
height: 24
- title: Monitor
href: ./monitor/
description: Monitor your alerting metrics to ensure you identify potential issues before they become critical.
- title: Additional configuration
href: ./set-up/
description: Use advanced configuration options to further tailor your alerting setup. These options can enhance security, scalability, and automation in complex environments.
height: 24
---

View File

@@ -1,45 +0,0 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-alerts-panels/
description: Create alert rules from panels. Reuse the queries in the panel and create alert rules based on them.
keywords:
- grafana
- alerting
- panels
- create
- grafana-managed
- data source-managed
labels:
products:
- cloud
- enterprise
- oss
title: Create alert rules from panels
weight: 400
---
## Create alert rules from panels
Create alert rules from time series panels. By doing so, you can reuse the queries in the panel and create alert rules based on them.
1. Navigate to a dashboard in the **Dashboards** section.
2. Hover over the top-right corner of a time series panel and click the panel menu icon.
3. From the dropdown menu, select **More...** > **New alert rule**.
The New alert rule form opens where you can configure and create your alert rule based on the query used in the panel.
{{% admonition type="note" %}}
Changes to the panel aren't reflected on the linked alert rules. If you change a query, you have to update it in both the panel and the alert rule.
Alert rules are only supported in [time series](ref:time-series) visualizations.
{{% /admonition %}}
{{< docs/play title="visualizations with linked alerts in Grafana" url="https://play.grafana.org/d/000000074/" >}}
## View alert rules from panels
To view alert rules associated with a time series panel, complete the following steps.
1. Open the panel editor by hovering over the top-right corner of any panel
1. Click the panel menu icon that appears.
1. Click **Edit**.
1. Click the **Alert** tab to view existing alert rules or create a new one.

View File

@@ -64,16 +64,21 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/
alert-list:
link-alert-rules-to-panels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/alert-list/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/link-alert-rules-to-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/alert-list/
time-series:
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/
data-sources:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/time-series/
destination: /docs/grafana/<GRAFANA_VERSION>/datasources/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/
- destination: /docs/grafana-cloud/connect-externally-hosted/data-sources/
compatible-data-sources:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/#supported-data-sources
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/#supported-data-sources
---
# Configure Grafana-managed alert rules
@@ -84,6 +89,9 @@ Multiple alert instances can be created as a result of one alert rule (also know
{{% admonition type="note" %}}
For Grafana Cloud Free Forever, you can create up to 100 free Grafana-managed alert rules with each alert rule having a maximum of 1000 alert instances.
For all paid tiers (Cloud Pro and Advanced), there is a soft limit of 2000 alert rules and unlimited alert instances. To increase the limit, open a support ticket from the [Cloud portal](https://grafana.com/docs/grafana-cloud/account-management/support/).
{{% /admonition %}}
Grafana-managed alert rules can only be edited or deleted by users with Edit permissions for the folder storing the rules.
@@ -93,6 +101,13 @@ To make a backup of your configuration and to be able to restore deleted alertin
## Before you begin
If you are using Grafana OSS:
1. Configure your [data sources](ref:data-sources).
2. Check which [data sources](ref:compatible-data-sources) are compatible with and supported by Grafana Alerting.
If you are using Grafana OSS, Enterprise, or Cloud:
You can use default or advanced options for Grafana-managed alert rule creation. The default options streamline rule creation with a cleaner header and a single query and condition. For more complex rules, use advanced options to add multiple queries and expressions.
Default and advanced options are enabled by default for Grafana Cloud users and this feature is being rolled out progressively.
@@ -257,13 +272,9 @@ Annotations add metadata to provide more information on the alert in your alert
Webpage where you keep your runbook for the alert
1. Optional: Add a custom annotation
1. Optional: Add a **dashboard and panel link**.
1. Optional: **Link dashboard and panel**.
Links alert rules to panels in a dashboard.
{{% admonition type="note" %}}
At the moment, alert rules are only supported in [time series](ref:time-series) and [alert list](ref:alert-list) visualizations.
{{% /admonition %}}
[Link the alert rule to a panel](ref:link-alert-rules-to-panels) to facilitate alert investigation.
1. Click **Save rule**.

View File

@@ -1,184 +0,0 @@
---
aliases:
- ../unified-alerting/alerting-rules/create-cortex-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-cortex-loki-managed-recording-rule/
- ../unified-alerting/alerting-rules/create-mimir-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
description: Create recording rules for an external Grafana Mimir or Loki instance
keywords:
- grafana
- alerting
- guide
- rules
- recording rules
- configure
labels:
products:
- cloud
- enterprise
- oss
title: Configure recording rules
weight: 300
refs:
configure-grafana:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/
annotation-label:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/
---
# Configure recording rules
{{< admonition type="note" >}}
In Grafana Cloud, you can only create data source-managed recording rules.
In Grafana OSS and Enterprise, you can create both Grafana-managed and data source-managed recording rules if you enable the `grafanaManagedRecordingRules` feature flag.
For more information on enabling feature toggles, refer to [Configure feature toggles](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/feature-toggles).
{{< /admonition >}}
Recording rules calculate frequently needed expressions or computationally expensive expressions in advance and save the result as a new set of time series. Querying this new time series is faster, especially for dashboards since they query the same expression every time the dashboards refresh.
For more information on recording rules in Prometheus, refer to [Defining recording rules in Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
Recording rules are run as instant rules, which means that they run every 10s. To overwrite this configuration, update the min_interval in your custom configuration file.
[min_interval](ref:configure-grafana) sets the minimum interval to enforce between rule evaluations. The default value is 10s which equals the scheduler interval. Rules will be adjusted if they are less than this value or if they are not multiple of the scheduler interval (10s). Higher values can help with resource management as fewer evaluations are scheduled over time.
This setting has precedence over each individual rule frequency. If a rule frequency is lower than this value, then this value is enforced.
## Configure data source-managed recording rules
Configure data source-managed recording rules.
### Before you begin
- Verify that you have write permission to the Prometheus or Loki data source. Otherwise, you will not be able to create or update Grafana Mimir managed alerting rules.
- For Grafana Mimir and Loki data sources, enable the ruler API by configuring their respective services.
- **Loki** - The `local` rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types.
- **Grafana Mimir** - use the `/prometheus` prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the [Query API](/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend) and [Ruler API](/docs/mimir/latest/operators-guide/reference-http-api/#ruler) are under the same URL. You cannot provide a separate URL for the Ruler API.
To configure data-source managed recording rules, complete the following steps.
1. Click **Alerts & IRM** -> **Alerting** ->
**Alert rules**.
1. Scroll to the **Data source-managed section** and click **+New recording rule**.
#### Enter recording rule name
The recording rule name must be a Prometheus metric name and contain no whitespace.
#### Define recording rule
Select your data source and enter a query.
#### Add namespace and group
1. From the **Namespace** dropdown, select an existing rule namespace or add a new one.
Namespaces can contain one or more rule groups and only have an organizational purpose.
1. From the **Group** dropdown, select an existing group within the selected namespace or add a new one.
Newly created rules are appended to the end of the group. Rules within a group are run sequentially at a regular interval, with the same evaluation time.
#### Add labels
1. Add custom labels selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value.
1. Click **Save rule** to save the rule or **Save rule and exit** to save the rule and go back to the Alerting page.
## Configure Grafana-managed recording rules
Configure Grafana-managed recording rules.
{{< admonition type="note" >}}
This feature is only available for Grafana OSS and Enterprise users. It is not available in Grafana Cloud.
{{< /admonition >}}
### Before you begin
- Enable the `grafanaManagedRecordingRules` [feature flag](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/feature-toggles/).
To configure Grafana-managed recording rules, complete the following steps.
1. Click **Alerts & IRM** -> **Alerting** ->
**Alert rules**.
1. Scroll to the **Grafana-managed section** and click **+New recording rule**.
#### Enter a recording rule and metric name
Enter a names to identify your recording rule and metric. The metric name must be a Prometheus metric name and contain no whitespace.
For more information, refer to [Metrics and labels](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
#### Define recording rule
Define a query to get the data you want to measure and a condition that needs to be met before an alert rule fires.
1. Select a data source.
1. From the **Options** dropdown, specify a time range.
{{< admonition type="note" >}}
Grafana Alerting only supports fixed relative time ranges, for example, `now-24hr: now`.
It does not support absolute time ranges: `2021-12-02 00:00:00 to 2021-12-05 23:59:592` or semi-relative time ranges: `now/d to: now`.
{{< /admonition >}}
1. Add a query.
To add multiple queries, click **Add query**.
All alert rules are managed by Grafana by default. If you want to switch to a data source-managed alert rule, click **Switch to data source-managed alert rule**.
2. Add one or more [expressions].
a. For each expression, select either **Classic condition** to create a single alert rule, or choose from the **Math**, **Reduce**, and **Resample** options to generate separate alert for each series.
{{% admonition type="note" %}}
When using Prometheus, you can use an instant vector and built-in functions, so you don't need to add additional expressions.
{{% /admonition %}}
b. Click **Preview** to verify that the expression is successful.
3. To add a recovery threshold, turn the **Custom recovery threshold** toggle on and fill in a value for when your alert rule should stop firing.
You can only add one recovery threshold in a query and it must be the alert condition.
4. Click **Set as alert condition** on the query or expression you want to set as your alert condition.
#### Set evaluation behavior
Use alert rule evaluation to determine how frequently an alert rule should be evaluated and how quickly it should change its state.
To do this, you need to make sure that your alert rule is in the right evaluation group and set a pending period time that works best for your use case.
1. Select a folder or click **+ New folder**.
1. Select an evaluation group or click **+ New evaluation group**.
If you are creating a new evaluation group, specify the interval for the group.
All rules within the same group are evaluated concurrently over the same time interval.
1. Enter a pending period.
The pending period is the period in which an alert rule can be in breach of the condition until it fires.
Once a condition is met, the alert goes into the **Pending** state. If the condition remains active for the duration specified, the alert transitions to the **Firing** state, else it reverts to the **Normal** state.
1. Turn on pause alert notifications, if required.
{{< admonition type="note" >}}
You can pause alert rule evaluation to prevent noisy alerting while tuning your alerts.
Pausing stops alert rule evaluation and doesn't create any alert instances.
This is different to mute timings, which stop notifications from being delivered, but still allows for alert rule evaluation and the creation of alert instances.
{{< /admonition >}}
#### Add labels
Add labels to your rule for searching, silencing, or routing to a notification policy.

View File

@@ -1,8 +1,8 @@
---
aliases:
- ../unified-alerting/alerting-rules/create-cortex-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-cortex-loki-managed-recording-rule/
- ../unified-alerting/alerting-rules/create-mimir-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
- ../unified-alerting/alerting-rules/create-mimir-loki-managed-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-mimir-loki-managed-rule/
- ../unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/
- ../unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-mimir-loki-managed-rule/
description: Configure data source-managed alert rules alert for an external Grafana Mimir or Loki instance
keywords:
@@ -29,16 +29,11 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/
alert-list:
link-alert-rules-to-panels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/alert-list/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/link-alert-rules-to-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/alert-list/
time-series:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/time-series/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/
---
# Configure data source-managed alert rules
@@ -142,12 +137,8 @@ Annotations add metadata to provide more information on the alert in your alert
Webpage where you keep your runbook for the alert
1. Optional: Add a custom annotation
1. Optional: Add a **dashboard and panel link**.
1. Optional: **Link dashboard and panel**.
Links alerts to panels in a dashboard.
{{% admonition type="note" %}}
At the moment, alert rules are only supported in [time series](ref:time-series) and [alert list](ref:alert-list) visualizations.
{{% /admonition %}}
[Link the alert rule to a panel](ref:link-alert-rules-to-panels) to facilitate alert investigation.
1. Click **Save rule**.

View File

@@ -0,0 +1,54 @@
---
aliases:
- ../fundamentals/alert-rules/recording-rules/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/recording-rules/
- ../unified-alerting/alerting-rules/create-cortex-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-cortex-loki-managed-recording-rule/
- ../unified-alerting/alerting-rules/create-mimir-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
- ../alerting-rules/create-mimir-loki-managed-recording-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-recording-rules/
description: Recording rules allow you to pre-compute frequently needed or computationally expensive expressions and save the results as a new set of time series. Querying precomputed results is faster and can reduce system load.
keywords:
- grafana
- alerting
- guide
- rules
- recording rules
- configure
labels:
products:
- cloud
- enterprise
- oss
title: Create recording rules
weight: 400
refs:
grafana-managed-recording-rules:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-recording-rules/create-grafana-managed-recording-rules/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-recording-rules/create-grafana-managed-recording-rules/
data-source-managed-recording-rules:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-recording-rules/create-data-source-managed-recording-rules/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-recording-rules/create-data-source-managed-recording-rules/
---
# Configure recording rules
Recording rules allows you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
For instance, you can create a recording rule generating a new metric, `error_9001_count`, which counts occurrences of a specific log error within one minute. Then, query the `error_9001_count` metric in dashboards and alert rules.
Recording rules can be helpful in various scenarios, such as:
- **Faster queries** are needed: Performing heavy aggregations or querying large data sets is quicker with precomputed results than real-time queries.
- **Reducing system load:** Precomputing specific queries in advance can reduce system overload caused by multiple simultaneous queries.
- **Simplifying complex aggregations:** Create a new metric from complex aggregations to facilitate alert and dashboard setup.
- **Reusing queries across alerts:** Improve efficiency by reusing the same query across similar alert rules and dashboards.
The evaluation group of the recording rule determines how often the metric is pre-computed.
Similar to alert rules, Grafana supports two types of recording rules:
1. [Grafana-managed recording rules](ref:grafana-managed-recording-rules), which can query any Grafana data source supported by alerting.
2. [Data source-managed recording rules](ref:data-source-managed-recording-rules), which can query Prometheus-based data sources like Mimir or Loki.

View File

@@ -0,0 +1,79 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-recording-rules/create-data-source-managed-recording-rules/
description: Recording rules allow you to pre-compute expensive queries in advance and save the results as a new set of time series. Data source-managed recording rules can create a recording rule for Prometheus-based data sources like Mimir or Loki.
keywords:
- grafana
- alerting
- guide
- rules
- recording rules
- configure
labels:
products:
- cloud
- enterprise
- oss
title: Create data source-managed recording rules
weight: 402
refs:
create-recording-rules:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-recording-rules/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-recording-rules/
---
# Create data source-managed recording rules
[Recording rules](ref:create-recording-rules) allow you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
Alert rules and dashboards can then query the new metric resulting from the recording rule. This is faster than querying real-time data and can help to reduce system load.
Data source-managed recording rules can query Prometheus-based data sources like Mimir or Loki. For more information on recording rules in Prometheus, refer to [Defining recording rules in Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
Note that in data source-managed groups, the alert rules and recording rules within the same evaluation group are evaluated sequentially. This is useful to ensure that a recording rule is evaluated before any other alert rule queries the pre-computed metric.
## Before you begin
- Verify that you have write permission to the Prometheus or Loki data source. Otherwise, you will not be able to create or update Grafana Mimir managed alerting rules.
- For Grafana Mimir and Loki data sources, enable the ruler API by configuring their respective services.
- **Loki** - The `local` rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types.
- **Grafana Mimir** - use the `/prometheus` prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the [Query API](/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend) and [Ruler API](/docs/mimir/latest/operators-guide/reference-http-api/#ruler) are under the same URL. You cannot provide a separate URL for the Ruler API.
## Add new recording rule
To create a new data source-managed recording rule:
1. Click **Alerts & IRM** -> **Alerting** -> **Alert rules**.
1. Scroll to the **Data source-managed section** and click **+New recording rule**.
## Enter recording rule name
The recording rule name must be a Prometheus metric name and contain no whitespace.
## Define recording rule
Select your data source and enter a query. The queries used in data source-managed recording rules always run as instant queries.
## Add namespace and group
1. From the **Namespace** dropdown, select an existing rule namespace or add a new one.
Namespaces can contain one or more rule groups and only have an organizational purpose.
1. From the **Group** dropdown, select an existing group within the selected namespace or add a new one.
Newly created rules are appended to the end of the group. Rules within a group are run sequentially at a regular interval, with the same evaluation time.
## Add labels
Optionally, you can add custom labels to the resulting metric by selecting existing key-value pairs from the drop down or entering the new key or value.
## Query the new metric in dashboards or alert rules
Click **Save rule** or **Save rule and exit** to save the rule.
Once saved, the new recording metric is available for use in dashboards and alert rules.

View File

@@ -0,0 +1,151 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-recording-rules/create-grafana-managed-recording-rules/
description: Recording rules allow you to pre-compute expensive queries in advance and save the results as a new set of time series. Grafana-managed recording rules can create a recording rule for any data source supported by alerting.
keywords:
- grafana
- alerting
- guide
- rules
- recording rules
- configure
labels:
products:
- cloud
- enterprise
- oss
title: Create Grafana-managed recording rules
weight: 401
refs:
expressions:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/queries-conditions/#expression-queries
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/queries-conditions/#expression-queries
create-recording-rules:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-recording-rules/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-recording-rules/
alerting-data-sources:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/#supported-data-sources
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/#supported-data-sources
configure-grafana-min-interval:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/#min_interval
configure-feature-toggles:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/feature-toggles/
---
# Create Grafana-managed recording rules
[Recording rules](ref:create-recording-rules) allow you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
Alert rules and dashboards can then query the new metric resulting from the recording rule. This is faster than querying real-time data and can help to reduce system load.
Grafana does not contain an embedded time-series database to store recording rule results. You must bring your own Prometheus-compatible database to store the series generated by recording rules.
Grafana-managed recording rules offer the same Prometheus-like semantics but allow you to query [data sources supported by alerting](ref:alerting-data-sources). Additionally, you can use recording rules to import and map data from other data sources into Prometheus.
{{< admonition type="note" >}}
Grafana-managed recording rules are enabled by default in Grafana Cloud.
In Grafana OSS and Enterprise, you must enable them by following the [Before you begin](#before-you-begin) instructions.
{{< /admonition >}}
To configure Grafana-managed recording rules, complete the following steps.
## Before you begin
This section only applies to Grafana OSS and Grafana Enterprise.
First, enable the `grafanaManagedRecordingRules` [feature flag](ref:configure-feature-toggles).
Then, enable the feature by setting `enabled = true` in the `[recording_rules]` section of the Grafana config .ini. Provide the URL of your Prometheus-compatible remote-write endpoint in the `url` field, along with optional credentials or headers.
```
[recording_rules]
enabled = true
url = http://my-example-prometheus.local:9090/api/prom/push
basic_auth_username = my-user
basic_auth_password = my-pass
[recording_rules.custom_headers]
X-My-Header = MyValue
```
## Add new recording rule
To create a new Grafana-managed recording rule:
1. Click **Alerts & IRM** -> **Alerting** ->
**Alert rules**.
1. Scroll to the **Grafana-managed section** and click **+New recording rule**.
1. Enter the names to identify your recording rule and metric.
The metric name must be a Prometheus metric name and contain no whitespace. For details, refer to [Prometheus metric names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
## Define recording rule
Define a query to get the data you want to measure and set the recording rule output.
1. Select a data source.
1. From the **Options** dropdown, specify a time range.
{{< admonition type="note" >}}
Grafana Alerting only supports fixed relative time ranges, for example, `now-24hr: now`.
It does not support absolute time ranges: `2021-12-02 00:00:00 to 2021-12-05 23:59:592` or semi-relative time ranges: `now/d to: now`.
{{< /admonition >}}
1. Add a query.
To add multiple queries, click **Add query**.
1. Add one or more [expressions](ref:expressions).
a. For each expression, select either **Classic condition** to create a single recording rule, or choose from the **Math**, **Reduce**, and **Resample** options.
When using Prometheus, you can use an instant vector and built-in functions, so you don't need to add additional expressions.
b. Click **Preview** to verify that the expression is successful.
1. Click **Set as recording rule output** on the query or expression you want to set as your rule output.
## Set evaluation behavior
Use recording rule evaluation to determine how frequently a recording rule should be evaluated.
To do this, you need to make sure that your recording rule is in the right evaluation group with an interval that works best for your use case.
1. Select a folder or click **+ New folder**.
1. Select an evaluation group or click **+ New evaluation group**.
If you are creating a new evaluation group, specify the interval for the group.
All rules within the same group are evaluated concurrently over the same time interval. Every recording rule in a group uses the same evaluation time, meaning that all queries from the same group are always aligned with each other.
1. Before or after creating a recording rule, you have the option to **Pause evaluation** if necessary.
### Advanced configuration
[min_interval](ref:configure-grafana-min-interval) sets the minimum interval to enforce between rule evaluations. The default value is 10s which equals the scheduler interval. Rules are adjusted if they are less than this value or if they are not multiple of the scheduler interval (10s). Higher values can help with resource management as fewer evaluations are scheduled over time.
This setting has precedence over each individual rule frequency. If a rule frequency is lower than this value, then this value is enforced.
This setting applies to both Grafana-managed alert and recording rules.
## Add labels
Optionally, you can add custom labels to the resulting metric by selecting existing key-value pairs from the drop down or entering the new key or value.
## Query the new metric in dashboards or alert rules
Click **Save rule** or **Save rule and exit** to save the rule.
Once saved, the new recording metric is available for use in dashboards and alert rules.

View File

@@ -0,0 +1,84 @@
---
aliases:
- ../../alerting/alerting-rules/create-alerts-panels/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-alerts-panels/
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/link-alert-rules-to-panels/
description: Grafana allows you to link alert rules with panels and dashboards. This helps connect alerts with an existing dashboard and informs alert responders on where to investigate.
keywords:
- grafana
- alerting
- panels
- create
- grafana-managed
- data source-managed
labels:
products:
- cloud
- enterprise
- oss
title: Create and link alert rules to panels
weight: 300
refs:
time-series-visualizations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/time-series/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/
annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#annotations
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#annotations
view-alert-state-on-panels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/view-alert-state-on-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/manage-notifications/view-alert-state-on-panels/
---
# Create and link alert rules to panels
Grafana allows you to link an alert rule to a dashboard panel. This can help you:
- Inform alert responders about where to investigate and which data to examine.
- Visualize the alert state directly from dashboards.
An alert rule is linked to a panel by setting the [`dashboardUId` and `panelId` annotations](ref:annotations). Both annotations must be set together.
## Link alert rules to panels
When configuring the alert rule, you can set the dashboard and panel annotations as shown in this [video](https://youtu.be/ClLp-iSoaSY?si=qKWnvSVaQuvYcuw9&t=170).
1. Configure the alert rule.
1. In the **Configure notification message** section, click **Link dashboard and panel**.
1. Select an existing dashboard, then choose a panel from the selected dashboard.
1. Complete the alert rule configuration and click **Save rule** to initiate the alert rule.
You can then [view the alert state on the panel](ref:view-alert-state-on-panels).
{{< figure src="/media/docs/alerting/panel-displays-alert-state.png" max-width="1200px" caption="A panel displaying the alert status and state changes." >}}
## Create alert rules from panels
To streamline alert creation, you can create an alert rule directly from a panel.
1. Navigate to a dashboard in the **Dashboards** section.
1. Hover over the top-right corner of a panel and click the panel menu icon.
1. From the dropdown menu, select **More...** > **New alert rule**.
1. This opens the **Edit rule** form and pre-fills some values:
- Sets the `dashboardUId` and `panelId` annotations to the corresponding dashboard and panel.
- Sets the alert rule query using the panel query.
1. Complete the alert rule configuration and click **Save rule** to initiate the alert rule.
You can then [view the alert state on the panel](ref:view-alert-state-on-panels).
{{% admonition type="note" %}}
Changes to panel and alert rule queries aren't synchronized. If you change a query, you have to update it in both the panel and the alert rule.
{{% /admonition %}}
## Access linked alert rules from panels
This option is available only in [time series panels](ref:time-series-visualizations). To access alert rules associated to a time series panel, complete the following steps.
1. Hover over the top-right corner of the panel and click the panel menu icon.
1. Click **Edit**.
1. Click the **Alert** tab to view existing alert rules or create a new one.

View File

@@ -0,0 +1,215 @@
---
aliases:
- ../fundamentals/annotation-label/variables-label-annotation/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/annotation-label/variables-label-annotation/
- ../alerting-rules/templating-labels-annotations/ # /docs/grafana/<GRAFANA_VERSION>/alerting-rules/templating-labels-annotations/
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/templates/
description: Learn how to template annotations and labels to include data from queries and expressions in alert messages
keywords:
- grafana
- alerting
- templating
- labels
- annotations
labels:
products:
- cloud
- enterprise
- oss
title: Template annotations and labels
weight: 500
refs:
reference-labels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#labels
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#labels
reference-values:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#values
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#values
annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#annotations
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#annotations
explore:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/
intro-to-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/templates/
alert-rule-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/
alert-rule-template-examples:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/examples/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/examples/
notification-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
notification-data-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/#notification-data
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/#notification-data
view-alert-state:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/view-state-health/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/manage-notifications/view-state-health/
preview-notifications:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/manage-notification-templates/#preview-notification-templates
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/manage-notification-templates/#preview-notification-templates
---
# Template annotations and labels
You can use templates to customize alert and notification messages, including dynamic data from alert rule queries.
In Grafana Alerting, you can template alert messages in two ways.
1. **Template annotations and labels**: In the alert rule definition, you can template annotations and labels to include extra information from query data to the alert, adding meaningful details based on the query results.
1. **Template notifications**: You can template notifications to control the content and appearance of your notifications.
## How templating works
In this diagram, you can see the differences between both types of templates.
{{< figure src="/media/docs/alerting/how-notification-templates-works.png" max-width="1200px" alt="How templating works" >}}
Refer to [Templates Introduction](ref:intro-to-templates) for a more detailed explanation of this diagram.
Both types of templates are written in the Go templating system. However, it's important to understand that variables and functions used in notification templates are different from those used in annotation and label templates.
1. **Template annotations and labels**: These templates add extra information to individual alert instances. Template variables like [`$labels`](ref:reference-labels) and [`$values`](ref:reference-values) represent alert query data of the individual alert instance.
1. **Template notifications**: Notification templates format the notification content for a group of alerts. Variables like [`.Alerts`](ref:notification-data-reference) include all firing and resolved alerts in the notification.
## Template annotations
[Annotations](ref:annotations) add additional information to alert instances and are often used to help identify the alert and guide responders on how to address the issue.
Annotations are key-value pairs defined in the alert rule. They can contain plain text or template code that is evaluated when the alert fires.
Grafana includes several optional annotations, such as `description`, `summary`, `runbook_url`, `dashboardUId` and `panelId`, which can be edited in the alert rule. You can also create your custom annotations. For example, you might create a new annotation named `location` to report the location of the system that triggered the alert.
Heres an example of a `summary` annotation explaining why the alert was triggered, using plain text.
```
CPU usage has exceeded 80% for the last 5 minutes.
```
However, if you want to display dynamic query values in annotations, you need to use template code. Common use cases include:
- Displaying the query value that triggered the alert.
- Highlighting label information that identifies the alert, such as the environment, instance, or region.
- Providing specific instructions based on query values.
- Customizing runbook links depending on query labels.
- Including contact information based on query labels.
For instance, you can template the previous example to display the specific instance and CPU value that triggered the alert.
```
CPU usage for {{ $labels.instance }} has exceeded 80% ({{ $values.A.Value }}) for the last 5 minutes.
```
Alternatively, you can use the `index` function to print query values.
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% ({{ index $values "A" }}) for the last 5 minutes.
```
The result of the annotation would be as follows.
```
CPU usage for Instance 1 has exceeded 80% (81.2345) for the last 5 minutes.
```
### How to template an annotation
Complete the following steps to template an annotation.
1. Navigate to **Alerts & IRM** -> **Alert rules** -> create or edit an alert rule.
1. Scroll down to the **Configure notification message** section.
1. Copy in your template in the corresponding annotation field (`summary`, `description`, `runbook_url`, `custom`).
### Preview annotation templates
You can template annotations when creating or editing an alert rule.
{{< figure src="/media/docs/alerting/alert-rule-using-annotation-template.png" max-width="1200px" alt="An alert rule templating the annotation summary" >}}
Two common methods are used to test and preview annotation templates:
1. Trigger the alert and [view the alert instance state in the Grafana UI](ref:view-alert-state), where all annotations of the alert instance are displayed.
1. Use a notification template that displays all annotations, then [preview the notification template](ref:preview-notifications) using the alert instance.
## Template labels
The set of [labels](ref:labels) for an alert instance is used to uniquely identify that alert among all other alert instances.
Labels determine how alerts are routed and managed for notifications, making their design key to the effectiveness of your alerting system.
Labels can be returned from an alert rule query, such as the `pod` label in a Kubernetes Prometheus query. You can also define additional labels in the alert rule to provide extra information for processing alerts.
Like annotations, labels are key-value pairs that can contain plain text or template code evaluated when the alert fires.
Template labels when the labels returned by your queries are insufficient. For instance:
- A new label based on a query value can group a subset of alerts differently, changing how notifications are sent.
- A new label based on a query value can be used in a notification policy to alter the notification contact point.
Heres an example of templating a `severity` label based on the query value.
```
{{ if (gt $values.A.Value 90.0) -}}
critical
{{ else if (gt $values.A.Value 80.0) -}}
high
{{ else if (gt $values.A.Value 60.0) -}}
medium
{{ else -}}
low
{{- end }}
```
In this example, the value of the `severity` label is determined by the query value, and the possible options are `critical`, `high`, `medium`, or `low`. You can then use the `severity` label to change their notifications—for instance, sending `critical` alerts immediately or routing `low` alerts to a specific team for further review.
{{% admonition type="note" %}}
You should avoid displaying query values in labels, as this may create numerous unique alert instances—one for each distinct label value. Instead, use annotations for query values.
{{% /admonition %}}
### How to template a label
Complete the following steps to template a label.
1. Navigate to **Alerts & IRM** -> **Alert rules** -> create or edit an alert rule.
1. Scroll down to the **Configure labels and notifications** section.
1. Click **+ Add labels**.
1. Enter a **key** that identifies the label.
1. Copy in your template in the **value** field.
### Preview label templates
You can template label values when creating or editing an alert rule.
To preview label values, select `Use notification policy`, and then click on `Preview routing`.
{{< figure src="/media/docs/alerting/alert-instance-routing-preview.png" max-width="1200px" alt="Routing preview displays label values" >}}
## More information
For further details on how to template alert rules, refer to:
- [Annotation and label template reference](ref:alert-rule-template-reference)
- [Annotation and label examples](ref:alert-rule-template-examples)

View File

@@ -0,0 +1,310 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/templates/examples/
description: Examples of templating labels and annotations in Grafana alert rules
keywords:
- grafana
- alerting
- templating
- labels
- annotations
labels:
products:
- cloud
- enterprise
- oss
title: Labels and annotations template examples
menuTitle: Examples
weight: 102
refs:
labels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#labels
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#labels
annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#annotations
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#annotations
alert-rule-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/
- pattern: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/
reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/
reference-labels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#labels
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#labels
reference-values:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#values
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#values
reference-humanize:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#humanize
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#humanize
reference-humanizepercentage:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#humanizepercentage
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#humanizepercentage
reference-match:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#match
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#match
reference-functions:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#functions
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#functions
language-functions:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/language/#functions
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/language/#functions
language-index:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/language/#functions
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/language/#functions
language:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/language
- pattern: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/language
---
# Labels and annotations template examples
Templating allows you to add dynamic data from queries to alert labels and annotations. Dynamic data enhances alert context, making it easier for responders to quickly assess and address the issue.
This page provides common examples for templating labels and annotations. For more information on templating, refer to:
- [Template annotations and labels](ref:alert-rule-templates)
- [Annotation and label template reference](ref:reference)
- [Alerting template language](ref:language)
## Annotation example
[Annotations](ref:annotations) add extra details to alert instances and are often used to provide helpful information for identifying the issue and guiding the response.
A common use case for annotations is to display the specific query value or threshold that triggered the alert.
For example, you can display the query value from the [`$values`](ref:reference-values) variable to inform about the CPU value that triggered the alert.
```
CPU usage has exceeded 80% ({{ $values.A.value }}) for the last 5 minutes.
```
Alternatively, you can use the [`index()`](ref:language-index) function to retrieve the query value as follows.
```
CPU usage has exceeded 80% ({{ index $values "A" }}) for the last 5 minutes.
```
```template_output
CPU usage has exceeded 80% (81.2345) for the last 5 minutes.
```
### Include labels for extra details
To provide additional context, you can include labels from the query using the [`$labels`](ref:reference-labels) variable.
For instance, the previous case could also include the affected `instance`.
```
CPU usage for {{ $labels.instance }} has exceeded 80% ({{ $values.A.Value }}) for the last 5 minutes.
```
```template_output
CPU usage for Instance 1 has exceeded 80% (81.2345) for the last 5 minutes.
```
You can incorporate any labels returned by the query into the template. For instance, the following template includes information about the environment and region where the alert occurred.
```
Alert triggered in {{ $labels.environment }} on {{ $labels.region }} region.
```
```template_output
Alert triggered in production on AMER region.
```
### Print a range query
To print the value of an instant query you can print its Ref ID using the `index` function or the `$values` variable:
```
{{ $values.A.Value }}
```
For range queries, reduce them from a time series to an instant vector using a reduce expression. You can then print the result by referencing its Ref ID. For example, if the reduce expression averages `A` with the Ref ID `B`, you would then print `$values.B`:
```
{{ $values.B.Value }}
```
### Humanize the value of a query
To print the humanized value of an instant query, use the [`humanize`](ref:reference-humanize) function:
```
{{ humanize $values.A.Value }}
```
Alternatively:
```
{{ humanize (index $values "A").Value }}
```
```template_output
554.9
```
To print the value of an instant query as a percentage, use the [`humanizePercentage`](ref:reference-humanizepercentage) function:
```
{{ humanizePercentage $values.A.Value }}
```
```template_output
10%
```
For additional functions to display or format data, refer to:
- [Annotation and label template functions](ref:reference-functions)
- [Template language functions](ref:language-functions)
## Label example
[Labels](ref:labels) determine how alerts are routed and managed, ensuring that notifications reach the right teams at the right time. If the labels returned by your queries dont fully capture the necessary context, you can create a new label and sets its value based on query data.
### Based on query value
Heres an example of creating a `severity` label based on a query value:
```go
{{ if (gt $values.A.Value 90.0) -}}
critical
{{ else if (gt $values.A.Value 80.0) -}}
high
{{ else if (gt $values.A.Value 60.0) -}}
medium
{{ else -}}
low
{{- end }}
```
In this example, the `severity` label is determined by the query value:
- `critical` for values above 90,
- `high` for values above 80,
- `medium` for values above 60,
- and `low` for anything below.
You can then use the `severity` label to control how alerts are handled. For instance, you could send `critical` alerts immediately, while routing `low` severity alerts to a team for further investigation.
{{% admonition type="note" %}}
You should avoid displaying query values in labels, as this may create many alert instances—one for each distinct label value. Instead, use annotations to convey query values.
{{% /admonition %}}
### Based on query label
You can use labels to differentiate alerts coming from various environments (e.g., production, staging, dev). For example, you may want to add a label that sets the environment based on the instances label. Heres how you can template it:
```go
{{ if eq $labels.instance "prod-server-1" }}production
{{ else if eq $labels.instance "staging-server-1" }}staging
{{ else }}development
{{ end }}
```
This would print:
- For instance `prod-server-1`, the label would be `production`.
- For `staging-server-1`, the label would be `staging`.
- All other instances would be labeled `development`.
To make this template more flexible, you can use a regular expression that matches the instance name with the instance name prefix using the [`match()`](ref:reference-match) function:
```go
{{ if match "^prod-server-.*" $labels.instance }}production
{{ else if match "^staging-server-.*" $labels.instance}}staging
{{ else }}development
{{ end }}
```
{{< collapse title="Legacy Alerting templates" >}}
## Legacy Alerting templates
For users working with Grafana's legacy alerting system, templates can still be utilized to extract useful information from alert conditions. However, it's important to note that you cannot use `$labels` to print labels from the query if you are using classic conditions, and must use `$values` instead. The reason for this is classic conditions discard these labels to enforce uni-dimensional behavior (at most one alert per alert rule). If classic conditions didn't discard these labels, then queries that returned many time series would cause alerts to flap between firing and resolved constantly as the labels would change every time the alert rule was evaluated.
Instead, the `$values` variable contains the reduced values of all time series for all conditions that are firing. For example, if you have an alert rule with a query A that returns two time series, and a classic condition B with two conditions, then `$values` would contain `B0`, `B1`, `B2` and `B3`. If the classic condition B had just one condition, then `$values` would contain just `B0` and `B1`.
#### Print all labels from a classic condition
To print all labels of all firing time series use the following template (make sure to replace `B` in the regular expression with the Ref ID of the classic condition if it's different):
```go
{{ range $k, $v := $values -}}
{{ if (match "B[0-9]+" $k) -}}
{{ $k }}: {{ $v.Labels }}{{ end }}
{{ end }}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: instance=server1
B1: instance=server2
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then its labels will be duplicated for each condition that is exceeded:
```
B0: instance=server1
B1: instance=server2
B2: instance=server1
B3: instance=server2
```
If you need to print unique labels you should consider changing your alert rules from uni-dimensional to multi-dimensional instead. You can do this by replacing your classic condition with reduce and math expressions.
#### Print all values from a classic condition
To print all values from a classic condition take the previous example and replace `$v.Labels` with `$v.Value`:
```go
{{ range $k, $v := $values -}}
{{ if (match "B[0-9]+" $k) -}}
{{ $k }}: {{ $v.Value }}{{ end }}
{{ end }}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: 81.2345
B1: 84.5678
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then `$values` will contain the values of all conditions:
```
B0: 81.2345
B1: 92.3456
B2: 84.5678
B3: 95.6789
```
{{< /collapse >}}

View File

@@ -0,0 +1,81 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/language/
description: Use Go template language to create your notification and alert rule templates
keywords:
- grafana
- alerting
- templates
- write templates
labels:
products:
- cloud
- enterprise
- oss
title: Alerting template language
menuTitle: Template language
refs:
alert-rule-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/
alert-rule-template-reference-variables:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#variables
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#variables
notification-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
reference-notificationdata:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/#notification-data
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/#notification-data
---
# Alerting template language
Notification templates and alert rule templates, such as annotations and labels, both use the Go template language, [text/template](https://pkg.go.dev/text/template).
Both types of templates can use the same keywords, functions, and comparison operators of the Go template language, such as `range`, `if`, `and`, `index`, `eq`, and more.
However, it's important to note that because notifications and alert rules operate in distinct contexts, some additional variables and functions are only available for either notification or alert rule templates. Refer to:
- [Annotation and label template reference](ref:alert-rule-template-reference)
- [Notification template reference](ref:notification-template-reference)
This documentation provides an overview of the functions and operators of the Go template language that are available for both notification and alert rule templates.
## Print
To print the value of something, use `{{` and `}}`. You can print the value of a [variable](#variables), a field of a variable, the result of a function, or the value of dot.
```go
{{ $values }}
{{ $values.A.Value }}
{{ humanize 1000.0 }}
{{ .Alerts }}
```
## Dot
In `text/template`, there is a special cursor called dot, written as `.`. You can think of this cursor as a variable whose value changes depending on where in the template it is used.
At the start of notification templates, dot (`.`) refers to [Notification Data](ref:reference-notificationdata).
```go
{{ .Alerts }}
```
In annotation and label templates, dot (`.`) is initialized with all alert data. Its recommended to use the [`$labels` and `$values` variables](ref:alert-rule-template-reference-variables) instead to directly access the alert labels and query values.
{{% admonition type="note" %}}
Dot (`.`) might refer to something else when used in a [range](#range), a [with](#with), or when writing [templates](#templates) used in other templates.
{{% /admonition %}}
[//]: <> (The above section is not included in the shared file because `refs` links are not supported in shared files.)
{{< docs/shared lookup="alerts/template-language.md" source="grafana" version="<GRAFANA_VERSION>" >}}

View File

@@ -0,0 +1,450 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/templates/reference/
description: Reference for variables and functions in Grafana alert rule templating.
keywords:
- grafana
- alerting
- templating
- labels
- annotations
labels:
products:
- cloud
- enterprise
- oss
title: Annotation and label template reference
menuTitle: Template reference
weight: 101
refs:
label-types:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#label-types
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#label-types
notification-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
language:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/language/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/language/
language-functions:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/language/#functions
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/language/#functions
language-index:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/language/#functions
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/language/#functions
print-all-labels-from-a-classic-condition:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/examples/#print-all-labels-from-a-classic-condition
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/examples/#print-all-labels-from-a-classic-condition
template-annotations-and-labels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/
---
# Annotation and label template reference
Annotations and labels in alert rules can be defined using plain text. However, you can also define templates to customize their values with dynamic data from alert rule queries.
For example, you can template the `summary` annotation to include information from query values, providing relevant alert context for responders. Refer to [Template annotations and labels](ref:template-annotations-and-labels) for various use cases.
In templates, variables represent dynamic values from queries, while functions perform actions to transform or format this data.
## Variables
Variables represent dynamic values from alert rule queries that can be displayed or accessed in your templates.
The `$` and `.` symbols are used to reference variables and their properties. You can reference variables directly in your alert rule definitions using the `$` symbol followed by the variable name. Similarly, you can access properties of variables using the dot (`.`) notation in alert rule templates.
```
{{ $values.A.Value }}
```
Templates are based on the **Go templating system**. Refer to [Template language](ref:language) for additional information.
The following variables are available when templating annotations and labels:
| Variables | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| [$labels](#labels) | Contains all labels from the query, only query labels. |
| [$values](#values) | Contains the labels and floating point values of all instant queries and expressions, indexed by their Ref IDs. |
| [$value](#value) | A string containing the labels and values of all instant queries; threshold, reduce and math expressions, and classic conditions in the alert rule. |
### $labels
The `$labels` variable contains all labels from the query. It excludes [user-configured and reserved labels](ref:label-types), containing only query labels.
{{< figure src="/media/docs/alerting/query-labels-and-values.png" max-width="1200px" caption="An alert rule displaying labels and value from a query." >}}
For example, suppose you have a query that returns CPU usage for all of your servers, and you have an alert rule that fires when any of your servers have exceeded 80% CPU usage for the last 5 minutes. You want to add a summary annotation to the alert that tells you which server is experiencing high CPU usage. With the `$labels` variable you can write a template that prints a human-readable sentence such as:
```
CPU usage for {{ $labels.instance }} has exceeded 80% for the last 5 minutes
```
The outcome of this template would be:
```
CPU usage for server1 has exceeded 80% for the last 5 minutes
```
> If you are using a classic condition then `$labels` will not contain any labels from the query. Classic conditions discard these labels in order to enforce uni-dimensional behavior (at most one alert per alert rule). If you want to use labels from the query in your template then use the example [here](ref:print-all-labels-from-a-classic-condition).
### $values
The `$values` variable is a table containing the labels and floating point values of all instant queries and expressions, indexed by their Ref IDs (e.g, `A`, `B`, `C`, etc.). It does not contain the results of range queries, as they can return hundreds or thousands of rows.
Each Ref IDs, such as `$values.A`, has the following properties
| Property | Type | Description |
| -------- | --------------- | ------------------------------------------------------------ |
| `Value` | Float | The value returned by the instant query or expression. |
| `Labels` | Key/value pairs | The labels associated with the instance query or expression. |
Here's the previous example printing now the value of the instant query with Ref ID `A`:
```
{{ $values.A.Value }} CPU usage for {{ $labels.instance }} over the last 5 minutes.
```
If the alert has the label `instance=server1` and the query returns `81.2345`, the template would print:
```
81.2345 CPU usage for instance1 over the last 5 minutes.
```
If the query in Ref ID `A` is a range query rather than an instant query then add a reduce expression with Ref ID `B` and replace `$values.A.Value` with `$values.B.Value`:
```
{{ $values.B.Value }} CPU usage for {{ $labels.instance }} over the last 5 minutes.
```
Alternatively, you can use the `index()` function to retrieve the query value:
```
{{ index $values "B" }} CPU usage for {{ index $labels "instance" }} over the last 5 minutes.
```
#### $value
The `$value` variable is a string containing the labels and values of all instant queries; threshold, reduce and math expressions, and classic conditions in the alert rule.
This example prints the `$value` variable:
```
{{ $value }}: CPU usage has exceeded 80% for the last 5 minutes.
```
It would display something like this:
```
[ var='A' labels={instance=instance1} value=81.234 ]: CPU usage has exceeded 80% for the last 5 minutes.
```
Instead, we recommend using [$values](#values), which contains the same information as `$value` but is structured in an easier-to-use table format.
## Functions
Functions can perform actions in templates such as transforming or formatting data.
Note that the [functions provided by Go's template language](ref:language-functions), such as `index`, `and`, `printf`, and `len`, are available, along with many others.
In addition, the following functions are also available for templating annotations and labels:
**Numbers**
| Name | Arguments | Returns | Description |
| ----------------------------------------- | ---------------- | ------- | ---------------------------------------------------------------- |
| [humanize](#humanize) | number or string | string | Humanizes decimal numbers. |
| [humanize1024](#humanize1024) | number or string | string | Like `humanize`, but but uses 1024 as the base rather than 1000. |
| [humanizeDuration](#humanizeduration) | number or string | string | Humanizes a duration in seconds. |
| [humanizePercentage](#humanizepercentage) | number or string | string | Humanizes a ratio value to a percentage. |
| [humanizeTimestamp](#humanizetimestamp) | number or string | string | Humanizes a Unix timestamp. |
| [toTime](#totime) | number or string | time | Converts a Unix timestamp in seconds to time. |
**Strings**
| Name | Arguments | Returns | Description |
| ------------------------------- | -------------------------- | ------- | --------------------------------------------------------------------------------------------- |
| [title](#title) | string | string | Capitalizes the first character of each word. |
| [toUpper](#toupper) | string | string | Returns all text in uppercase. |
| [toLower](#tolower) | string | string | Returns all text in lowercase. |
| [stripPort](#stripport) | string | string | Returns only host. |
| [match](#match) | pattern, text | boolean | Matches the text against a regular expression pattern. |
| [reReplaceAll](#rereplaceall) | pattern, replacement, text | string | Replaces text matching the regular expression. |
| [graphLink](#graphlink) | expr | string | Returns the path to the graphical view in `Explore` for the given expression and data source. |
| [tableLink](#tablelink) | expr | string | Returns the path to the tabular view in `Explore` for the given expression and data source. |
| [parseDuration](#parseduration) | string | float | Parses a duration string such as "1h" into the number of seconds it represents. |
| [stripDomain](#stripdomain) | string | string | Returns the result of removing the domain part of a FQDN. |
**Others**
| Name | Arguments | Returns | Description |
| --------------------------- | ------------- | ---------------------- | -------------------------------------------------------------------------------- |
| [args](#args) | []interface{} | map[string]interface{} | Translates a list of objects to a map with keys arg0, arg1 etc. |
| [safeHtml](#safehtml) | string | string | Marks string as HTML not requiring auto-escaping. |
| [externalURL](#externalurl) | none | string | Returns the external URL of the Grafana server as configured in the ini file(s). |
| [pathPrefix](#pathprefix) | none | string | Returns the path of the Grafana server as configured in the ini file(s). |
For further context on these functions, note that templating in Grafana is based on the [Prometheus template implementation](https://prometheus.io/docs/prometheus/latest/configuration/template_reference/), enabling the use of these functions and Prometheus-like templates for formatting alert messages within Grafana.
#### humanize
The `humanize` function humanizes decimal numbers:
```
{{ humanize 1000.0 }}
```
```
1k
```
#### humanize1024
The `humanize1024` works similar to `humanize` but but uses 1024 as the base rather than 1000:
```
{{ humanize1024 1024.0 }}
```
```
1ki
```
#### humanizeDuration
The `humanizeDuration` function humanizes a duration in seconds:
```
{{ humanizeDuration 60.0 }}
```
```
1m 0s
```
#### humanizePercentage
The `humanizePercentage` function humanizes a ratio value between 0 and 1 to a percentage:
```
{{ humanizePercentage 0.2 }}
```
```
20%
```
#### humanizeTimestamp
The `humanizeTimestamp` function humanizes a Unix timestamp:
```
{{ humanizeTimestamp 1577836800.0 }}
```
```
2020-01-01 00:00:00 +0000 UTC
```
#### toTime
The `toTime` function converts a Unix timestamp in seconds to time.:
```
{{ toTime 1727802106 }}
```
```
2024-10-01 17:01:46 +0000 UTC
```
#### title
The `title` function capitalizes the first character of each word:
```
{{ title "hello, world!" }}
```
```
Hello, World!
```
#### toUpper
The `toUpper` function returns all text in uppercase:
```
{{ toUpper "Hello, world!" }}
```
```
HELLO, WORLD!
```
#### toLower
The `toLower` function returns all text in lowercase:
```
{{ toLower "Hello, world!" }}
```
```
hello, world!
```
#### stripPort
The `stripPort` splits string into host and port, then returns only host:
```
{{ stripPort "example.com:8080" }}
```
```
example.com
```
#### match
The `match` function matches the text against a regular expression pattern:
```
{{ match "a.*" "abc" }}
```
```
true
```
#### reReplaceAll
The `reReplaceAll` function replaces text matching the regular expression:
```
{{ reReplaceAll "localhost:(.*)" "example.com:$1" "localhost:8080" }}
```
```
example.com:8080
```
#### graphLink
The `graphLink` function returns the path to the graphical view in [Explore](ref:explore) for the given expression and data source:
```
{{ graphLink "{\"expr\": \"up\", \"datasource\": \"gdev-prometheus\"}" }}
```
```
/explore?left=["now-1h","now","gdev-prometheus",{"datasource":"gdev-prometheus","expr":"up","instant":false,"range":true}]
```
#### parseDuration
The `parseDuration` function parses a duration string such as "1h" into the number of seconds it represents.
```
{{ parseDuration "1h" }}
```
```
3600
```
#### stripDomain
The `stripDomain` removes the domain part of a FQDN, leaving port untouched:
```
{{ stripDomain "example.com:8080" }}
```
```
example:8080
```
#### tableLink
The `tableLink` function returns the path to the tabular view in [Explore](ref:explore) for the given expression and data source:
```
{{ tableLink "{\"expr\": \"up\", \"datasource\": \"gdev-prometheus\"}" }}
```
```
/explore?left=["now-1h","now","gdev-prometheus",{"datasource":"gdev-prometheus","expr":"up","instant":true,"range":false}]
```
#### args
The `args` function translates a list of objects to a map with keys arg0, arg1 etc. This is intended to allow multiple arguments to be passed to templates:
```
{{define "x"}}{{.arg0}} {{.arg1}}{{end}}{{template "x" (args 1 "2")}}
```
```
1 2
```
#### safeHtml
The `safeHtml` function marks string as HTML not requiring auto-escaping:
```
{{ safeHtml "<b>Text</b>"}}
```
```
<b>Text</b>
```
#### externalURL
The `externalURL` function returns the external URL of the Grafana server as configured in the ini file(s):
```
{{ externalURL }}
```
```
https://example.com/grafana
```
#### pathPrefix
The `pathPrefix` function returns the path of the Grafana server as configured in the ini file(s):
```
{{ pathPrefix }}
```
```
/grafana
```
## Differences with notification templates
Both notification templates and alert rule templates use the Go templating system. However, the [functions and variables available in notification templates](ref:notification-template-reference) differ from those used in annotations and labels templates, which are described in this documentation.
Annotation and label templates operate in the context of an individual alert instance, while notification templates apply to a notification that includes a group of alert(s).
For example, notification templates provide the `.Alerts` variable, which includes the list of all firing and resolved alerts in the notification. This variable is not available in alert rule templates, which operate within the context of a single alert instance.
Additionally, you cannot reuse templates for labels and annotations as you can with notification templates. Instead, you need to write each template inline within the label or annotation fields and manually copy them wherever you want to reuse the templates.

View File

@@ -1,459 +0,0 @@
---
aliases:
- ../fundamentals/annotation-label/variables-label-annotation/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/annotation-label/variables-label-annotation/
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/templating-labels-annotations/
description: Learn about how to template labels and annotations
keywords:
- grafana
- alerting
- templating
- labels
- annotations
labels:
products:
- cloud
- enterprise
- oss
title: Template labels and annotations
weight: 500
refs:
explore:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/
---
# Template labels and annotations
You can use templates to include data from queries and expressions in labels and annotations. For example, you might want to set the severity label for an alert based on the value of the query, or use the instance label from the query in a summary annotation so you know which server is experiencing high CPU usage.
When using custom labels with templates it is important to make sure that the label value does not change between consecutive evaluations of the alert rule as this will end up creating large numbers of distinct alerts. However, it is OK for the template to produce different label values for different alerts. For example, do not put the value of the query in a custom label as this will end up creating a new set of alerts each time the value changes. Instead use annotations.
All templates should be written in [text/template](https://pkg.go.dev/text/template). Regardless of whether you are templating a label or an annotation, you should write each template inline inside the label or annotation that you are templating. This means you cannot share templates between labels and annotations, and instead you will need to copy templates wherever you want to use them.
Each template is evaluated whenever the alert rule is evaluated, and is evaluated for every alert separately. For example, if your alert rule has a templated summary annotation, and the alert rule has 10 firing alerts, then the template will be executed 10 times, once for each alert. You should try to avoid doing expensive computations in your templates as much as possible.
{{% admonition type="caution" %}}
Extra whitespace in label templates can break matches with notification policies.
{{% /admonition %}}
## Variables
In Grafana templating, the `$` and `.` symbols are used to reference variables and their properties. You can reference variables directly in your alert rule definitions using the `$` symbol followed by the variable name. Similarly, you can access properties of variables using the dot (`.`) notation within alert rule definitions.
The following variables are available to you when templating labels and annotations:
### The labels variable
The `$labels` variable contains all labels from the query. For example, suppose you have a query that returns CPU usage for all of your servers, and you have an alert rule that fires when any of your servers have exceeded 80% CPU usage for the last 5 minutes. You want to add a summary annotation to the alert that tells you which server is experiencing high CPU usage. With the `$labels` variable you can write a template that prints a human-readable sentence such as:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes
```
> If you are using a classic condition then `$labels` will not contain any labels from the query. Classic conditions discard these labels in order to enforce uni-dimensional behavior (at most one alert per alert rule). If you want to use labels from the query in your template then use the example [here](#print-all-labels-from-a-classic-condition).
### The value variable
The `$value` variable is a string containing the labels and values of all instant queries; threshold, reduce and math expressions, and classic conditions in the alert rule. It does not contain the results of range queries, as these can return anywhere from 10s to 10,000s of rows or metrics. If it did, for especially large queries a single alert could use 10s of MBs of memory and Grafana would run out of memory very quickly.
To print the `$value` variable in the summary you would write something like this:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes: {{ $value }}
```
And would look something like this:
```
CPU usage for instance1 has exceeded 80% for the last 5 minutes: [ var='A' labels={instance=instance1} value=81.234 ]
```
Here `var='A'` refers to the instant query with Ref ID A, `labels={instance=instance1}` refers to the labels, and `value=81.234` refers to the average CPU usage over the last 5 minutes.
If you want to print just some of the string instead of the full string then use the `$values` variable. It contains the same information as `$value`, but in a structured table, and is much easier to use then writing a regular expression to match just the text you want.
### The values variable
The `$values` variable is a table containing the labels and floating point values of all instant queries and expressions, indexed by their Ref IDs.
To print the value of the instant query with Ref ID A:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes: {{ index $values "A" }}
```
For example, given an alert with the labels `instance=server1` and an instant query with the value `81.2345`, this would print:
```
CPU usage for instance1 has exceeded 80% for the last 5 minutes: 81.2345
```
If the query in Ref ID A is a range query rather than an instant query then add a reduce expression with Ref ID B and replace `(index $values "A")` with `(index $values "B")`:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes: {{ index $values "B" }}
```
## Examples
The following examples attempt to show the most common use-cases we have seen for templates. You can use these examples verbatim, or adapt them as necessary for your use case. For more information on how to write text/template refer see [the beginner's guide to alert notification templates in Grafana](https://grafana.com/blog/2023/04/05/grafana-alerting-a-beginners-guide-to-templating-alert-notifications/).
### Print all labels, comma separated
To print all labels, comma separated, print the `$labels` variable:
```
{{ $labels }}
```
For example, given an alert with the labels `alertname=High CPU usage`, `grafana_folder=CPU alerts` and `instance=server1`, this would print:
```
alertname=High CPU usage, grafana_folder=CPU alerts, instance=server1
```
> If you are using classic conditions then `$labels` will not contain any labels from the query. Refer to [the $labels variable](#the-labels-variable) for more information.
### Print all labels, one per line
To print all labels, one per line, use a `range` to iterate over each key/value pair and print them individually. Here `$k` refers to the name and `$v` refers to the value of the current label:
```
{{ range $k, $v := $labels -}}
{{ $k }}={{ $v }}
{{ end }}
```
For example, given an alert with the labels `alertname=High CPU usage`, `grafana_folder=CPU alerts` and `instance=server1`, this would print:
```
alertname=High CPU usage
grafana_folder=CPU alerts
instance=server1
```
> If you are using classic conditions then `$labels` will not contain any labels from the query. Refer to [the $labels variable](#the-labels-variable) for more information.
### Print an individual label
To print an individual label use the `index` function with the `$labels` variable:
```
The host {{ index $labels "instance" }} has exceeded 80% CPU usage for the last 5 minutes
```
For example, given an alert with the labels `instance=server1`, this would print:
```
The host server1 has exceeded 80% CPU usage for the last 5 minutes
```
> If you are using classic conditions then `$labels` will not contain any labels from the query. Refer to [the $labels variable](#the-labels-variable) for more information.
### Print the value of a query
To print the value of an instant query you can print its Ref ID using the `index` function and the `$values` variable:
```
{{ index $values "A" }}
```
For example, given an instant query that returns the value 81.2345, this will print:
```
81.2345
```
To print the value of a range query you must first reduce it from a time series to an instant vector with a reduce expression. You can then print the result of the reduce expression by using its Ref ID instead. For example, if the reduce expression takes the average of A and has the Ref ID B you would write:
```
{{ index $values "B" }}
```
### Print the humanized value of a query
To print the humanized value of an instant query use the `humanize` function:
```
{{ humanize (index $values "A").Value }}
```
For example, given an instant query that returns the value 81.2345, this will print:
```
81.234
```
To print the humanized value of a range query you must first reduce it from a time series to an instant vector with a reduce expression. You can then print the result of the reduce expression by using its Ref ID instead. For example, if the reduce expression takes the average of A and has the Ref ID B you would write:
```
{{ humanize (index $values "B").Value }}
```
### Print the value of a query as a percentage
To print the value of an instant query as a percentage use the `humanizePercentage` function:
```
{{ humanizePercentage (index $values "A").Value }}
```
This function expects the value to be a decimal number between 0 and 1. If the value is instead a decimal number between 0 and 100 you can either divide it by 100 in your query or using a math expression. If the query is a range query you must first reduce it from a time series to an instant vector with a reduce expression.
### Set a severity from the value of a query
To set a severity label from the value of a query use an if statement and the greater than comparison function. Make sure to use decimals (`80.0`, `50.0`, `0.0`, etc) when doing comparisons against `$values` as text/template does not support type coercion. You can find a list of all the supported comparison functions [here](https://pkg.go.dev/text/template#hdr-Functions).
```
{{ if (gt $values.A.Value 80.0) -}}
high
{{ else if (gt $values.A.Value 50.0) -}}
medium
{{ else -}}
low
{{- end }}
```
### Print all labels from a classic condition
You cannot use `$labels` to print labels from the query if you are using classic conditions, and must use `$values` instead. The reason for this is classic conditions discard these labels to enforce uni-dimensional behavior (at most one alert per alert rule). If classic conditions didn't discard these labels, then queries that returned many time series would cause alerts to flap between firing and resolved constantly as the labels would change every time the alert rule was evaluated.
Instead, the `$values` variable contains the reduced values of all time series for all conditions that are firing. For example, if you have an alert rule with a query A that returns two time series, and a classic condition B with two conditions, then `$values` would contain `B0`, `B1`, `B2` and `B3`. If the classic condition B had just one condition, then `$values` would contain just `B0` and `B1`.
To print all labels of all firing time series use the following template (make sure to replace `B` in the regular expression with the Ref ID of the classic condition if it's different):
```
{{ range $k, $v := $values -}}
{{ if (match "B[0-9]+" $k) -}}
{{ $k }}: {{ $v.Labels }}{{ end }}
{{ end }}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: instance=server1
B1: instance=server2
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then its labels will be duplicated for each condition that is exceeded:
```
B0: instance=server1
B1: instance=server2
B2: instance=server1
B3: instance=server2
```
If you need to print unique labels you should consider changing your alert rules from uni-dimensional to multi-dimensional instead. You can do this by replacing your classic condition with reduce and math expressions.
### Print all values from a classic condition
To print all values from a classic condition take the previous example and replace `$v.Labels` with `$v.Value`:
```
{{ range $k, $v := $values -}}
{{ if (match "B[0-9]+" $k) -}}
{{ $k }}: {{ $v.Value }}{{ end }}
{{ end }}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: 81.2345
B1: 84.5678
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then `$values` will contain the values of all conditions:
```
B0: 81.2345
B1: 92.3456
B2: 84.5678
B3: 95.6789
```
## Functions
The following functions are available to you when templating labels and annotations:
### args
The `args` function translates a list of objects to a map with keys arg0, arg1 etc. This is intended to allow multiple arguments to be passed to templates:
```
{{define "x"}}{{.arg0}} {{.arg1}}{{end}}{{template "x" (args 1 "2")}}
```
```
1 2
```
### externalURL
The `externalURL` function returns the external URL of the Grafana server as configured in the ini file(s):
```
{{ externalURL }}
```
```
https://example.com/grafana
```
### graphLink
The `graphLink` function returns the path to the graphical view in [Explore](ref:explore) for the given expression and data source:
```
{{ graphLink "{\"expr\": \"up\", \"datasource\": \"gdev-prometheus\"}" }}
```
```
/explore?left=["now-1h","now","gdev-prometheus",{"datasource":"gdev-prometheus","expr":"up","instant":false,"range":true}]
```
### humanize
The `humanize` function humanizes decimal numbers:
```
{{ humanize 1000.0 }}
```
```
1k
```
### humanize1024
The `humanize1024` works similar to `humanize` but but uses 1024 as the base rather than 1000:
```
{{ humanize1024 1024.0 }}
```
```
1ki
```
### humanizeDuration
The `humanizeDuration` function humanizes a duration in seconds:
```
{{ humanizeDuration 60.0 }}
```
```
1m 0s
```
### humanizePercentage
The `humanizePercentage` function humanizes a ratio value to a percentage:
```
{{ humanizePercentage 0.2 }}
```
```
20%
```
### humanizeTimestamp
The `humanizeTimestamp` function humanizes a Unix timestamp:
```
{{ humanizeTimestamp 1577836800.0 }}
```
```
2020-01-01 00:00:00 +0000 UTC
```
### match
The `match` function matches the text against a regular expression pattern:
```
{{ match "a.*" "abc" }}
```
```
true
```
### pathPrefix
The `pathPrefix` function returns the path of the Grafana server as configured in the ini file(s):
```
{{ pathPrefix }}
```
```
/grafana
```
### tableLink
The `tableLink` function returns the path to the tabular view in [Explore](ref:explore) for the given expression and data source:
```
{{ tableLink "{\"expr\": \"up\", \"datasource\": \"gdev-prometheus\"}" }}
```
```
/explore?left=["now-1h","now","gdev-prometheus",{"datasource":"gdev-prometheus","expr":"up","instant":true,"range":false}]
```
### title
The `title` function capitalizes the first character of each word:
```
{{ title "hello, world!" }}
```
```
Hello, World!
```
### toLower
The `toLower` function returns all text in lowercase:
```
{{ toLower "Hello, world!" }}
```
```
hello, world!
```
### toUpper
The `toUpper` function returns all text in uppercase:
```
{{ toUpper "Hello, world!" }}
```
```
HELLO, WORLD!
```
### reReplaceAll
The `reReplaceAll` function replaces text matching the regular expression:
```
{{ reReplaceAll "localhost:(.*)" "example.com:$1" "localhost:8080" }}
```
```
example.com:8080
```

View File

@@ -26,9 +26,9 @@ refs:
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/notification-policies/
templates-page:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/templates/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/templates/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/templates/
---
# Configure notifications

View File

@@ -26,6 +26,16 @@ labels:
title: Configure contact points
weight: 410
refs:
sns:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/manage-contact-points/integrations/configure-amazon-sns/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/manage-contact-points/integrations/configure-amazon-sns/
gchat:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/manage-contact-points/integrations/configure-google-chat/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/manage-contact-points/integrations/configure-google-chat/
email:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/manage-contact-points/integrations/configure-email/
@@ -81,27 +91,28 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/manage-contact-points/integrations/configure-mqtt/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/manage-contact-points/integrations/configure-mqtt/
manage-notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/manage-notification-templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/manage-notification-templates/
---
# Configure contact points
Use contact points to select your preferred communication channel for receiving notifications when your alert rules are firing. You can add, edit, delete, export, and test a contact point.
Use contact points to specify where to receive alert notifications. Contact points contain the configuration for sending alert notifications, including destinations like email, Slack, OnCall, webhooks, and their notification messages.
Testing a contact point is only available for Grafana Alertmanager.
A contact point can have one or multiple destinations, known as [contact point integrations](#list-of-supported-integrations). Alert notifications are sent to each integration within the chosen contact point.
On the **Contact Points** tab, you can:
- Add, edit, and view contact points and integrations.
- Search for name and type of contact points and integrations.
- View all existing contact points and integrations.
- View how many notification policies each contact point is being used for and navigate directly to the linked notification policies.
- View the status of notification deliveries.
- Export individual contact points or all contact points in JSON, YAML, or Terraform format.
- Delete contact points. Note that you cannot delete contact points that are in use by a notification policy. To proceed, either delete the notification policy or update it to use another contact point.
On the **Notification templates** tab, you can:
- View, edit, copy or delete existing notification templates.
## Add a contact point
Complete the following steps to add a contact point.
@@ -114,41 +125,23 @@ Complete the following steps to add a contact point.
1. From **Integration**, select a type and fill out mandatory fields. For example, if you choose email, enter the email addresses. Or if you choose Slack, enter the Slack channel and users who should be contacted.
1. Some contact point integrations, like email or Webhook, have optional settings. In **Optional settings**, specify additional settings for the selected contact point integration.
1. In Notification settings, optionally select **Disable resolved message** if you do not want to be notified when an alert resolves.
1. To add another contact point integration, click **Add contact point integration** and repeat steps 6 through 8.
1. Save your changes.
## Use notification templates
## Add another contact point integration
Use templates in contact points to customize your notifications.
A contact point can have multiple integrations, or destinations for sending notifications.
Complete the following steps to add templates to your contact point.
To add another integration to a contact point, complete the following steps.
1. Click an existing contact point or create a new one
1. In **Optional settings**, click any field that contains templates.
For example, if you are creating an email contact point integration, click **Message** or **Subject**.
1. Click **Edit**.
A dialog box opens where you can select templates.
1. [Optional] Click **Select existing template** to select a template and preview it using the default payload.
Click **Save** to use just a single template in the field.
You can also copy the selected template and use it in the custom tab.
1. [Optional] Click **Enter custom message** to customize and edit the field directly. Note that the title changes depending on the field you are editing.
Click **Save** to use just a single template in the field.
1. You can switch between the two tabs to access the list of available templates and copy them across to the customized version.
1. Click **Save contact point**.
1. Add or edit an existing contact point.
1. Click **Add contact point integration** and repeat the same steps as [Add a contact point](#add-a-contact-point).
- From **Integration**, select a type and fill out mandatory fields.
- In **Optional settings**, specify additional settings for the selected contact point integration.
1. Save your changes.
## Test a contact point
** For Grafana Alertmanager only.**
Complete the following steps to test a contact point.
Testing a contact point is only available for Grafana Alertmanager. Complete the following steps to test a contact point.
1. In the left-side menu, click **Alerts & IRM** and then **Alerting**.
1. Click **Contact points** to view a list of existing contact points.
@@ -166,17 +159,17 @@ The following table lists the contact point integrations supported by Grafana.
| Name | Type |
| ---------------------------- | ------------------------- |
| Alertmanager | `prometheus-alertmanager` |
| Amazon SNS | `sns` |
| [Amazon SNS](ref:sns) | `sns` |
| Cisco Webex Teams | `webex` |
| DingDing | `dingding` |
| [Discord](ref:discord) | `discord` |
| [Email](ref:email) | `email` |
| Google Chat | `googlechat` |
| [Google Chat](ref:gchat) | `googlechat` |
| [Grafana Oncall](ref:oncall) | `oncall` |
| Kafka REST Proxy | `kafka` |
| [MQTT](ref:mqtt) | `mqtt` |
| Line | `line` |
| [Microsoft Teams](ref:teams) | `teams` |
| [MQTT](ref:mqtt) | `mqtt` |
| [Opsgenie](ref:opsgenie) | `opsgenie` |
| [Pagerduty](ref:pagerduty) | `pagerduty` |
| Pushover | `pushover` |
@@ -185,7 +178,17 @@ The following table lists the contact point integrations supported by Grafana.
| [Telegram](ref:telegram) | `telegram` |
| Threema Gateway | `threema` |
| VictorOps | `victorops` |
| WeCom | `wecom` |
| [Webhook](ref:webhook) | `webhook` |
| WeCom | `wecom` |
Some of these integrations are not compatible with [external Alertmanagers](ref:external-alertmanager). For the list of Prometheus Alertmanager integrations, refer to the [Prometheus Alertmanager receiver settings](https://prometheus.io/docs/alerting/latest/configuration/#receiver-integration-settings).
## Customize notification messages
In contact points, you can also customize notification messages. For example, when setting up an email contact point integration, click **Message** or **Subject** to modify it.
By default, notification messages include common alert details, which are usually sufficient for most cases.
If necessary, you can customize the content and format of notification messages. You can create a custom notification template, which can then be applied to one or more contact points.
On the **Notification templates** tab, you can view, edit, copy or delete notification templates. Refer to [manage notification templates](ref:manage-notification-templates) for instructions on selecting or creating a template for a contact point.

View File

@@ -13,7 +13,7 @@ labels:
- oss
menuTitle: Amazon SNS
title: Configure Amazon SNS for Alerting
weight: 0
weight: 100
---
# Configure Amazon SNS for Alerting

View File

@@ -13,7 +13,7 @@ labels:
- oss
menuTitle: Discord
title: Configure Discord for Alerting
weight: 0
weight: 105
---
# Configure Discord for Alerting

View File

@@ -13,13 +13,21 @@ labels:
- oss
menuTitle: Email
title: Configure email for Alerting
weight: 0
weight: 110
refs:
notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/
---
# Configure email for Alerting
Use the Grafana Alerting - email integration to send email notifications when your alerts are firing. An email is sent when an alert fires and when an alert gets resolved.
Note that you can customize the `subject` and `message` of the email using [notification templates](ref:notification-templates). However, you cannot add HTML and CSS to email notifications for visual changes.
## Before you begin
{{<admonition type="note">}}

View File

@@ -13,7 +13,7 @@ labels:
- oss
menuTitle: Google Chat
title: Configure Google Chat for Alerting
weight: 0
weight: 115
---
# Configure Google Chat for Alerting

View File

@@ -12,9 +12,9 @@ labels:
- cloud
- enterprise
- oss
menuTitle: MQTT notifier
menuTitle: MQTT
title: Configure the MQTT notifier for Alerting
weight: 0
weight: 140
---
# Configure the MQTT notifier for Alerting

View File

@@ -2,6 +2,7 @@
aliases:
- ../../../alerting-rules/manage-contact-points/configure-oncall/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/manage-contact-points/configure-oncall/
- ../../../alerting-rules/manage-contact-points/integrations/configure-oncall/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/manage-contact-points/integrations/configure-oncall/
- ../configure-oncall/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/manage-contact-points/configure-oncall/
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/configure-oncall/
description: Configure the Alerting - Grafana OnCall integration to connect alerts generated by Grafana Alerting with Grafana OnCall
keywords:
@@ -9,8 +10,6 @@ keywords:
- alerting
- oncall
- integration
aliases:
- ../configure-oncall/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/manage-contact-points/configure-oncall/
labels:
products:
- cloud
@@ -18,7 +17,7 @@ labels:
- oss
menuTitle: Grafana OnCall
title: Configure Grafana OnCall for Alerting
weight: 0
weight: 120
---
# Configure Grafana OnCall for Alerting
@@ -26,7 +25,7 @@ weight: 0
Use the Grafana Alerting - Grafana OnCall integration to effortlessly connect alerts generated by Grafana Alerting with Grafana OnCall, where you can then route them according to defined escalation chains and schedules.
{{< admonition type="note" >}}
You can also configure the integration from Grafana OnCall. For more information, refer to [Grafana OnCall documentation](http://grafana.com/docs/oncall/latest/integrations/grafana-alerting/).
You can also configure the integration from Grafana OnCall. For more information, refer to [Grafana OnCall documentation](http://grafana.com/docs/oncall/latest/configure/integrations/references/grafana-alerting/).
{{< /admonition >}}
## Before you begin

View File

@@ -13,7 +13,7 @@ labels:
- oss
menuTitle: Opsgenie
title: Configure Opsgenie for Alerting
weight: 0
weight: 145
---
# Configure Opsgenie for Alerting

View File

@@ -13,8 +13,13 @@ labels:
- oss
menuTitle: Slack
title: Configure Slack for Alerting
weight: 0
weight: 155
refs:
notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/
nested-policy:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/create-notification-policy/#add-new-nested-policy
@@ -36,9 +41,9 @@ There are two ways of integrating Slack into Grafana Alerting.
Webhooks is the simpler way to post messages into Slack. Slack automatically creates a bot user with all the necessary permissions to post messages to one particular channel of your choice.
{{< admonition type="note" >}}
Grafana Alerting only allows one Slack channel per contact point.
{{< /admonition >}}
Note that you can only setup one Slack channel per contact point.
You can customize the `title` and `body` of the Slack message using [notification templates](ref:notification-templates); however, you cannot modify its visual appearance with custom blocks.
## Before you begin
@@ -53,17 +58,12 @@ If you are using a Slack API Token, complete the following steps.
1. Right click the channel you want to receive notifications in.
1. Click View channel details.
1. Scroll down and copy the Channel ID.
{{< admonition type="note" >}}
While going through these steps, Slack may prompt you to Reinstall your app in order for the changes to take effect.
{{< /admonition >}}
Note that while going through these steps, Slack may prompt you to Reinstall your app in order for the changes to take effect.
### Webhook URL
If you are using a Webhook URL, follow steps 1 and 5 in the [Slack API Quickstart](https://api.slack.com/start/quickstart).
{{< admonition type="note" >}}
Make sure you copy the Slack app Webhook URL. You need this when setting up your contact point integration in Grafana Alerting.
{{< /admonition >}}
If you are using a Webhook URL, follow steps 1 and 5 in the [Slack API Quickstart](https://api.slack.com/start/quickstart), and copy the Slack app Webhook URL. You need this when setting up your contact point integration in Grafana Alerting.
## Procedure

View File

@@ -13,13 +13,21 @@ labels:
- oss
menuTitle: Microsoft Teams
title: Configure Microsoft Teams for Alerting
weight: 0
weight: 135
refs:
notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/
---
# Configure Microsoft Teams for Alerting
Use the Grafana Alerting - Microsoft Teams integration to receive notifications in your teams channel when your alerts are firing.
Note that you can customize the `title` and `message` of the notification using [notification templates](ref:notification-templates); however, you cannot modify its visual appearance with adaptive cards.
## Before you begin
To set up Microsoft Teams for integration with Grafana Alerting, create a new workflow that accepts Webhook requests. This allows Grafana to send alert notifications to Microsoft Teams channels.

View File

@@ -13,7 +13,7 @@ labels:
- oss
menuTitle: Telegram
title: Configure Telegram for Alerting
weight: 0
weight: 160
---
# Configure Telegram for Alerting

View File

@@ -14,7 +14,7 @@ labels:
- oss
menuTitle: PagerDuty
title: Configure PagerDuty for Alerting
weight: 0
weight: 150
---
# Configure PagerDuty for Alerting

View File

@@ -19,9 +19,15 @@ labels:
- cloud
- enterprise
- oss
menuTitle: Webhook notifier
menuTitle: Webhook
title: Configure the webhook notifier for Alerting
weight: 0
weight: 165
refs:
notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/
---
# Configure the webhook notifier for Alerting
@@ -139,7 +145,11 @@ The webhook notification is a simple way to send information about a state chang
| imageURL | string | URL of a screenshot of a panel assigned to the rule that created this notification |
{{< admonition type="note" >}}
Alert rules are not coupled to dashboards anymore therefore the fields related to dashboards `dashboardId` and `panelId` have been removed.
You can customize the `title` and `message` fields using [notification templates](ref:notification-templates).
However, you cannot customize webhook data structure or format, including JSON fields or sending data in XML, nor can you change the webhook HTTP headers.
{{< /admonition >}}
## Procedure

View File

@@ -13,55 +13,98 @@ labels:
- cloud
- enterprise
- oss
title: Configure notification messages
title: Template notifications
weight: 430
refs:
use-notification-templates:
template-annotations-and-labels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/use-notification-templates/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/use-notification-templates/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/
manage-notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/manage-notification-templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/manage-notification-templates/
reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
using-go-templating-language:
examples:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/using-go-templating-language/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/examples/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/using-go-templating-language/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/examples/
---
# Configure notification messages
# Template notifications
Customize the content of your notifications with notifications templates.
You can use notification templates to change the title, message, and format of notifications.
You can use notification templates to change the title, message, and format of the message in your notifications.
Grafana provides a **default template** for notification titles (`default.title`) and one default template for notification messages (`default.message`). Both templates display common alert details.
Notification templates are not tied to specific contact point integrations, such as email or Slack. However, you can choose to create separate notification templates for different contact point integrations.
You can also create a notification template to customize the content and format of your notification messages. For example:
You can use notification templates to:
- Customize content: Personalize the subject of an email or the title of a message. Modify text within notifications, like selecting or omitting certain labels, annotations, and links. Format text with bold and italic styles, and add or remove line breaks.
- Personalize the subject of an email or the title of a message.
- Modify text within notifications, like selecting or omitting certain labels, annotations, and links.
- Format text with bold and italic styles, and add or remove line breaks.
However, there are limitations. You cannot:
- Modify Visual Appearance: Add HTML and CSS to email notifications for visual changes. Alter the design of notifications in messaging services like Slack and Microsoft Teams, such as adding custom blocks or adaptive cards.
- Manage Media and Data: Adjust the number and size of images or their placement in notifications. Customize webhook data structure or format, including JSON fields or sending data in XML. Modify HTTP headers in webhooks beyond those in the contact point configuration.
- Modify Visual Appearance: Add HTML or CSS to email notifications for visual changes. Alter the design of notifications in messaging services like Slack or Microsoft Teams, such as adding custom blocks or adaptive cards.
- Manage Media and Data: Customize the data structure or format passed to the templates, like adding new JSON fields or sending XML data for webhooks. Modify HTTP headers in webhooks beyond those defined in the configuration, or adjust the number, size, or placement of images.
## Learn more
Here's an [example](ref:examples) that displays the summary and description annotations for each alert in the notification:
[Using Go's templating language](ref:using-go-templating-language)
```go
{{ define "custom.alerts" -}}
{{ len .Alerts }} alert(s)
{{ range .Alerts -}}
{{ template "alert.summary_and_description" . -}}
{{ end -}}
{{ end -}}
{{ define "alert.summary_and_description" }}
Summary: {{.Annotations.summary}}
Status: {{ .Status }}
Description: {{.Annotations.description}}
{{ end -}}
```
Learn how to write the content of your notification templates in Gos templating language.
The notification message would look like this:
Create reusable notification templates for your contact points.
```
2 alert(s)
[Use notification templates](ref:use-notification-templates)
Summary: The database server db1 has exceeded 75% of available disk space.
Status: firing
Description: This alert fires when a database server is at risk of running out of disk space. You should take measures to increase the maximum available disk space as soon as possible to avoid possible corruption.
Use notification templates to send notifications to your contact points.
Summary: The web server web1 has been responding to 5% of HTTP requests with 5xx errors for the last 5 minutes.
Status: resolved
Description: This alert fires when a web server responds with more 5xx errors than is expected. This could be an issue with the web server or a backend service.
```
[Reference](ref:reference)
{{% admonition type="note" %}}
Avoid adding extra information about alert instances in notification templates, as this information will only be visible in the notification message.
Data that is available when writing templates.
Instead, you should [use annotations or labels](ref:template-annotations-and-labels) to add information directly to the alert, ensuring it's also visible in the alert state and alert history within Grafana. You can then print the new alert annotation or label in notification templates.
{{% /admonition %}}
#### Select a notification template for a contact point
Notification templates are not tied to specific contact point integrations, such as email or Slack, and the same template can be shared across multiple contact points.
The notification template is assigned to the contact point to determine the notification message sent to contact point integrations.
{{< figure src="/media/docs/alerting/how-notification-templates-works.png" max-width="1200px" caption="A flow of the alert notification process, from querying the alert rule to sending the alert notification message." >}}
By default, Grafana provides default templates, such as `default.title` and `default.message`, to format notification messages.
## More information
For further details on how to write notification templates, refer to:
- [Select, create, and preview a notification template](ref:manage-notification-templates)
- [Notification template reference](ref:reference)
- [Notification template examples](ref:examples)

View File

@@ -1,376 +0,0 @@
---
aliases:
- ../../manage-notifications/template-notifications/create-notification-templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/create-notification-templates/
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/create-notification-templates/
description: Create notification templates to sent to your contact points
keywords:
- grafana
- alerting
- notifications
- templates
- create templates
- edit templates
- delete templates
labels:
products:
- cloud
- enterprise
- oss
title: Create notification templates
weight: 200
---
# Create notification templates
Create reusable notification templates to send to your contact points.
You can add one or more templates to your notification template.
Your notification template name must be unique. You cannot have two templates with the same name in the same notification template or in different notification templates. Avoid defining templates with the same name as default templates, such as: `__subject`, `__text_values_list`, `__text_alert_list`, `default.title` and `default.message`.
To create a notification template, complete the following steps.
1. Click **Alerts & IRM** -> **Contact points**.
1. Click the **Notification Templates** tab and then **+ Add notification template**.
1. Enter a name for the notification template.
1. Write the content of the template in the content field.
1. Save your changes.
`{{ define "email.subject" }}` and `{{ end }}` is automatically added to the start and end of the content:
To create a notification template that contains more than one template:
1. Click **+ Add notification template**.
2. Enter a name for the notification template.
3. Write each template in the Content field, including `{{ define "name-of-template" }}` and `{{ end }}` at the start and end of each template.
4. Save your changes.
## Preview notification templates
Preview how your notification templates should look before using them in your contact points, helping you understand the result of the template you are creating as well as enabling you to fix any errors before saving it.
**Note:** This feature is only for Grafana Alertmanager.
To preview your notification templates:
1. Navigate to **Alerts&IRM** -> **Alerting** -> **Contact points** -> **Notification Templates**.
1. Click **+ Add notification template** or edit an existing template.
1. Add or update your template content.
Default data is provided and you can add or edit alert data to it as well as alert instances. You can add alert data directly in the Payload data window itself or click **Select alert instances** or **Add custom alerts**.
1. Optional: To add alert data from existing alert instances:
a. Click **Select alert instances**.
b. Hover over the alert instances to view more information on each alert instance.
c. Click **Confirm** to add the alert instance(s) to the payload.
1. Optional: To add alert data using the Alert data editor, click **Add custom data:**
a. Add annotations, custom labels and/or set a dashboard or a panel.
b. Toggle Firing/resolved depending on whether you want to add firing or resolved alerts to your notification.
c. Click **Add alert data**.
d. Click **Refresh preview** to see what your template content should look like and the corresponding payload data.
If there are any errors in your template, they are displayed in the Preview and you can correct them before saving.
1. Save your changes.
## Template the subject of an email
Template the subject of an email to contain the number of firing and resolved alerts:
```
1 firing alert(s), 0 resolved alerts(s)
```
1. Create a template called `email.subject` with the following content:
```
{{ define "email.subject" }}
{{ len .Alerts.Firing }} firing alert(s), {{ len .Alerts.Resolved }} resolved alert(s)
{{ end }}
```
2. Execute the template from the subject field in your contact point integration:
```
{{ template "email.subject" . }}
```
## Template the message of an email
Template the message of an email to contain a summary of all firing and resolved alerts:
```
There are 2 firing alert(s), and 1 resolved alert(s)
Firing alerts:
- alertname=Test 1 grafana_folder=GrafanaCloud has value(s) B=1
- alertname=Test 2 grafana_folder=GrafanaCloud has value(s) B=2
Resolved alerts:
- alertname=Test 3 grafana_folder=GrafanaCloud has value(s) B=0
```
1. Create a notification template called `email` with two templates in the content: `email.message_alert` and `email.message`.
The `email.message_alert` template is used to print the labels and values for each firing and resolved alert while the `email.message` template contains the structure of the email.
```
{{- define "email.message_alert" -}}
{{- range .Labels.SortedPairs }}{{ .Name }}={{ .Value }} {{ end }} has value(s)
{{- range $k, $v := .Values }} {{ $k }}={{ $v }}{{ end }}
{{- end -}}
{{ define "email.message" }}
There are {{ len .Alerts.Firing }} firing alert(s), and {{ len .Alerts.Resolved }} resolved alert(s)
{{ if .Alerts.Firing -}}
Firing alerts:
{{- range .Alerts.Firing }}
- {{ template "email.message_alert" . }}
{{- end }}
{{- end }}
{{ if .Alerts.Resolved -}}
Resolved alerts:
{{- range .Alerts.Resolved }}
- {{ template "email.message_alert" . }}
{{- end }}
{{- end }}
{{ end }}
```
2. Execute the template from the message field in your contact point integration:
```
{{ template "email.message" . }}
```
## Group multiple alert instances into one email notification
To make alerts more concise, you can group multiple instances of a firing alert into a single email notification in a table format. This way, you avoid long, repetitive emails and make alerts easier to digest.
Follow these steps to create a custom notification template that consolidates alert instances into a table.
1. Modify the alert rule to include an annotation that is referenced in the notification template later on.
1. Enter a name for the **custom annotation**: In this example, _ServerInfo_.
1. Enter the following code as the value for the annotation. It retrieves the server's instance name and a corresponding metric value, formatted as a table row:
```
{{ index $labels "instance" }}{{- "\t" -}}{{ index $values "A"}}{{- "\n" -}}
```
This line of code returns the labels and their values in the form of a table. Assuming $labels has `{"instance": "node1"}` and $values has `{"A": "123"}`, the output would be:
```
node1 123
```
1. Create a notification template that references the _ServerInfo_ annotation.
```go
{{ define "Table" }}
{{- "\nHost\t\tValue\n" -}}
{{ range .Alerts -}}
{{ range .Annotations.SortedPairs -}}
{{ if (eq .Name "ServerInfo") -}}
{{ .Value -}}
{{- end }}
{{- end }}
{{- end }}
{{ end }}
```
The notification template outputs a list of server information from the "ServerInfo" annotation for each alert instance.
1. Navigate to your contact point in Grafana
1. In the **Message** field, reference the template by name (see **Optional Email settings** section):
```
{{ template "Table" . }}
```
This generates a neatly formatted table in the email, grouping information for all affected servers into a single notification.
## Conditional notification template
Template alert notifications based on a label. In this example the label represents a namespace.
1. Use the following code in your notification template to display different messages based on the namespace:
```go
{{ define "my_conditional_notification" }}
{{ if eq .CommonLabels.namespace "namespace-a" }}
Alert: CPU limits have reached 80% in namespace-a.
{{ else if eq .CommonLabels.namespace "namespace-b" }}
Alert: CPU limits have reached 80% in namespace-b.
{{ else if eq .CommonLabels.namespace "namespace-c" }}
Alert: CPU limits have reached 80% in namespace-c.
{{ else }}
Alert: CPU limits have reached 80% for {{ .CommonLabels.namespace }} namespace.
{{ end }}
{{ end }}
```
`.CommonLabels` is a map containing the labels that are common to all the alerts firing.
Make sure to replace the `.namespace` label with a label that exists in your alert rule.
1. Replace `namespace-a`, `namespace-b`, and `namespace-c` with your specific namespace values.
1. Navigate to your contact point in Grafana
1. In the **Message** field, reference the template by name (see **Optional settings** section):
```
{{ template "my_conditional_notification" . }}
```
This template alters the content of alert notifications depending on the namespace value.
## Template the title of a Slack message
Template the title of a Slack message to contain the number of firing and resolved alerts:
```
1 firing alert(s), 0 resolved alerts(s)
```
1. Create a template called `slack.title` with the following content:
```
{{ define "slack.title" }}
{{ len .Alerts.Firing }} firing alert(s), {{ len .Alerts.Resolved }} resolved alert(s)
{{ end }}
```
2. Execute the template from the title field in your contact point integration:
```
{{ template "slack.title" . }}
```
## Template the content of a Slack message
Template the content of a Slack message to contain a description of all firing and resolved alerts, including their labels, annotations, Silence URL and Dashboard URL.
**Note:**
This template is for Grafana-managed alerts only.
To use the template for Grafana Mimir/Loki-managed alerts, delete the references to DashboardURL and SilenceURL.
For more information, see the [Prometheus documentation on notifications](https://prometheus.io/docs/alerting/latest/notifications/).
```
1 firing alert(s):
[firing] Test1
Labels:
- alertname: Test1
- grafana_folder: GrafanaCloud
Annotations:
- description: This is a test alert
Silence: https://example.com/alerting/silence/new?alertmanager=grafana&matcher=alertname%3DTest1&matcher=grafana_folder%3DGrafanaCloud
Go to dashboard: https://example.com/d/dlhdLqF4z?orgId=1
1 resolved alert(s):
[firing] Test2
Labels:
- alertname: Test2
- grafana_folder: GrafanaCloud
Annotations:
- description: This is another test alert
Silence: https://example.com/alerting/silence/new?alertmanager=grafana&matcher=alertname%3DTest2&matcher=grafana_folder%3DGrafanaCloud
Go to dashboard: https://example.com/d/dlhdLqF4z?orgId=1
```
1. Create a template called `slack` with two templates in the content: `slack.print_alert` and `slack.message`.
The `slack.print_alert` template is used to print the labels, annotations, SilenceURL and DashboardURL while the `slack.message` template contains the structure of the notification.
```
{{ define "slack.print_alert" -}}
[{{.Status}}] {{ .Labels.alertname }}
Labels:
{{ range .Labels.SortedPairs -}}
- {{ .Name }}: {{ .Value }}
{{ end -}}
{{ if .Annotations -}}
Annotations:
{{ range .Annotations.SortedPairs -}}
- {{ .Name }}: {{ .Value }}
{{ end -}}
{{ end -}}
{{ if .SilenceURL -}}
Silence: {{ .SilenceURL }}
{{ end -}}
{{ if .DashboardURL -}}
Go to dashboard: {{ .DashboardURL }}
{{- end }}
{{- end }}
{{ define "slack.message" -}}
{{ if .Alerts.Firing -}}
{{ len .Alerts.Firing }} firing alert(s):
{{ range .Alerts.Firing }}
{{ template "slack.print_alert" . }}
{{ end -}}
{{ end }}
{{ if .Alerts.Resolved -}}
{{ len .Alerts.Resolved }} resolved alert(s):
{{ range .Alerts.Resolved }}
{{ template "slack.print_alert" .}}
{{ end -}}
{{ end }}
{{- end }}
```
2. Execute the template from the text body field in your contact point integration:
```
{{ template "slack.message" . }}
```
## Template both email and Slack with shared templates
Instead of creating separate notification templates for email and Slack, you can share the same template.
For example, if you want to send an email with this subject and Slack message with this title:
```
1 firing alert(s), 0 resolved alerts(s)
```
1. Create a template called `common.subject_title` with the following content:
```
{{ define "common.subject_title" }}
{{ len .Alerts.Firing }} firing alert(s), {{ len .Alerts.Resolved }} resolved alert(s)
{{ end }}
```
2. For email, execute the template from the subject field in your email contact point integration:
```
{{ template "common.subject_title" . }}
```
3. For Slack, execute the template from the title field in your Slack contact point integration:
```
{{ template "common.subject_title" . }}
```

View File

@@ -0,0 +1,362 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/templates/examples/
description: Examples of notification templates
keywords:
- grafana
- alerting
- templating
- notification templates
labels:
products:
- cloud
- enterprise
- oss
title: Notification template examples
menuTitle: Examples
weight: 103
refs:
template-annotations-and-labels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/
template-notifications:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/
manage-notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/manage-notification-templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/manage-notification-templates/
reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
reference-notification-data:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/#notification-data
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/#notification-data
reference-alert:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/#alert
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/#alert
language:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/language/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/language/
group-alert-notifications:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/group-alert-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/group-alert-notifications/
---
# Notification template examples
Notification templates allows you to change the default notification messages.
You can modify the content and format of notification messages. For example, you can customize the content to show only specific information or adjust the format to suit a particular contact point, such as Slack or Email.
{{% admonition type="note" %}}
Avoid adding extra information about alert instances in notification templates, as this information is only be visible in the notification message.
Instead, you should [use annotations or labels](ref:template-annotations-and-labels) to add information directly to the alert, ensuring it's also visible in the alert state and alert history within Grafana. You can then print the new alert annotation or label in notification templates.
{{% /admonition %}}
This page provides various examples illustrating how to template common notification messages. For more details about notification templates, refer to:
- [Template notifications](ref:template-notifications)
- [Select, create, and preview a notification template](ref:manage-notification-templates)
- [Notification template reference](ref:reference)
## Basic examples
Notification templates can access the [notification data](ref:reference-notification-data) using the dot (`.`). The following examples demonstrate some basic uses of the [template language](ref:language).
For instance, to check if there are common labels (`.CommonLabels`) for all alerts in the notification, use `if`:
```go
{{ define "custom_message" -}}
{{ if .CommonLabels }}
Alerts have common labels
{{ else }}
There are no common labels
{{ end }}
{{ end }}
```
To iterate on the alerts in the notification and print a specific label, use `range` and `index`:
```go
{{ define "custom_message" -}}
{{ range .Alerts }}
The name of the alert is {{ index .Labels "alertname" }}
{{ end }}
{{ end }}
```
Alternatively, you can use the `.` notation to print the value of the key.
```go
{{ define "custom_message" -}}
{{ range .Alerts }}
The name of the alert is {{ .Labels.alertname }}
{{ end }}
{{ end }}
```
```template_output
The name of the alert is InstanceDown
The name of the alert is CpuOverload
```
## Print alerts with summary and description
Here's an example that displays the summary and description annotations for each alert in the notification.
```go
{{ define "custom.alerts" -}}
{{ len .Alerts }} alert(s)
{{ range .Alerts -}}
{{ template "alert.summary_and_description" . -}}
{{ end -}}
{{ end -}}
{{ define "alert.summary_and_description" }}
Summary: {{.Annotations.summary}}
Status: {{ .Status }}
Description: {{.Annotations.description}}
{{ end -}}
```
In this example:
- A template (`alert.summary_and_description`) is defined to print the `summary`, `status`, and `description` of one [alert](ref:reference-alert).
- The main template `custom.alerts` iterates the list of alerts (`.Alerts`) in [notification data](ref:reference-notification-data), executing the `alert.summary_and_description` template to print the details of each alert.
The notification message would look like this:
```template_output
2 alert(s)
Summary: The database server db1 has exceeded 75% of available disk space.
Status: firing
Description: This alert fires when a database server is at risk of running out of disk space. You should take measures to increase the maximum available disk space as soon as possible to avoid possible corruption.
Summary: The web server web1 has been responding to 5% of HTTP requests with 5xx errors for the last 5 minutes.
Status: resolved
Description: This alert fires when a web server responds with more 5xx errors than is expected. This could be an issue with the web server or a backend service.
```
## Print firing and resolved alerts
The following example is similar to the previous one, but it separates firing and resolved alerts.
```go
{{ define "custom.firing_and_resolved_alerts" -}}
{{ len .Alerts.Resolved }} resolved alert(s)
{{ range .Alerts.Resolved -}}
{{ template "alert.summary_and_description" . -}}
{{ end }}
{{ len .Alerts.Firing }} firing alert(s)
{{ range .Alerts.Firing -}}
{{ template "alert.summary_and_description" . -}}
{{ end -}}
{{ end -}}
{{ define "alert.summary_and_description" }}
Summary: {{.Annotations.summary}}
Status: {{ .Status }}
Description: {{.Annotations.description}}
{{ end -}}
```
Instead of `.Alerts`, the template accesses `.Alerts.Firing` and `.Alerts.Resolved` separately to print details for each alert.
The output might now look like this:
```template_output
1 resolved alert(s)
Summary: The database server db1 has exceeded 75% of available disk space.
Status: resolved
Description: This alert fires when a database server is at risk of running out of disk space. You should take measures to increase the maximum available disk space as soon as possible to avoid possible corruption.
1 firing alert(s)
Summary: The web server web1 has been responding to 5% of HTTP requests with 5xx errors for the last 5 minutes.
Status: firing
Description: This alert fires when a web server responds with more 5xx errors than is expected. This could be an issue with the web server or a backend service.
```
## Print common labels and annotations
This example displays only the labels and annotations that are common to all alerts in the notification.
```go
{{ define "custom.common_labels_and_annotations" -}}
{{ len .Alerts.Resolved }} resolved alert(s)
{{ len .Alerts.Firing }} firing alert(s)
Common labels: {{ len .CommonLabels.SortedPairs }}
{{ range .CommonLabels.SortedPairs -}}
- {{ .Name }} = {{ .Value }}
{{ end }}
Common annotations: {{ len .CommonAnnotations.SortedPairs }}
{{ range .CommonAnnotations.SortedPairs }}
- {{ .Name }} = {{ .Value }}
{{ end }}
{{ end -}}
```
Note that `.CommonAnnotations` and `.CommonLabels` are part of [notification data](ref:reference-notification-data).
```template_output
1 resolved alert(s)
1 firing alert(s)
Common labels: 2
- grafana_folder = server_alerts
- team = server_admin
Common annotations: 0
```
## Print individual labels and annotations
This example displays all labels and annotations for each [alert](ref:reference-alert) in the notification.
```go
{{ define "custom.alert_labels_and_annotations" -}}
{{ len .Alerts.Resolved }} resolved alert(s)
{{ range .Alerts.Resolved -}}
{{ template "alert.labels_and_annotations" . -}}
{{ end }}
{{ len .Alerts.Firing }} firing alert(s)
{{ range .Alerts.Firing -}}
{{ template "alert.labels_and_annotations" . -}}
{{ end -}}
{{ end -}}
{{ define "alert.labels_and_annotations" }}
Alert labels: {{ len .Labels.SortedPairs }}
{{ range .Labels.SortedPairs -}}
- {{ .Name }} = {{ .Value }}
{{ end -}}
Alert annotations: {{ len .Annotations.SortedPairs }}
{{ range .Annotations.SortedPairs -}}
- {{ .Name }} = {{ .Value }}
{{ end -}}
{{ end -}}
```
In this example:
- The `custom.alert_labels_and_annotations` template iterates over the list of resolved and firing alerts, similar to previous examples. It then executes `alert.labels_and_annotations` for each alert.
- The `alert.labels_and_annotations` template prints all the alert labels and annotations by accessing `.Labels.SortedPairs` and `.Annotations.SortedPairs`.
```template_output
1 resolved alert(s)
Alert labels: 4
- alertname = db_server_disk_space
- grafana_folder = server_alerts
- server = db1
- team = server_admin
Alert annotations: 2
- summary = The database server db1 has exceeded 75% of available disk space.
- description = This alert fires when a database server is at risk of running out of disk space. You should take measures to increase the maximum available disk space as soon as possible to avoid possible corruption.
1 firing alert(s)
Alert labels: 4
- alertname = web_server_http_errors
- grafana_folder = server_alerts
- server = web1
- team = server_admin
Alert annotations: 2
- summary = The web server web1 has been responding to 5% of HTTP requests with 5xx errors for the last 5 minutes.
- description = This alert fires when a web server responds with more 5xx errors than is expected. This could be an issue with the web server or a backend service.
```
## Print URLs for runbook and alert data in Grafana
Note that the following example works only for Grafana-managed alerts. It displays some [alert data](ref:reference-alert) such as `DashboardURL`, `PanelURL`, and `SilenceURL`, which are exclusive to Grafana-managed alerts.
```go
{{ define "custom.alert_additional_details" -}}
{{ len .Alerts.Resolved }} resolved alert(s)
{{ range .Alerts.Resolved -}}
{{ template "alert.additional_details" . -}}
{{ end }}
{{ len .Alerts.Firing }} firing alert(s)
{{ range .Alerts.Firing -}}
{{ template "alert.additional_details" . -}}
{{ end -}}
{{ end -}}
{{ define "alert.additional_details" }}
- Dashboard: {{ .DashboardURL }}
- Panel: {{ .PanelURL }}
- AlertGenerator: {{ .GeneratorURL }}
- Silence: {{ .SilenceURL }}
- RunbookURL: {{ .Annotations.runbook_url}}
{{ end -}}
```
The output of this template looks like this:
```template_output
1 resolved alert(s)
- Dashboard: https://example.com/d/
- Panel: https://example.com/d/
- AlertGenerator: ?orgId=1
- Silence: https://example.com/alerting/silence/new
- RunbookURL: https://example.com/on-call/db_server_disk_space
1 firing alert(s)
- Dashboard: https://example.com/d/
- Panel: https://example.com/d/
- AlertGenerator: ?orgId=1
- Silence: https://example.com/alerting/silence/new
- RunbookURL: https://example.com/on-call/web_server_http_errors
```
## Print a notification title or subject
A title or subject provides a one-line summary of the notification content.
Heres a basic example that displays the number of firing and resolved alerts in the notification.
```go
{{ define "custom_title" -}}
{{ if gt (.Alerts.Firing | len) 0 }}🚨 {{ .Alerts.Firing | len }} firing alerts. {{ end }}{{ if gt (.Alerts.Resolved | len) 0 }} {{ .Alerts.Resolved | len }} resolved alerts.{{ end }}
{{ end -}}
```
```template_output
🚨 1 firing alerts. ✅ 1 resolved alerts.
```
The next example is a copy of the default title/subject template used in Grafana.
```go
{{ define "copy_of_default_title" -}}
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ if gt (.Alerts.Resolved | len) 0 }}, RESOLVED:{{ .Alerts.Resolved | len }}{{ end }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}
{{ end }}
```
This is a more advanced example:
- Prints the number of firing and resolved alerts in the notification.
- Outputs `.GroupLabels`, the labels used to [group multiple alerts in one notification](ref:group-alert-notifications).
- Prints `CommonLabels`, excluding labels in `.GroupLabels`.
```template_output
[FIRING:1, RESOLVED:1] api warning (sql_db)
```

View File

@@ -14,7 +14,8 @@ labels:
- enterprise
- oss
title: Use images in notifications
weight: 500
menuTitle: Use images
weight: 105
---
# Use images in notifications
@@ -55,6 +56,8 @@ Refer to the table at the end of this page for a list of contact points and thei
8. Grafana does not delete screenshots uploaded to its internal web server. To delete screenshots from `static_root_path/images/attachments` after a certain amount of time, we recommend setting up a CRON job.
9. Note you cannot adjust the number and size of images or their placement in notifications.
## Configuration
{{% admonition type="note" %}}
@@ -130,7 +133,7 @@ If Grafana has been set up to send images in notifications, however notification
5. If images cannot be taken because of mis-configuration or an issue with image rendering there are logs for `Failed to take an image` including the Dashboard UID, Panel ID, and the error message.
6. Check that the contact point supports images in notifications and whether it supports uploading images to the receiving service or referencing images that have been uploaded to a cloud storage service.
## Metrics
## Monitor
Grafana provides the following metrics to observe the performance and failure rate of images in notifications.
For example, if a screenshot could not be taken within the expected time (10 seconds) then the counter `grafana_screenshot_failures_total` is updated.

View File

@@ -0,0 +1,85 @@
---
aliases:
- ../../manage-notifications/template-notifications/using-go-templating-language/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/using-go-templating-language/
- ../../configure-notifications/template-notifications/using-go-templating-language/ # /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/using-go-templating-language/
weight: 104
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/language/
description: Use Go template language to create your notification and alert rule templates
keywords:
- grafana
- alerting
- templates
- write templates
labels:
products:
- cloud
- enterprise
- oss
title: Alerting template language
menuTitle: Template language
refs:
alert-rule-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/
alert-rule-template-reference-variables:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/#variables
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/#variables
notification-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
reference-notificationdata:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/#notification-data
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/#notification-data
---
# Alerting template language
Notification templates and alert rule templates, such as annotations and labels, both use the Go template language, [text/template](https://pkg.go.dev/text/template).
Both types of templates can use the same keywords, functions, and comparison operators of the Go template language, such as `range`, `if`, `and`, `index`, `eq`, and more.
However, it's important to note that because notifications and alert rules operate in distinct context, some additional variables and functions are only available for either notification or alert rule templates. Refer to:
- [Annotation and label template reference](ref:alert-rule-template-reference)
- [Notification template reference](ref:notification-template-reference)
This documentation provides an overview of the functions and operators of the Go template language that are available for both notification and alert rule templates.
## Print
To print the value of something, use `{{` and `}}`. You can print the value of a [variable](#variables), a field of a variable, the result of a function, or the value of dot.
```
{{ $values }}
{{ $values.A.Value }}
{{ humanize 1000.0 }}
{{ .Alerts }}
```
## Dot
In `text/template`, there is a special cursor called dot, written as `.`. You can think of this cursor as a variable whose value changes depending on where in the template it is used.
At the start of notification templates, dot (`.`) refers to [Notification Data](ref:reference-notificationdata).
```
{{ .Alerts }}
```
In annotation and label templates, dot (`.`) is initialized with all alert data. Its recommended to use the [`$labels` and `$values` variables](ref:alert-rule-template-reference-variables) instead to directly access the alert labels and query values.
{{% admonition type="note" %}}
Dot (`.`) might refer to something else when used in a [range](#range), a [with](#with), or when writing [templates](#templates) used in other templates.
{{% /admonition %}}
[//]: <> (The above section is not included in the shared file because `refs` links are not supported in shared files.)
{{< docs/shared lookup="alerts/template-language.md" source="grafana" version="<GRAFANA_VERSION>" >}}

View File

@@ -0,0 +1,131 @@
---
aliases:
- ../../manage-notifications/template-notifications/create-notification-templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/create-notification-templates/
- ../../manage-notifications/template-notifications/use-notification-templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/use-notification-templates/
- ../../configure-notifications/template-notifications/use-notification-templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/use-notification-templates/
- ../../configure-notifications/template-notifications/create-notification-templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/create-notification-templates/
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/manage-notification-templates/
description: Create notification templates to sent to your contact points
keywords:
- grafana
- alerting
- notifications
- templates
- create templates
- edit templates
- delete templates
labels:
products:
- cloud
- enterprise
- oss
title: Manage notification templates
menuTitle: Manage templates
weight: 101
refs:
notification-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
---
# Manage notification templates
In contact points, you can select notification templates to customize the notification messages sent.
By default, Grafana provides a template for the notification title (`default.title`) and a template for the notification message (`default.message`). Both default templates display common alert details.
You can also create custom templates to customize the content and format of notification messages, which can then be applied to one or more contact points.
This documentation provides step-by-step instructions for selecting templates in contact points, previewing templates, and creating custom templates using the Grafana UI.
## Select a notification template for a contact point
To add an existing notification template to your contact point, complete the following steps.
1. Click an existing contact point or create a new one.
1. In **Optional settings**, click any field that contains templates.
For example, if you are creating an email contact point integration, click **Message** or **Subject**.
1. Click **Edit**.
A dialog box opens where you can select templates.
1. Click **Select existing template** to select a template and [preview](#preview-a-notification-template) it using the default payload.
You can also copy the selected template and use it in the custom tab.
1. Click **Enter custom message** to customize and edit the field directly. Note that the title changes depending on the field you are editing.
1. You can switch between the two tabs to access the list of available templates and copy them across to the customized version.
1. Click **Save contact point**.
## Create a notification template
Create notification templates to customize notification messages and reuse them in contact points.
Your notification template name must be unique. You cannot have two templates with the same name in the same notification template or in different notification templates. Avoid defining templates with the same name as default templates, such as: `__subject`, `__text_values_list`, `__text_alert_list`, `default.title` and `default.message`.
To create a notification template in Grafana, complete the following steps.
1. Click **Alerts & IRM** -> **Contact points**.
1. Click the **Notification Templates** tab and then **+ Add notification template**.
1. Enter a name for the notification template.
1. Write the content of the template in the content field.
1. Save your changes.
If `{{ define }}` is not included in the content, `{{ define "<NOTIFICATION_TEMPLATE_NAME>" }}` and `{{ end }}` is automatically added to the start and end.
To create a notification template that contains more than one template, complete the following steps.
1. Click **+ Add notification template**.
1. Enter a name for the notification template.
1. Write each template in the Content field, including `{{ define "name-of-template" }}` and `{{ end }}` at the start and end of each template.
1. Save your changes.
For more details on how to write notification templates, refer to the [template reference](ref:notification-template-reference) and [examples](ref:notification-template-examples).
## Preview a notification template
Preview how your notification templates should look before using them in your contact points, helping you understand the result of the template you are creating as well as enabling you to fix any errors before saving it.
{{% admonition type="note" %}}
Notification template preview is only for Grafana Alertmanager.
{{% /admonition %}}
To preview your notification templates:
1. Navigate to **Alerts&IRM** -> **Alerting** -> **Contact points** -> **Notification Templates**.
1. Click **+ Add notification template** or edit an existing template.
1. Add or update your template content.
Default data is provided and you can add or edit alert data to it as well as alert instances. You can add alert data directly in the Payload data window itself or click **Select alert instances** or **Add custom alerts**.
1. Optional: To add alert data from existing alert instances:
a. Click **Select alert instances**.
b. Hover over the alert instances to view more information on each alert instance.
c. Click **Confirm** to add the alert instance(s) to the payload.
1. Optional: To add alert data using the Alert data editor, click **Add custom data:**
a. Add annotations, custom labels and/or set a dashboard or a panel.
b. Toggle Firing/resolved depending on whether you want to add firing or resolved alerts to your notification.
c. Click **Add alert data**.
d. Click **Refresh preview** to see what your template content should look like and the corresponding payload data.
If there are any errors in your template, they are displayed in the Preview and you can correct them before saving.
1. Save your changes.

View File

@@ -13,80 +13,249 @@ labels:
- cloud
- enterprise
- oss
title: Reference
weight: 400
title: Notification template reference
menuTitle: Template reference
weight: 102
refs:
label-types:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#label-types
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#label-types
alert-rule-template-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/reference/
alert-grouping:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/group-alert-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/group-alert-notifications/
template-language:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/language/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/language/
template-language-functions:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/language/#functions
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/language/#functions
---
# Reference
# Notification template reference
## Data
By default, Grafana provides predefined templates to format notification messages.
### Alert
You can also customize your notifications with custom templates, which are based on the [Go template language](ref:template-language).
| Name | Kind | Description | Example |
| ------------ | -------- | ------------------------------------------------------------------------------------ | --------------------- |
| Status | `string` | Firing or resolved | `{{ .Status }}` |
| Labels | `KV` | The labels for this alert | `{{ .Labels }}` |
| Annotations | `KV` | The annotations for this alert | `{{ .Annotations }}` |
| Values | `KV` | The values of all expressions, including Classic Conditions | `{{ .Values }}` |
| StartsAt | `Time` | The time the alert fired | `{{ .StartsAt }}` |
| EndsAt | `Time` | | `{{ .EndsAt }}` |
| GeneratorURL | `string` | A link to Grafana, or the Alertmanager if using an external Alertmanager | `{{ .GeneratorURL }}` |
| SilenceURL | `string` | A link to silence the alert | `{{ .SilenceURL }}` |
| DashboardURL | `string` | A link to the Grafana Dashboard if the alert has a Dashboard UID annotation | `{{ .DashboardURL }}` |
| PanelURL | `string` | A link to the panel if the alert has a Panel ID annotation | `{{ .PanelURL }}` |
| Fingerprint | `string` | A unique string that identifies the alert | `{{ .Fingerprint }}` |
| ValueString | `string` | A string that contains the labels and value of each reduced expression in the alert. | `{{ .ValueString }}` |
This documentation lists the data available for use in notification templates.
### ExtendedData
## Notification Data
| Name | Kind | Description | Example |
| ----------------- | --------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| Receiver | `string` | The name of the contact point sending the notification | `{{ .Receiver }}` |
| Status | `string` | The status is `firing` if at least one alert is firing, otherwise `resolved` | `{{ .Status }}` |
| Alerts | `[]Alert` | List of all firing and resolved alerts in this notification | `There are {{ len .Alerts }} alerts` |
| Firing alerts | `[]Alert` | List of all firing alerts in this notification | `There are {{ len .Alerts.Firing }} firing alerts` |
| Resolved alerts | `[]Alert` | List of all resolved alerts in this notification | `There are {{ len .Alerts.Resolved }} resolved alerts` |
| GroupLabels | `KV` | The labels that group these alerts in this | `{{ .GroupLabels }}` |
| CommonLabels | `KV` | The labels common to all alerts in this notification | `{{ .CommonLabels }}` |
| CommonAnnotations | `KV` | The annotations common to all alerts in this notification | `{{ .CommonAnnotations }}` |
| ExternalURL | `string` | A link to Grafana, or the Alertmanager that sent this notification if using an external Alertmanager | `{{ .ExternalURL }}` |
In notification templates, dot (`.`) is initialized with the following data:
### KV
| Name | Type | Description |
| ------------------- | ----------------- | ----------------------------------------------------------------------------------------------------- |
| `Receiver` | string | The name of the contact point sending the notification |
| `Status` | string | The status is `firing` if at least one alert is firing, otherwise `resolved`. |
| `Alerts` | [][Alert](#alert) | List of all firing and resolved alerts in this notification. |
| `Alerts.Firing` | [][Alert](#alert) | List of all firing alerts in this notification. |
| `Alerts.Resolved` | [][Alert](#alert) | List of all resolved alerts in this notification. |
| `GroupLabels` | [KV](#kv) | The labels that group these alerts in this notification based on the `Group by` option. |
| `CommonLabels` | [KV](#kv) | The labels common to all alerts in this notification. |
| `CommonAnnotations` | [KV](#kv) | The annotations common to all alerts in this notification. |
| `ExternalURL` | string | A link to Grafana, or the Alertmanager that sent this notification if using an external Alertmanager. |
`KV` is a set of key value pairs, where each key and value is a string. If a KV happens to contain numbers or bools then these are string representations of the numeric or boolean value.
It's important to remember that [a single notification can group multiple alerts](ref:alert-grouping) to reduce the number of alerts you receive. `Alerts` is an array that includes all the alerts in the notification.
Here is an example of a KV, the annotations of an alert:
Here's an example that prints all available notification data from dot (`.`):
```yaml
summary: 'A summary of the alert'
description: 'A description of the alert'
```go
{{ define "custom_template" }}
{{ .Receiver }}
{{ .Status }}
There are {{ len .Alerts }} alerts
There are {{ len .Alerts.Firing }} firing alerts
There are {{ len .Alerts.Resolved }} resolved alerts
{{ .GroupLabels }}
{{ .CommonLabels }}
{{ .CommonAnnotations }}
{{ .ExternalURL }}
{{ end }}
```
In addition to iterating over each key value pair, you can sort the pairs, remove keys, and iterate over just the keys or the values.
## Alert
| Name | Description | Arguments | Returns | Example |
| ----------- | ---------------------------------------------- | --------- | ------- | ------------------------------------- |
| SortedPairs | Sorts | | | `{{ .Annotations.SortedPairs }}` |
| Remove | Returns a copy of the KV with the keys removed | []string | | `{{ .Annotations.Remove "summary" }}` |
| Names | A list of the names | | | `{{ .Names }}` |
| Values | A list of the values | | | `{{ .Values }}` |
`Alert` contains data for an individual alert:
### Time
| Name | Type | Description |
| -------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status` | string | Firing or resolved. |
| `Labels` | [KV](#kv) | The labels for this alert. It includes all [types of labels](ref:label-types). |
| `Annotations` | [KV](#kv) | The annotations for this alert. |
| `StartsAt` | [Time](#time) | The time the alert fired |
| `EndsAt` | [Time](#time) | Only set if the end time of an alert is known. Otherwise set to a configurable timeout period from the time since the last alert was received. |
| `GeneratorURL` | string | A link to Grafana, or the source of the alert if using an external alert generator. |
| `Fingerprint` | string | A unique string that identifies the alert. |
Time is from the Go [`time`](https://pkg.go.dev/time#Time) package.
Grafana-managed alerts include these additional properties:
You can format a time in a number of different formats using the `date` function.
For example, to print the time that an alert fired in the format `15:04:05 MST`:
| Name | Type | Description |
| -------------- | --------- | ------------------------------------------------------------------------------------ |
| `DashboardURL` | string | A link to the Grafana Dashboard if the alert has a Dashboard UID annotation. |
| `PanelURL` | string | A link to the panel if the alert has a Panel ID annotation. |
| `SilenceURL` | string | A link to silence the alert. |
| `Values` | [KV](#kv) | The values of all expressions, including Classic Conditions. |
| `ValueString` | string | A string that contains the labels and value of each reduced expression in the alert. |
```
{{ .StartsAt | date "15:04:05 MST" }}
This example iterates over the list of firing and resolved alerts (`.Alerts`) in the notification and prints the data for each alert:
```go
{{ define "custom_template" }}
{{ range .Alerts }}
{{ .Status }}
{{ .Labels }}
{{ .Annotations }}
{{ .StartsAt }}
{{ .EndsAt }}
{{ .GeneratorURL }}
{{ .Fingerprint }}
{{/* Only available for Grafana-managed alerts */}}
{{ .DashboardURL }}
{{ .PanelURL }}
{{ .SilenceURL }}
{{ .Values }}
{{ .ValueString }}
{{ end }}
{{ end }}
```
You can also use the `tz` function to change the timezone from UTC to a local time. For example:
## KV
```
{{ .StartsAt | tz "Europe/Paris" | date "15:04:05 MST" }}
`KV` is a set of key value pairs, where each key and value is a string.
Similarly to accessing variable properties, you can use `.` to retrieve the value of a value. For example:
```go
{{ define "custom_template" }}
{{ .CommonLabels.grafana_folder }}
{{ end }}
```
You can find a reference for Go's time format [here](https://pkg.go.dev/time#pkg-constants).
If a KV happens to contain numbers or bools then these are string representations of the numeric or boolean value.
Additionally, KV provides methods to sort the pairs, remove keys, and iterate over just the keys or values:
| Method name | Description | Arguments | Returns |
| ----------- | ---------------------------------------------- | --------- | --------- |
| SortedPairs | Returns a sorted list of key/value pairs. | | Pairs |
| Remove | Returns a copy of the KV with the keys removed | []string | [KV](#kv) |
| Names | Return the names of the label names | | []string |
| Values | Return a list of the values | | []string |
Here's an example of using these methods:
```go
{{ define "custom_template" }}
{{ .CommonLabels.SortedPairs }}
{{ .CommonLabels.Names }}
{{ .CommonLabels.Values }}
{{ .CommonLabels.Remove (stringSlice "grafana_folder") }}
{{ end }}
```
## Time
Some template functions and properties return a `Time` object, which refers to the [type `Time`](https://pkg.go.dev/time#Time) in Go's time package.
When accessing a `Time` object, you can use various [`Time` functions](https://pkg.go.dev/time#Time) in your templates as follows.
```go
{{ define "custom_template" }}
{{ range .Alerts }}
{{ .StartsAt }}
{{ .StartsAt.Add 6000000000000 }}
{{ .StartsAt.Add -6000000000000 }}
{{ .StartsAt.AddDate 1 0 0 }}
{{ .StartsAt.Year }}/{{ .StartsAt.Month }}/{{ .StartsAt.Day }}
{{ .StartsAt.Hour }}:{{ .StartsAt.Minute }}:{{ .StartsAt.Second }}
{{ .StartsAt.YearDay }}-{{ .StartsAt.Weekday }}
{{ .StartsAt.Unix }} {{ .StartsAt.UnixMilli }}
{{ end}}
{{ end }}
```
## Functions
Functions can perform actions in templates such as transforming or formatting data.
Note that the [functions provided by Go's template language](ref:template-language-functions), such as `index`, `and`, `printf`, and `len`, are available, along with many others.
In addition, the following functions are also available for templating notifications:
| Name | Arguments | Returns | Description |
| -------------- | -------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title` | string | string | Capitalizes the first character of each word. |
| `toUpper` | string | string | Returns all text in uppercase. |
| `toLower` | string | string | Returns all text in lowercase. |
| `trimSpace` | string | string | Removes leading and trailing white spaces. |
| `match` | pattern, text | boolean | Matches the text against a regular expression pattern. |
| `reReplaceAll` | pattern, replacement, text | string | Replaces text matching the regular expression. |
| `join` | sep string, s []string | string | Concatenates the elements of s to create a single string. The separator string sep is placed between elements in the resulting string. |
| `safeHtml` | string | string | Marks string as HTML not requiring auto-escaping. |
| `stringSlice` | ...string | string | Returns the passed strings as a slice of strings. auto-escaping. |
| `date` | string, [Time](#time) | string | Format a time in the specified format. For format options, refer to [Go's time format documentation](https://pkg.go.dev/time#pkg-constants). |
| `tz` | string, [Time](#time) | [Time](#time) | Returns the time in the specified timezone, such as `Europe/Paris`. For available timezone options, refer to the [list of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
Here's an example using some functions to format text:
```go
{{ define "custom_template" }}
{{ title "hello, world!" }}
{{ toUpper "Hello, world!" }}
{{ toLower "Hello, world!" }}
{{ trimSpace "Hello, world!" }}
{{ match "a.*" "abc" }}
{{ reReplaceAll "localhost:(.*)" "example.com:$1" "localhost:8080" }}
{{ join "-" (stringSlice "a" "b" "c") }}
{{ safeHtml "<b>Text</b>"}}
{{ stringSlice "a" "b" "c" }}
{{ end }}
```
`date` and `tz` can format times. For example, to print the time an alert fired in the format `15:04:05 MST`:
```go
{{ define "custom_template" }}
{{ range .Alerts }}
{{ .StartsAt | date "15:04:05 MST" }}
{{ end}}
{{ end }}
```
You can then use `tz` to change the timezone from UTC to local time, such as `Europe/Paris`.
```go
{{ define "custom_template" }}
{{ range .Alerts }}
{{ .StartsAt | tz "Europe/Paris" }}
{{ .StartsAt | tz "Europe/Paris" | date "15:04:05 MST" }}
{{ end}}
{{ end }}
```
```template-output
2024-10-30 21:01:45.227 +0100 CET
21:01:45 CET
```
## Differences with annotation and label templates
In the alert rule, you can also template annotations and labels to include additional information. For example, you might add a `summary` annotation that displays the query value triggering the alert.
Annotation and label templates add relevant information to individual alert instances, while notification templates inform about a group of alert instances.
Since both types of templates operate in distinct contexts, the [functions and variables available in annotation and label templates](ref:alert-rule-template-reference) differ from those used in notification templates.

View File

@@ -1,53 +0,0 @@
---
aliases:
- ../../manage-notifications/template-notifications/use-notification-templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/use-notification-templates/
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/use-notification-templates/
description: Use notification templates in contact points to customize your notifications
keywords:
- grafana
- alerting
- notifications
- templates
- use templates
labels:
products:
- cloud
- enterprise
- oss
title: Use notification templates
weight: 300
refs:
create-notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/create-notification-templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/create-notification-templates/
using-go-templating-language:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/using-go-templating-language/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/using-go-templating-language/
---
# Use notification templates
Use templates in contact points to customize your notifications.
Complete the following steps to add templates to your contact point.
1. Click an existing contact point or create a new one
1. In **Optional settings**, click any field that contains templates.
For example, if you are creating an email contact point integration, click **Message** or **Subject**.
1. Click **Edit**.
A dialog box opens where you can select templates.
1. Click **Select existing template** to select a template and preview it using the default payload.
You can also copy the selected template and use it in the custom tab.
1. Click **Enter custom message** to customize and edit the field directly. Note that the title changes depending on the field you are editing.
1. You can switch between the two tabs to access the list of available templates and copy them across to the customized version.
1. Click **Save contact point**.

View File

@@ -1,298 +0,0 @@
---
aliases:
- ../../manage-notifications/template-notifications/using-go-templating-language/ # /docs/grafana/<GRAFANA_VERSION>/alerting/manage-notifications/template-notifications/using-go-templating-language/
canonical: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/using-go-templating-language/
description: Use Go's templating language to create your own notification templates
keywords:
- grafana
- alerting
- notifications
- templates
- write templates
labels:
products:
- cloud
- enterprise
- oss
title: Using Go's templating language
weight: 100
refs:
create-notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/create-notification-templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/create-notification-templates/
extendeddata:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/#extendeddata
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/#extendeddata
reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
---
# Using Go's templating language
You write notification templates in Go's templating language, [text/template](https://pkg.go.dev/text/template).
Before you start creating your own notification templates, we recommend that you read through this topic, which provides you with an overview of Go's templating language and writing templates in text/template.
## Dot
In text/template there is a special cursor called dot, and is written as `.`. You can think of this cursor as a variable whose value changes depending where in the template it is used. For example, at the start of a notification template `.` refers to something called [`ExtendedData`](ref:extendeddata) which contains a number of fields including `Alerts`, `Status`, `GroupLabels`, `CommonLabels`, `CommonAnnotations` and `ExternalURL`. However, dot might refer to something else when used in a range over a list, when used inside a `with`, or when writing feature templates to be used in other templates. You can see examples of this in [Create notification templates](ref:create-notification-templates), and all data and functions in the [Reference](ref:reference).
## Opening and closing tags
In text/template, templates start with `{{` and end with `}}` irrespective of whether the template prints a variable or executes control structures such as if statements. This is different from other templating languages such as Jinja where printing a variable uses `{{` and `}}` and control structures use `{%` and `%}`.
## Print
To print the value of something use `{{` and `}}`. You can print the value of dot, a field of dot, the result of a function, and the value of a [variable](#variables). For example, to print the `Alerts` field where dot refers to `ExtendedData` you would write the following:
```
{{ .Alerts }}
```
## Iterate over alerts
To print just the labels of each alert, rather than all information about the alert, you can use a `range` to iterate the alerts in `ExtendedData`:
```
{{ range .Alerts }}
{{ .Labels }}
{{ end }}
```
Inside the range dot no longer refers to `ExtendedData`, but to an `Alert`. You can use `{{ .Labels }}` to print the labels of each alert. This works because `{{ range .Alerts }}` changes dot to refer to the current alert in the list of alerts. When the range is finished dot is reset to the value it had before the start of the range, which in this example is `ExtendedData`:
```
{{ range .Alerts }}
{{ .Labels }}
{{ end }}
{{/* does not work, .Labels does not exist here */}}
{{ .Labels }}
{{/* works, cursor was reset */}}
{{ .Status }}
```
## Iterate over annotations and labels
Let's write a template to print the labels of each alert in the format `The name of the label is $name, and the value is $value`, where `$name` and `$value` contain the name and value of each label.
Like in the previous example, use a range to iterate over the alerts in `.Alerts` such that dot refers to the current alert in the list of alerts, and then use a second range on the sorted labels so dot is updated a second time to refer to the current label. Inside the second range use `.Name` and `.Value` to print the name and value of each label:
```
{{ range .Alerts }}
{{ range .Labels.SortedPairs }}
The name of the label is {{ .Name }}, and the value is {{ .Value }}
{{ end }}
{{ range .Annotations.SortedPairs }}
The name of the annotation is {{ .Name }}, and the value is {{ .Value }}
{{ end }}
{{ end }}
```
## The index function
To print a specific annotation or label use the `index` function.
```
{{ range .Alerts }}
The name of the alert is {{ index .Labels "alertname" }}
{{ end }}
```
## If statements
You can use if statements in templates. For example, to print `There are no alerts` if there are no alerts in `.Alerts` you would write the following:
```
{{ if .Alerts }}
There are alerts
{{ else }}
There are no alerts
{{ end }}
```
## With
With is similar to if statements, however unlike if statements, `with` updates dot to refer to the value of the with:
```
{{ with .Alerts }}
There are {{ len . }} alert(s)
{{ else }}
There are no alerts
{{ end }}
```
## Variables
Variables in text/template must be created within the template. For example, to create a variable called `$variable` with the current value of dot you would write the following:
```
{{ $variable := . }}
```
You can use `$variable` inside a range or `with` and it will refer to the value of dot at the time the variable was defined, not the current value of dot.
For example, you cannot write a template that use `{{ .Labels }}` in the second range because here dot refers to the current label, not the current alert:
```
{{ range .Alerts }}
{{ range .Labels.SortedPairs }}
{{ .Name }} = {{ .Value }}
{{/* does not work because in the second range . is a label not an alert */}}
There are {{ len .Labels }}
{{ end }}
{{ end }}
```
You can fix this by defining a variable called `$alert` in the first range and before the second range:
```
{{ range .Alerts }}
{{ $alert := . }}
{{ range .Labels.SortedPairs }}
{{ .Name }} = {{ .Value }}
{{/* works because $alert refers to the value of dot inside the first range */}}
There are {{ len $alert.Labels }}
{{ end }}
{{ end }}
```
## Range with index
You can get the index of each alert within a range by defining index and value variables at the start of the range:
```
{{ $num_alerts := len .Alerts }}
{{ range $index, $alert := .Alerts }}
This is alert {{ $index }} out of {{ $num_alerts }}
{{ end }}
```
## Define templates
You can define templates using `define` and the name of the template in double quotes. You should not define templates with the same name as other templates, including default templates such as `__subject`, `__text_values_list`, `__text_alert_list`, `default.title` and `default.message`. Where a template has been created with the same name as a default template, or a template in another notification template, Grafana might use either template. Grafana does not prevent, or show an error message, when there are two or more templates with the same name.
```
{{ define "print_labels" }}
{{ end }}
```
## Execute templates
You can execute defined templates using `template`, the name of the template in double quotes, and the cursor that should be passed to the template:
```
{{ template "print_labels" . }}
```
## Pass data to templates
Within a template dot refers to the value that is passed to the template.
For example, if a template is passed a list of firing alerts then dot refers to that list of firing alerts:
```
{{ template "print_alerts" .Alerts }}
```
If the template is passed the sorted labels for an alert then dot refers to the list of sorted labels:
```
{{ template "print_labels" .SortedLabels }}
```
This is useful when writing reusable templates. For example, to print all alerts you might write the following:
```
{{ template "print_alerts" .Alerts }}
```
Then to print just the firing alerts you could write this:
```
{{ template "print_alerts" .Alerts.Firing }}
```
This works because both `.Alerts` and `.Alerts.Firing` is a list of alerts.
```
{{ define "print_alerts" }}
{{ range . }}
{{ template "print_labels" .SortedLabels }}
{{ end }}
{{ end }}
```
## Comments
You can add comments with `{{/*` and `*/}}`:
```
{{/* This is a comment */}}
```
To prevent comments from adding line breaks use:
```
{{- /* This is a comment with no leading or trailing line breaks */ -}}
```
## Indentation
You can use indentation, both tabs and spaces, and line breaks, to make templates more readable:
```
{{ range .Alerts }}
{{ range .Labels.SortedPairs }}
{{ .Name }} = {{ .Value }}
{{ end }}
{{ end }}
```
However, indentation in the template is also present in the text. Next, we look at how to remove it.
## Remove spaces and line breaks
In text/template use `{{-` and `-}}` to remove leading and trailing spaces and line breaks.
For example, when using indentation and line breaks to make a template more readable:
```
{{ range .Alerts }}
{{ range .Labels.SortedPairs }}
{{ .Name }} = {{ .Value }}
{{ end }}
{{ end }}
```
The indentation and line breaks will also be present in the text:
```
alertname = "Test"
grafana_folder = "Test alerts"
```
You can remove the indentation and line breaks from the text changing `}}` to `-}}` at the start of each range:
```
{{ range .Alerts -}}
{{ range .Labels.SortedPairs -}}
{{ .Name }} = {{ .Value }}
{{ end }}
{{ end }}
```
The indentation and line breaks in the template are now absent from the text:
```
alertname = "Test"
grafana_folder = "Test alerts"
```

View File

@@ -13,6 +13,11 @@ menuTitle: Introduction
title: Introduction to Alerting
weight: 100
refs:
notifications:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/
notification-policies:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/notification-policies/
@@ -105,11 +110,15 @@ A rule using the PromQL expression above creates as many alert instances as the
[Contact points](ref:contact-points) determine the notification message and where notifications are sent. For example, you might have a contact point that sends notifications to an email address, to Slack, to an incident management system (IRM) such as Grafana OnCall or Pagerduty, or to a webhook.
### Notification messages
By default, notification messages include alert details, such as the number of alerts, their status, and annotations to help responders address alert issues. Notification messages can also be customized.
In the alert rule, you can choose a contact point to receive the alert notifications or use notification policies instead.
### Notification policies
[Notification policies](ref:notification-policies) provide a flexible method to handle alert notifications for larger systems.
[Notification policies](ref:notification-policies) is an advanced option to handle alert notifications for larger systems.
Notification policies routes alerts to contact points via label matching. Each notification policy consists of a set of label matchers (0 or more) that specify which alert instances (identified by their labels) they handle. Notification policies are defined in a tree structure, where the root of the notification policy tree is the **Default notification policy**, which ensures all alert instances are handled.
@@ -129,12 +138,8 @@ Each notification policy decides where to send the alert (contact point) and whe
Grafana Alerting is built on the Prometheus model of designing alerting systems. Prometheus-based alerting systems have two main components:
- An alert generator that evaluates alert rules and sends firing and resolved alerts to the alert receiver.
- An alert receiver (also known as Alertmanager) that receives the alerts and is responsible for handling them and sending their notifications.
Grafana Alerting doesnt use Prometheus as its default alert generator because it works with many other data sources; not just Prometheus.
However, Grafana can also use Prometheus as an alert generator (refer to [alert rule types](ref:alert-rules)), as well as external Alertmanagers.
- An alert generator that [evaluates alert rules](ref:alert-rule-evaluation) and sends firing and resolved alerts to the alert receiver.
- An alert receiver (also known as Alertmanager) that receives the alerts and is responsible for sending their [notifications](ref:notifications).
## Design your Alerting system
@@ -147,23 +152,23 @@ Here are some tips on how to create an effective alert management set up for you
**Which are the key metrics for your business that you want to monitor and alert on?**
- Find events that are important to know about and not so trivial or frequent that recipients ignore them.
- Alerts should only be created for big events that require immediate attention or intervention.
- Consider quality over quantity.
**Which type of Alerting do you want to use?**
- Choose between Grafana-managed Alerting or Grafana Mimir or Loki-managed Alerting; or both.
**How do you want to organize your alerts and notifications?**
- Be selective about who you set to receive alerts. Consider sending them to whoever is on call or a specific Slack channel.
- Automate as far as possible using the Alerting API or alerts as code (Terraform).
- Be selective about who you set to receive alerts. Consider sending them to the right teams, whoever is on call, and the specific channels.
- Think carefully about priority and severity levels.
- Automate as far as possible provisioning Alerting resources with the API or Terraform.
**Which information should you include in notifications?**
- Consider who the alert receivers and responders are.
- Share information that helps responders identify and address potential issues.
- Link alerts to dashboards to guide responders on which data to investigate.
**How can you reduce alert fatigue?**
- Avoid noisy, unnecessary alerts by using silences, mute timings, or pausing alert rule evaluation.
- Continually tune your alert rules to review effectiveness. Remove alert rules to avoid duplication or ineffective alerts.
- Think carefully about priority and severity levels.
- Continually review your thresholds and evaluation rules.

View File

@@ -43,7 +43,7 @@ Alert rules in different groups can be evaluated simultaneously.
- **Grafana-managed** alert rules within the same group are evaluated concurrently—they are evaluated at different times over the same evaluation interval but display the same evaluation timestamp.
- **Data-source managed** alert rules within the same group are evaluated sequentially, one after the other—this is necessary to ensure that recording rules are evaluated before alert rules.
- **Data-source managed** alert rules within the same group are evaluated sequentially, one after the other—this is useful to ensure that recording rules are evaluated before alert rules.
## Pending period

View File

@@ -3,10 +3,7 @@ aliases:
- ../fundamentals/data-source-alerting/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/data-source-alerting/
- ../fundamentals/alert-rules/alert-instances/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/alert-instances/
- ../fundamentals/alert-rules/organising-alerts/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/organising-alerts/
- ../fundamentals/alert-rules/recording-rules/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/recording-rules/
- ../fundamentals/alert-rules/alert-rule-types/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/alert-rule-types/
- ../unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/
- ../unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/
canonical: https://grafana.com/docs/grafana/latest/alerting/fundamentals/alert-rules/
description: Learn about alert rules
keywords:
@@ -26,9 +23,6 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/queries-conditions/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/queries-conditions/
recorded-queries:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/recorded-queries/
notification-images:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/images-in-notifications/
@@ -41,14 +35,19 @@ refs:
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/
create-recording-rules:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-recording-rules/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-mimir-loki-managed-recording-rule/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-recording-rules/
expression-queries:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/queries-conditions/#expression-queries
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/queries-conditions/#expression-queries
alert-condition:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/queries-conditions/#alert-condition
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/queries-conditions/#alert-condition
alert-rule-evaluation:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/rule-evaluation/
@@ -69,54 +68,52 @@ Grafana supports two different alert rule types: Grafana-managed alert rules and
## Grafana-managed alert rules
Grafana-managed alert rules are the most flexible alert rule type. They allow you to create alert rules that can act on data from any of the [supported data sources](#supported-data-sources), and use multiple data sources in a single alert rule. You can add [expressions to transform your data](ref:expression-queries) and set custom alert conditions. Using [images in alert notifications](ref:notification-images). is also supported.
Grafana-managed alert rules are the most flexible alert rule type. They allow you to create alert rules that can act on data from any of the [supported data sources](#supported-data-sources), and use multiple data sources in a single alert rule.
{{< figure src="/media/docs/alerting/grafana-managed-alerting-architecture.png" max-width="750px" caption="How Grafana-managed alerting works by default" >}}
1. Alert rules are created within Grafana based on one or more data sources.
1. Alert rules are created within Grafana and query one or more data sources.
1. Alert rules are evaluated by the Alert Rule Evaluation Engine from within Grafana.
1. Firing and resolved alert instances are forwarded to [handle their notifications](ref:notifications).
### Supported data sources
Grafana-managed alert rules can query backend data sources if Grafana Alerting is enabled by specifying `{"backend": true, "alerting": true}` in the [plugin.json](https://grafana.com/developers/plugin-tools/reference/plugin-json).
Grafana-managed alert rules can query backend data sources if Grafana Alerting is enabled by specifying `{"backend": true, "alerting": true}` in the `plugin.json` file.
Find the public data sources supporting Alerting in the [Grafana Plugins directory](/grafana/plugins/data-source-plugins/?features=alerting).
## Data source-managed alert rules
Data source-managed alert rules can be used for Grafana Mimir or Grafana Loki data sources which have been configured to support rule creation.
Data source-managed alert rules can query Prometheus-based data sources, such as Grafana Mimir or Grafana Loki. Alert rules are stored within the data source when the Ruler API is enabled (e.g., [Mimir Ruler API](/docs/mimir/<GRAFANA_VERSION>/references/http-api/#ruler) or [Loki Ruler API](/docs/loki/<GRAFANA_VERSION>/api/#ruler)).
They can improve query performance via [recording rules](#recording-rules) and ensure high-availability and fault tolerance when implementing a distributed architecture.
They are only supported for Grafana Mimir or Grafana Loki data sources with the Ruler API enabled. For more information, refer to the [Loki Ruler API](/docs/loki/<GRAFANA_VERSION>/api/#ruler) or [Mimir Ruler API](/docs/mimir/<GRAFANA_VERSION>/references/http-api/#ruler).
In this setup, the distributed architecture can provide high-availability and fault tolerance.
{{< figure src="/media/docs/alerting/mimir-managed-alerting-architecture-v2.png" max-width="750px" caption="Mimir-managed alerting architecture" >}}
1. Alert rules are created and stored within the data source itself.
1. Alert rules can only query Prometheus-based data. It can use either queries or [recording rules](#recording-rules).
1. Alert rules can only query Prometheus-based data.
1. Alert rules are evaluated by the Alert Rule Evaluation Engine.
1. Firing and resolved alert instances are forwarded to [handle their notifications](ref:notifications).
## Recording rules
A recording rule allows you to pre-compute frequently needed or computationally expensive expressions and save their result as a new set of time series. This is useful if you want to run alerts on aggregated data or if you have dashboards that query computationally expensive expressions repeatedly.
A recording rule pre-compute frequently used or computationally expensive queries, and saves the results as a new time series metric.
Querying this new time series is faster, especially for dashboards since they query the same expression every time the dashboards refresh. For more information, refer to [Create recording rules](ref:create-recording-rules).
The new metric can then be used in alert rules and dashboards to optimize their queries.
Alternatively, Grafana Enterprise and Grafana Cloud offer [recorded queries](ref:recorded-queries) that can be executed against any data source.
Similar to alert rules, recording rules are evaluated periodically. For more details, refer to [Create recording rules](ref:create-recording-rules).
## Comparison between alert rule types
When choosing which alert rule type to use, consider the following comparison between Grafana-managed and data source-managed alert rules.
| <div style="width:200px">Feature</div> | <div style="width:200px">Grafana-managed alert rule</div> | <div style="width:200px">Data source-managed alert rule |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Create alert rules<wbr /> based on data from any of the supported data sources | Yes | No. You can only create alert rules that are based on Prometheus-based data. |
| Mix and match data sources | Yes | No |
| Includes support for recording rules | Yes. Only for Grafana OSS users with the `grafanaManagedRecordingRules` feature flag enabled. | Yes |
| Add expressions to transform<wbr /> your data and set alert conditions | Yes | No |
| Use images in alert notifications | Yes | No |
| Organization | Organize and manage access with folders | Use namespaces |
| Scaling | More resource intensive, depend on the database, and are likely to suffer from transient errors. They only scale vertically. | Store alert rules within the data source itself and allow for “infinite” scaling. Generate and send alert notifications from the location of your data. |
| Alert rule evaluation and delivery | Alert rule evaluation and delivery is done from within Grafana, using an external Alertmanager; or both. | Alert rule evaluation and alert delivery is distributed, meaning there is no single point of failure. |
| <div style="width:200px">Feature</div> | <div style="width:200px">Grafana-managed alert rule</div> | <div style="width:200px">Data source-managed alert rule |
| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Create alert rules<wbr /> that query [data sources supporting Alerting](#supported-data-sources) | Yes | No. Only query Prometheus-based data sources. |
| Mix and match data sources | Yes | No |
| Add [expressions](ref:expression-queries) to transform<wbr /> your data and set [alert conditions](ref:alert-condition) | Yes | No |
| Use [images in alert notifications](ref:notification-images) | Yes | No |
| Support for [recording rules](#recording-rules) | Yes | Yes |
| Organization | Organize and manage access with folders | Use namespaces |
| Scaling | More resource intensive, depend on the database, and are likely to suffer from transient errors. They only scale vertically. | Store alert rules within the data source itself and allow for “infinite” scaling. Generate and send alert notifications from the location of your data. |
| Alert rule evaluation and delivery | Alert rule evaluation and delivery is done from within Grafana, using an external Alertmanager; or both. | Alert rule evaluation and alert delivery is distributed, meaning there is no single point of failure. |

View File

@@ -26,16 +26,16 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals#alert-instances
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals#alert-instances
create-alerts-from-panel:
link-alert-rules-to-panels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-grafana-managed-rule#create-alerts-from-panels
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/link-alert-rules-to-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-grafana-managed-rule#create-alerts-from-panels
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/
templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/templates/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/templates/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/templates/
alert-rule-evaluation:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rule-evaluation/
@@ -57,8 +57,8 @@ refs:
Labels and annotations add additional information about an alert using key/value pairs:
- [Labels](#labels) are used to differentiate an alert from all other alerts.
- [Annotations](#annotations) are used to provide extra detail on an existing alert.
- [Labels](#labels) are used to differentiate an alert from all other alerts and decide how to manage them.
- [Annotations](#annotations) provide extra details for alert responders to help them understand and address potential issues.
## Labels
@@ -83,24 +83,26 @@ An alert's label set can contain three types of labels:
**User-configured labels**
Labels that you manually configure in the alert rule to identify the generated alert instances or group them.
Labels that you manually configure in the alert rule to identify the generated alert instances and manage the alerts. Common custom labels, depending on the use case, are: `severity`, `priority`, `team`, and `service`.
You can also use a [template](ref:templates) to customize the label value and generate dynamic values when the rule is evaluated.
Additionally, you can use a [template](ref:templates) to customize the label value and generate dynamic values from query data.
**Data source query labels**
**Query labels**
For example, if you are monitoring temperature readings and each time series for these readings has a `sensor_id`, and a `location` label, an alert instance might have the labels `{sensor_id="1",location="NY"}`, while another alert instance might have `{sensor_id="2",location="WA"}`.
Query labels are labels returned by the data source query.
Data source query labels labels are also used to generate multiple alert instances from the same alert rule, helping to distinguish alerts from different data.
{{< figure src="/media/docs/alerting/query-labels-and-values.png" max-width="1200px" caption="An alert rule query returning labels from the query." >}}
Query labels can generate multiple alert instances from the same alert rule, helping to distinguish alerts from different data. In this example, the `instance` label generates an alert instance for each server.
**Reserved labels**
Reserved labels are automatically added by Grafana:
- `alert_name`: the name of the alert rule.
- `alertname`: the name of the alert rule.
- `grafana_folder`: the title of the folder containing the alert.
Labels prefixed with `grafana_` are reserved by Grafana for special use. To stop Grafana Alerting from adding a reserved label, you can disable it via the `disabled_labels` option in [unified_alerting.reserved_labels](/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana#unified_alertingreserved_labels) configuration.
Labels prefixed with `grafana_` are reserved by Grafana for special use. You can disable reserved labels via the [`unified_alerting.reserved_labels`](/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana#unified_alertingreserved_labels) option.
{{<admonition type="note">}}
@@ -132,13 +134,29 @@ If multiple label keys are sanitized to the same value, the duplicates have a sh
## Annotations
The purpose of annotations is to add additional information to alert instances, such as extra details for notification messages.
Annotations add additional information to alert instances, helping responders identify and address potential issues.
Grafana provides several optional annotations that you can edit for use in notification messages and within Grafana.
Annotations are displayed in Grafana and are included by default in notifications. Grafana provides several optional annotations that you can edit:
- `summary`: A short summary of what the alert has detected and why.
- `description`: A detailed description of what happened and what the alert does.
- `runbook_url`: The runbook page to guide operators managing a potential incident.
- `dashboardUId` and `panelId`: Link the alert to a dashboard and panel. These are automatically set when [creating an alert from panels](ref:create-alerts-from-panel).
- `dashboardUId` and `panelId`: [Link the alert to a dashboard and panel](ref:link-alert-rules-to-panels) to facilitate alert investigation.
Like labels, annotations can use a [template](ref:templates) to customize the label value and generate dynamic values when the rule is evaluated.
For example, you can edit the annotation `summary` to explain why the alert was triggered:
```
CPU usage has exceeded 80% for the last 5 minutes.
```
And edit the `description` annotation to provide more context and how to respond:
```
The web server's CPU has exceeded 80% for more than 5 minutes.
This indicates that the system is under heavy load and may result in an outage.
Consider scaling the server's resources and investigating bottlenecks.
```
Like labels, annotations can use a [template](ref:templates) to include dynamic data from queries.

View File

@@ -43,7 +43,7 @@ refs:
In Grafana, queries fetch and transform data from [data sources,](ref:data-sources) which include databases like MySQL or PostgreSQL, time series databases like Prometheus or InfluxDB, and services like Amazon CloudWatch or Azure Monitor.
A query specifies the desired data to retrieve from a data source and applies relevant filters or transformations. Query languages or syntax specific to the chosen data source are utilized for constructing these queries.
A query specifies the data to extract from a data source, with the syntax varying based on the type of data source used.
In Alerting, an alert rule defines of one or more queries and expressions that select the data you want to measure and a [condition](#alert-condition) that needs to be met before an alert rule fires.

View File

@@ -27,9 +27,9 @@ refs:
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/group-alert-notifications/
templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/templates/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/templates/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/templates/
configure-alertmanager:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/configure-alertmanager/
@@ -84,7 +84,9 @@ Start defining your [contact points](ref:contact-points) to specify how to recei
[Contact points](ref:contact-points) contain the configuration for sending alert notifications, specifying destinations like email, Slack, OnCall, webhooks, and their notification messages.
A contact point is a list of integrations, each sending a message to a specific destination. They allow the customization of notification messages and the use of notification templates.
A contact point is a list of integrations, each sending a message to a specific destination.
By default, notification messages include common alert details, such as the number of alerts, alert names, labels, annotations, and other alert information. You can also customize notification messages and use notification templates.
First, create the contact point and test the notifications. Then, configure the alert rule to send its notifications to either a contact point or through Notification Policies.

View File

@@ -105,15 +105,15 @@ Consider a notification policy that:
- Groups notifications by the `team` label—one group for each distinct `team`.
- Sets the Group wait timer to `30s`.
| Time | Incoming alert instance | Notification policy group | Number of instances | |
| ------------------ | ------------------------------- | ------------------------- | ------------------- | ----------------------------------------------------------------------- |
| 00:00 | `alert_name=f1` `team=frontend` | `frontend` | 1 | Starts the group wait timer of the `frontend` group. |
| 00:10 | `alert_name=f2` `team=frontend` | `frontend` | 2 | |
| 00:20 | `alert_name=b1` `team=backend` | `backend` | 1 | Starts the group wait timer of the `backend` group. |
| 00:30<sup>\*</sup> | | `frontend` | 2 | Group wait elapsed. <br/> Send initial notification reporting 2 alerts. |
| 00:35 | `alert_name=b2` `team=backend` | `backend` | 2 | |
| 00:40 | `alert_name=b3` `team=backend` | `backend` | 3 | |
| 00:50<sup>\*</sup> | | `backend` | 3 | Group wait elapsed. <br/> Send initial notification reporting 3 alerts. |
| Time | Incoming alert instance | Notification policy group | Number of instances | |
| ------------------ | ------------------------------ | ------------------------- | ------------------- | ----------------------------------------------------------------------- |
| 00:00 | `alertname=f1` `team=frontend` | `frontend` | 1 | Starts the group wait timer of the `frontend` group. |
| 00:10 | `alertname=f2` `team=frontend` | `frontend` | 2 | |
| 00:20 | `alertname=b1` `team=backend` | `backend` | 1 | Starts the group wait timer of the `backend` group. |
| 00:30<sup>\*</sup> | | `frontend` | 2 | Group wait elapsed. <br/> Send initial notification reporting 2 alerts. |
| 00:35 | `alertname=b2` `team=backend` | `backend` | 2 | |
| 00:40 | `alertname=b3` `team=backend` | `backend` | 3 | |
| 00:50<sup>\*</sup> | | `backend` | 3 | Group wait elapsed. <br/> Send initial notification reporting 3 alerts. |
### Group interval
@@ -134,15 +134,15 @@ Here are the related excerpts from the previous example:
And below is the continuation of the example setting the Group interval timer to 5 minutes:
| Time | Incoming alert instance | Notification policy group | Number of instances | |
| ------------------ | ------------------------------- | ------------------------- | ------------------- | ---------------------------------------------------------------------------------------------- |
| 01:30 | `alert_name=f3` `team=frontend` | `frontend` | 3 | |
| 02:30 | `alert_name=f4` `team=frontend` | `frontend` | 4 | |
| 05:30<sup>\*</sup> | | `frontend` | 4 | Group interval elapsed and resets timer. <br/> Send one notification reporting 4 alerts. |
| 05:50<sup>\*</sup> | | `backend` | 3 | Group interval elapsed and resets timer. <br/> No group changes, and do not send notification. |
| 08:00 | `alert_name=f4` `team=backend` | `backend` | 4 | |
| 10:30<sup>\*</sup> | | `frontend` | 4 | Group interval elapsed and resets timer. <br/> No group changes, and do not send notification. |
| 10:50<sup>\*</sup> | | `backend` | 4 | Group interval elapsed and resets timer. <br/> Send one notification reporting 4 alerts. |
| Time | Incoming alert instance | Notification policy group | Number of instances | |
| ------------------ | ------------------------------ | ------------------------- | ------------------- | ---------------------------------------------------------------------------------------------- |
| 01:30 | `alertname=f3` `team=frontend` | `frontend` | 3 | |
| 02:30 | `alertname=f4` `team=frontend` | `frontend` | 4 | |
| 05:30<sup>\*</sup> | | `frontend` | 4 | Group interval elapsed and resets timer. <br/> Send one notification reporting 4 alerts. |
| 05:50<sup>\*</sup> | | `backend` | 3 | Group interval elapsed and resets timer. <br/> No group changes, and do not send notification. |
| 08:00 | `alertname=f4` `team=backend` | `backend` | 4 | |
| 10:30<sup>\*</sup> | | `frontend` | 4 | Group interval elapsed and resets timer. <br/> No group changes, and do not send notification. |
| 10:50<sup>\*</sup> | | `backend` | 4 | Group interval elapsed and resets timer. <br/> Send one notification reporting 4 alerts. |
**How it works**

View File

@@ -1,10 +1,10 @@
---
aliases:
- ../fundamentals/notifications/templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/templates/
- ../fundamentals/notifications/templates/ # /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/templates/
- ../contact-points/message-templating/ # /docs/grafana/<GRAFANA_VERSION>/alerting/contact-points/message-templating/
- ../alert-rules/message-templating/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alert-rules/message-templating/
- ../unified-alerting/message-templating/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/message-templating/
canonical: https://grafana.com/docs/grafana/latest/alerting/fundamentals/notifications/templates/
canonical: https://grafana.com/docs/grafana/latest/alerting/fundamentals/templates/
description: Use templating to customize, format, and reuse alert notification messages. Create more flexible and informative alert notification messages by incorporating dynamic content, such as metric values, labels, and other contextual information.
keywords:
- grafana
@@ -33,24 +33,19 @@ refs:
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#annotations
templating-labels-annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templating-labels-annotations/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templating-labels-annotations/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/
notification-message-reference:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/reference/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/reference/
notification-messages:
template-notifications:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/
create-notification-templates:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/configure-notifications/template-notifications/create-notification-templates/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/configure-notifications/template-notifications/create-notification-templates/
---
# Templates
@@ -103,7 +98,7 @@ Annotations can contain plain text, but you should template annotations if you n
Heres an example of templating an annotation, which explains where and why the alert was triggered. In this case, the alert triggers when CPU usage exceeds a threshold, and the `summary` annotation provides the relevant details.
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% ({{ index $values "A" }}) for the last 5 minutes.
CPU usage for {{ $labels.instance }} has exceeded 80% ({{ $values.A.Value }}) for the last 5 minutes.
```
The outcome of this template would be:
@@ -120,11 +115,14 @@ For more details on how to template annotations, refer to [Template annotations
[Labels](ref:labels) are used to differentiate one alert instance from all other alert instances, as the set of labels uniquely identifies an alert instance. Notification policies and silences use labels to handle alert instances.
Template labels when you need to improve or change how alerts are uniquely identified. This is helpful if the labels you get from your query aren't detailed enough.
You can also template labels based on query results. This is helpful if the labels you get from your query aren't detailed enough. For instance:
- Add a new label to change how alerts are identified and grouped into different alert groups.
- Add a new label used by notification policies or silences to manage how the alert is handled.
Heres an example of templating a `severity` label based on the query value:
```
```go
{{ if (gt $values.A.Value 90.0) -}}
critical
{{ else if (gt $values.A.Value 80.0) -}}
@@ -136,26 +134,23 @@ low
{{- end }}
```
Avoid using query values in labels, as this may result in the creation of numerous alerts when only one is needed. Use annotation to inform about the query value instead.
For more details on how to template labels, refer to [Template annotations and labels](ref:templating-labels-annotations).
## Template notifications
[Notification templates](ref:notification-messages) allow you to customize the content of your notifications, such as the subject of an email or the body of a Slack message.
[Notification templates](ref:template-notifications) allow you to customize the content of your notifications, such as the subject of an email or the body of a Slack message.
Notification templates differ from templating annotations and labels in the following ways:
- Notification templates are assigned to the **Contact point**, rather than the alert rule.
- If not specified, the contact point uses a default template that includes relevant alert information.
- You can create reusable notification templates and reference them in other templates.
- The same template can be shared across multiple contact points, making it easier to maintain and ensuring consistency.
- While both annotation/label templates and notification templates use the same templating language, the available variables and functions differ. For more details, refer to the [notification template reference](ref:notification-message-reference) and [annotation/label template reference](ref:templating-labels-annotations).
- Notification templates should not be used to add additional information to individual alerts—use annotations for that purpose.
- While both annotation/label templates and notification templates use the same templating language, the available variables and functions differ. For more details, refer to the [notification template reference](ref:notification-message-reference) and [annotation/label template reference](ref:templating-labels-annotations).
Here is an example of a notification template that summarizes all firing and resolved alerts in a notification group:
```
```go
{{ define "alerts.message" -}}
{{ if .Alerts.Firing -}}
{{ len .Alerts.Firing }} firing alert(s)
@@ -184,4 +179,4 @@ The notification message to the contact point would look like this:
- The web server web1 has been responding to 5% of HTTP requests with 5xx errors for the last 5 minutes.
```
For instructions on creating and using notification templates, refer to [Create notification templates.](ref:create-notification-templates)
For more details, refer to [Template notifications](ref:template-notifications).

View File

@@ -10,12 +10,12 @@ labels:
- cloud
- enterprise
- oss
menuTitle: Detect and respond
title: Detect and respond
menuTitle: Monitor status
title: Monitor status
weight: 130
---
# Detect and respond
# Monitor status
Use Grafana Alerting to track and generate alerts and send notifications, providing an efficient way for engineers to monitor, respond, and triage issues within their services.

View File

@@ -0,0 +1,54 @@
---
canonical: https://grafana.com/docs/grafana/latest/alerting/manage-notifications/view-alert-state-on-panels/
description: View alert rules
keywords:
- grafana
- alerting
- guide
- rules
- view
labels:
products:
- cloud
- enterprise
- oss
title: View alert state on panels
weight: 430
refs:
time-series-visualizations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/time-series/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series/
alert-list-panel:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/alert-list/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/alert-list/
link-alert-rules-to-panels:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/link-alert-rules-to-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/
---
# View alert state on panels
When an [alert rule is linked to a time series panel](ref:link-alert-rules-to-panels), the time series panel displays the alert state and alert events.
A heart icon near the panel title shows the current alert state:
- A broken red heart when the alert is in `Alerting` state.
- A green heart when the alert is in `Normal` state.
Colored annotations indicate changes in alert state, such as pending, alerting, and resolving.
{{< figure src="/media/docs/alerting/panel-displays-alert-state.png" max-width="1200px" alt="A panel with a firing alert and annotations that display the pending and alerting state changes." >}}
Additionally, Grafana provides an [alert list panel](ref:alert-list-panel) that you can add to a dashboard to display a list of alerts and their states.
{{< figure src="/static/img/docs/alert-list-panel/alert-list-panel.png" max-width="850px" alt="Two alert list panels displaying distinct lists of alerts." >}}
You can configure the alert list panel with various visualization options and filters to control how alerts are displayed. For more details, refer to the [Alert list documentation](ref:alert-list-panel).
{{< docs/play title="this demo dashboard with alert list panels and linked alert rules" url="https://play.grafana.org/d/000000074/" >}}

View File

@@ -2,90 +2,21 @@
aliases:
- unified-alerting/set-up/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/set-up/
canonical: https://grafana.com/docs/grafana/latest/alerting/set-up/
description: Set up or upgrade your implementation of Grafana Alerting
description: Additional configuration for Grafana Alerting
labels:
products:
- cloud
- enterprise
- oss
menuTitle: Set up
title: Set up Alerting
weight: 110
refs:
terraform-provisioning:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/provision-alerting-resources/terraform-provisioning/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/set-up/provision-alerting-resources/terraform-provisioning/
configure-high-availability:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/configure-high-availability/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/set-up/configure-high-availability/
configure-alertmanager:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/configure-alertmanager/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/set-up/configure-alertmanager/
data-source-management:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/
data-source-alerting:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/#supported-data-sources
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/#supported-data-sources
file-provisioning:
- pattern: /docs/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/provision-alerting-resources/file-provisioning/
menuTitle: Additional configuration
title: Additional configuration
weight: 160
---
# Set up Alerting
# Additional configuration
Set up or upgrade your implementation of Grafana Alerting.
**Note:**
These are set-up instructions for Grafana Alerting Open Source.
## Before you begin
- Configure your [data sources](ref:data-source-management)
- Check which data sources are compatible with and supported by [Grafana Alerting](ref:data-source-alerting)
Watch this short video to get started, or follow the [written tutorial](http://grafana.com/tutorials/alerting-get-started/).
{{< youtube id="6W8Nu4b_PXM" >}}
## Set up Alerting
To set up Alerting, you need to:
1. Configure alert rules
- Create Grafana-managed or Mimir/Loki-managed alert rules and recording rules
1. Configure contact points
- Check the default contact point and update the email address
- Optional: Add new contact points and integrations
1. Configure notification policies
- Check the default notification policy
- Optional: Add additional nested policies
- Optional: Add labels and label matchers to control alert routing
1. Optional: Integrate with [Grafana OnCall](/docs/oncall/latest/integrations/grafana-alerting)
## Advanced set up options
Grafana Alerting supports many additional configuration options, from configuring external Alertmanagers to routing Grafana-managed alerts outside of Grafana, to defining your alerting setup as code.
Grafana Alerting offers a variety of advanced configuration options to further tailor your alerting setup. These optional features include configuring up permissions and role-based access control, adding external Alertmanagers, or defining your alerting setup as code. While not essential for basic alerting, these options can enhance security, scalability, and automation in complex environments.
The following topics provide you with advanced configuration options for Grafana Alerting.
- [Provision alert rules using file provisioning](ref:file-provisioning)
- [Provision alert rules using Terraform](ref:terraform-provisioning)
- [Add an external Alertmanager](ref:configure-alertmanager)
- [Configure high availability](ref:configure-high-availability)
{{< section >}}

View File

@@ -52,4 +52,32 @@ Grafana Alerting has the following permissions.
| `alert.provisioning:write` | n/a | Update all Grafana alert rules, notification policies, etc via provisioning API. Permissions to folders and data source are not required. |
| `alert.provisioning.provenance:write` | n/a | Set provisioning status for alerting resources. Cannot be used alone. Requires user to have permissions to access resources |
Contact point permissions. To enable these permissions, enable the `alertingApiServer` feature toggle.
| Action | Applicable scope | Description |
| -------------------------------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `alert.notifications.receivers:read` | `receivers:*`<br>`receivers:uid:*` | Read contact points. |
| `alert.notifications.receivers.secrets:read` | `receivers:*`<br>`receivers:uid:*` | Export contact points with decrypted secrets. |
| `alert.notifications.receivers:create` | n/a | Create a new contact points. The creator is automatically granted full access to the created contact point. |
| `alert.notifications.receivers:write` | `receivers:*`<br>`receivers:uid:*` | Update existing contact points. |
| `alert.notifications.receivers:delete` | `receivers:*`<br>`receivers:uid:*` | Update and delete existing contact points. |
| `receivers.permissions:read` | `receivers:*`<br>`receivers:uid:*` | Read permissions for contact points. |
| `receivers.permissions:write` | `receivers:*`<br>`receivers:uid:*` | Manage permissions for contact points. |
Mute time interval permissions. To enable these permissions, enable the `alertingApiServer` feature toggle.
| Action | Applicable scope | Description |
| ------------------------------------------- | ---------------- | -------------------------------------------------- |
| `alert.notifications.time-intervals:read` | n/a | Read mute time intervals. |
| `alert.notifications.time-intervals:write` | n/a | Create new or update existing mute time intervals. |
| `alert.notifications.time-intervals:delete` | n/a | Delete existing time intervals. |
Notification template permissions. To enable these permissions, enable the `alertingApiServer` feature toggle.
| Action | Applicable scope | Description |
| -------------------------------------- | ---------------- | ---------------------------------------- |
| `alert.notifications.templates:read` | n/a | Read templates. |
| `alert.notifications.templates:write` | n/a | Create new or update existing templates. |
| `alert.notifications.templates:delete` | n/a | Delete existing templates. |
To help plan your RBAC rollout strategy, refer to [Plan your RBAC rollout strategy](https://grafana.com/docs/grafana/next/administration/roles-and-permissions/access-control/plan-rbac-rollout-strategy/).

View File

@@ -57,12 +57,28 @@ Details of the fixed roles and the access they provide for Grafana Alerting are
| Access to alert rules provisioning API: `fixed:alerting.provisioning:writer` | `alert.provisioning:read` and `alert.provisioning:write` | Manage all alert rules, notification policies, contact points, templates, in the organization using the provisioning API. |
| Set provisioning status: `fixed:alerting.provisioning.status:writer` | `alert.provisioning.provenance:write` | Set provisioning rules for Alerting resources. Should be used together with other regular roles (Notifications Writer and/or Rules Writer.) |
If you have enabled the `alertingApiServer` feature toggle, an additional set of fixed roles is available.
| Display name in UI / Fixed role | Permissions | Description |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Contact Point Reader: `fixed:alerting.receivers:reader` | `alert.notifications.receivers:read` for scope `receivers:*` | Read all contact points. |
| Contact Point Creator: `fixed:alerting.receivers:creator` | `alert.notifications.receivers:create` | Create a new contact point. The user is automatically granted full access to the created contact point. |
| Contact Point Writer: `fixed:alerting.receivers:writer` | `alert.notifications.receivers:read`, `alert.notifications.receivers:write`, `alert.notifications.receivers:delete` for scope `receivers:*` and <br> `alert.notifications.receivers:create` | Create a new contact point and manage all existing contact points. |
| Templates Reader: `fixed:alerting.templates:reader` | `alert.notifications.templates:read` | Read all notification templates. |
| Templates Writer: `fixed:alerting.templates:writer` | `alert.notifications.templates:read`, `alert.notifications.templates:write`, `alert.notifications.templates:delete` | Create new and manage existing notification templates. |
| Time Intervals Reader: `fixed:alerting.time-intervals:reader` | `alert.notifications.time-intervals:read` | Read all time intervals. |
| Time Intervals Writer: `fixed:alerting.time-intervals:writer` | `alert.notifications.time-intervals:read`, `alert.notifications.time-intervals:write`, `alert.notifications.time-intervals:delete` | Create new and manage existing time intervals. |
## Create custom roles
Create custom roles of your own to manage permissions. Custom roles contain unique combinations of permissions, actions and scopes. Create a custom role when basic roles and fixed roles do not meet your permissions requirements.
For more information on creating custom roles, refer to [Create custom roles](https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/access-control/manage-rbac-roles/#create-custom-roles).
{{< admonition type="note" >}}
It is not recommended to create custom roles that include `alerting.notifications.receiver` actions with a scope other than `receivers:*`. The UID used in the scope is not stable and changes whenever a contact point is renamed.
{{< /admonition >}}
### Examples
The following examples give you an idea of how you can combine permissions for Grafana Alerting.

View File

@@ -64,3 +64,30 @@ To manage folder permissions, complete the following steps.
1. Hover your mouse cursor over a folder and click **Go to folder**.
1. Click **Manage permissions** from the Folder actions menu.
1. Update or add permissions as required.
## Manage access using contact point permissions
### Before you begin
- Enable the `alertingApiServer` feature toggle.
Extend or limit the access provided by a role to contact points by assigning permissions to individual contact point.
This allows different users, teams, or service accounts to have customized access to read or modify specific contact points.
Refer to the following table for details on the additional access provided by contact point permissions.
| Folder permission | Additional Access |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| View | View and export contact point as well as select it on the Alert rule edit page |
| Edit | Update or delete the contact point |
| Admin | Same additional access as Edit and manage permissions for the contact point. User should have additional permissions to read users and teams. |
### Steps
To contact point permissions, complete the following steps.
1. In the left-side menu, click **Contact points**.
1. Hover your mouse cursor over a contact point and click **More**.
1. Click **Manage permissions** from the actions menu.
1. Update or add permissions as required.

View File

@@ -1,8 +1,8 @@
---
aliases:
- ./meta-monitoring/ # /docs/grafana/<GRAFANA_VERSION>/alerting/meta-monitoring/
- ./set-up/meta-monitoring/ # /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/meta-monitoring/
canonical: https://grafana.com/docs/grafana/latest/alerting/monitor/
- ../meta-monitoring/ # /docs/grafana/<GRAFANA_VERSION>/alerting/meta-monitoring/
- ../monitoring/ # /docs/grafana/<GRAFANA_VERSION>/alerting/monitoring/
canonical: https://grafana.com/docs/grafana/latest/alerting/set-up/meta-monitoring
description: Monitor your alerting metrics to ensure you identify potential issues before they become critical.
keywords:
- grafana
@@ -12,9 +12,8 @@ labels:
products:
- enterprise
- oss
menuTitle: Monitor
title: Meta monitoring
weight: 140
weight: 700
---
# Meta monitoring

View File

@@ -15,7 +15,7 @@ labels:
- enterprise
- oss
title: Performance considerations and limitations
weight: 600
weight: 800
---
# Performance considerations and limitations

View File

@@ -118,7 +118,7 @@ Ensure you have a public dashboard footer logo or footer text set if you don't w
#### Learn more
[Configure custom branding documentation](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/configure-custom-branding/#custom-branding-for-shared-dashboards) for public dashboards
[Configure custom branding documentation](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/configure-custom-branding/#custom-branding-for-public-dashboards) for public dashboards
### Subfolders cause very rare issues with folders that have forward slashes in their names

View File

@@ -31,17 +31,17 @@ cards:
href: ./variables/
description: Add variables to metric queries and panel titles to create interactive and dynamic dashboards.
height: 24
- title: Public dashboards
href: ./dashboard-public/
description: Make your Grafana dashboards public and share them with anyone without requiring access to your Grafana organization.
height: 24
- title: Reporting
href: ./create-reports/
description: Automatically generate and share PDF reports from your Grafana dashboards.
height: 24
- title: Sharing
href: ./share-dashboards-panels/
description: Share Grafana dashboards and panels using links, snapshots, embeds, and exports.
height: 24
- title: Shared dashboards
href: ./share-dashboards-panels/shared-dashboards/
description: Share your dashboards with anyone without requiring access to your Grafana organization.
description: Share Grafana dashboards and panels within your organization using links, snapshots, and JSON exports.
height: 24
refs:
panels:

View File

@@ -34,7 +34,7 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-security/export-logs/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-security/export-logs/
dashboard-sharing:
enabled:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/#public_dashboards
- pattern: /docs/grafana-cloud/
@@ -79,7 +79,7 @@ For every dashboard and data source, you can access usage information.
To see dashboard usage information, click the dashboard insights icon in the header.
![Dashboard insights icon](/media/docs/grafana/dashboards/screenshot-dashboard-insights-icon-11.2.png)
{{< figure src="/media/docs/grafana/dashboards/screenshot-dashboard-insights-11.2.png" alt="Dashboard insights icon" >}}
Dashboard insights show the following information:
@@ -88,7 +88,7 @@ Dashboard insights show the following information:
{{< figure src="/static/img/docs/enterprise/dashboard_insights_stats.png" max-width="400px" class="docs-image--no-shadow" alt="Stats tab" >}}{{< figure src="/static/img/docs/enterprise/dashboard_insights_users.png" max-width="400px" class="docs-image--no-shadow" alt="Users and activity tab" >}}
If [dashboard sharing](ref:dashboard-sharing) is enabled, you'll also see a **Shared dashboards** tab in your analytics.
If public dashboards are [enabled](ref:enabled), you'll also see a **Public dashboards** tab in your analytics.
### Data source insights

View File

@@ -70,6 +70,7 @@ Watch the following video for a quick tutorial on creating annotations:
To add an annotation, complete the following steps:
1. If you've just saved a dashboard, refresh the page.
1. Click **Edit** in the top-right corner of the dashboard.
1. Click the panel to which you're adding the annotation.
@@ -85,6 +86,7 @@ Alternatively, to add an annotation, press Ctrl/Cmd and click the panel, and the
### Add a region annotation
1. If you've just saved a dashboard, refresh the page.
1. Click **Edit** in the top-right corner of the dashboard.
1. Press Ctrl/Cmd and click and drag on the panel.
![Add annotation popover](/static/img/docs/time-series-panel/time-series-annotations-add-region-annotation.gif)

View File

@@ -52,9 +52,9 @@ refs:
destination: /docs/grafana-cloud/connect-externally-hosted/data-sources/
add-a-data-source:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/#add-a-data-source
destination: /docs/grafana/<GRAFANA_VERSION>/datasources/#add-a-data-source
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/#add-a-data-source
destination: /docs/grafana/<GRAFANA_VERSION>/datasources/#add-a-data-source
about-users-and-permissions:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/

View File

@@ -148,7 +148,7 @@ Each panel can have its own set of links that are shown in the upper left of the
Click the icon next to the panel title to see available panel links.
{{< figure src="/media/docs/grafana/dashboards/screenshot-panel-links-v11.3.png" max-width="550px" alt="List of panel links displayed" >}}
{{< figure src="/media/docs/grafana/screenshot-panel-links.png" width="200px" alt="List of panel links displayed" >}}
### Add a panel link

View File

@@ -37,20 +37,15 @@ You can control permissions for library panels using [role-based access control
## Create a library panel
Library panels can be reused in different dashboards throughout Grafana. When you create a library panel, the panel on the source dashboard is converted to a library panel as well. You need to save the original dashboard once a panel is converted.
When you create a library panel, the panel on the source dashboard is converted to a library panel as well. You need to save the original dashboard once a panel is converted.
To create a library panel, follow these steps:
1. In the top-right corner of the dashboard, click **Edit**.
1. Hover over any part of the panel you want to share to display the actions menu on the top right corner.
1. Click **More > New library panel**.
1. In the **Library panel name** field, enter the name.
1. In the **Save in folder** drop-down list, select the folder in which to save the library panel. By default, the root level is selected.
1. Click **Create library panel** to save your changes.
1. Click **Save dashboard**.
1. (Optional) Enter a description of the changes you've made.
1. Click **Save**.
1. Click **Exit edit**.
1. Click **Edit** in the top-right corner of the dashboard.
1. On the panel you want to update, hover over any part of the panel to display the menu icon on the top-right corner.
1. Click the menu icon and select **More > Create library panel**.
1. In **Library panel name**, enter the name.
1. In **Save in folder**, select the folder to save the library panel.
1. Click **Create library panel**.
1. Click **Save dashboard** and **Exit edit**.
Once created, you can modify the library panel using any dashboard on which it appears. After you save the changes, all instances of the library panel reflect these modifications.
@@ -58,13 +53,11 @@ Once created, you can modify the library panel using any dashboard on which it a
Add a Grafana library panel to a dashboard when you want to provide visualizations to other dashboard users.
To add a library panel, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click **New** and select **New Dashboard** in the drop-down list.
1. Click **New** and select **New Dashboard** in the dropdown.
1. On the empty dashboard, click **+ Add library panel**.
The **Add panel from panel library** drawer opens.
You'll see a list of your library panels.
1. Filter the list or search to find the panel you want to add.
1. Click a panel to add it to the dashboard.
@@ -76,8 +69,6 @@ To add a library panel, follow these steps:
Unlink a library panel when you want to make a change to the panel and not affect other instances of the library panel.
To unlink a library panel, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click **Library panels**.
1. Select a library panel that is being used in dashboards.
@@ -116,9 +107,8 @@ Alternatively, if you know where the library panel that you want to replace is b
You can view a list of available library panels and see where those panels are being used.
To view and manage library panels, follow these steps:
1. Click **Dashboards > Library panels** in the main menu.
1. Click **Dashboards** in the main menu.
1. Click **Library panels**.
You can see a list of previously defined library panels.
{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-library-panel-list-9-5.png" class="docs-image--no-shadow" max-width= "900px" alt="Library panels page with list of library panels" >}}
@@ -133,8 +123,8 @@ To view and manage library panels, follow these steps:
## Delete a library panel
To delete a library panel that you no longer need, follow these steps:
Delete a library panel when you no longer need it.
1. Click **Dashboards > Library panels** in the main menu.
1. Click **Dashboards** in the main menu.
1. Click **Library panels**.
1. Click the delete icon next to the library panel name.
1. Click **Delete**.

View File

@@ -1,10 +1,10 @@
---
aliases:
- ../administration/reports/ # /docs/grafana/latest/administration/reports/
- ../enterprise/export-pdf/ # /docs/grafana/latest/enterprise/export-pdf/
- ../enterprise/reporting/ # /docs/grafana/latest/enterprise/reporting/
- ../panels/create-reports/ # /docs/grafana/latest/panels/create-reports/
- reporting/ # /docs/grafana/latest/dashboards/reporting/
- ../administration/reports/
- ../enterprise/export-pdf/
- ../enterprise/reporting/
- ../panels/create-reports/
- reporting/
keywords:
- grafana
- reporting
@@ -39,6 +39,11 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/access-control/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/access-control/
permission:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/
role-based-access-control:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/access-control/
@@ -109,7 +114,7 @@ For information about recent improvements to the reporting UI, refer to [Grafana
## Access control
When [RBAC](ref:rbac) is enabled, you need to have the relevant [Permissions][] to create and manage reports.
When [RBAC](ref:rbac) is enabled, you need to have the relevant [Permissions](ref:permission) to create and manage reports.
## Create or update a report
@@ -150,7 +155,7 @@ You can save a report as a draft at any point during the report creation or upda
### Choose template variables
> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) version 7.5 and later behind the `reportVariables` feature flag, Grafana Enterprise version 8.0 and later without a feature flag, and [Grafana Cloud](/docs/grafana-cloud/).
> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud/).
You can configure report-specific template variables for the dashboard on the report page. The variables that you select will override the variables from the dashboard, and they are used when rendering a PDF file of the report. For detailed information about using template variables, refer to the [Templates and variables](ref:templates-and-variables) section.
@@ -228,8 +233,7 @@ This feature relies on the same plugin that supports the [image rendering](ref:i
### Scheduling
> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) version 8.0 and later, and [Grafana Cloud](/docs/grafana-cloud/).
> The scheduler was significantly changed in Grafana Enterprise version 8.1.
> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud/).
Scheduled reports can be sent once, or repeated on an hourly, daily, weekly, or monthly basis, or sent at custom intervals. You can also disable scheduling by selecting **Never**, for example to send the report via the API.

View File

@@ -0,0 +1,273 @@
---
labels:
products:
- cloud
- enterprise
- oss
title: Public dashboards
description: Make your Grafana dashboards public and share them with anyone
weight: 350
refs:
dashboard-sharing:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/share-dashboards-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/share-dashboards-panels/
custom-branding:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/configure-custom-branding/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/configure-custom-branding/
dashboard-insights-documentation:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/assess-dashboard-usage/#dashboard-insights
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/assess-dashboard-usage/
caching:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/#query-and-resource-caching
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/#query-and-resource-caching
grafana-enterprise:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
---
# Public dashboards
> **Warning:** Making your dashboard public could result in a large number of queries to the data sources used by your dashboard.
> This can be mitigated by utilizing the enterprise [caching](ref:caching) and/or rate limiting features.
Public dashboards allow you to share your Grafana dashboard with anyone. This is useful when you want to make your dashboard available to the world without requiring access to your Grafana organization. This differs from [dashboard sharing](ref:dashboard-sharing), which either requires recipients to be users in the same Grafana organization or provides limited information, as with a snapshot.
You can see a list of all your public dashboards in one place by navigating to **Dashboards > Public dashboards**. For each dashboard in the list, the page displays the status, a link to view the dashboard, a link to the public dashboard configuration, and the option to revoke the public URL.
## Security implications of making your dashboard public
- Anyone with the URL can access the dashboard.
- Public dashboards are read-only.
- Arbitrary queries **cannot** be run against your data sources through public dashboards. Public dashboards can only execute the
queries stored on the original dashboard.
## Make a dashboard public
1. Click **Share** in the top-right corner of the dashboard.
1. Click the **Public dashboard** tab.
1. Acknowledge the implications of making the dashboard public by selecting all the checkboxes.
1. Click **Generate public URL** to make the dashboard public and make your link live.
1. Copy the public dashboard link if you'd like to share it. You can always come back later for it.
Once you've made the dashboard public, a **Public** tag is displayed in the header of the dashboard.
## Pause access
1. Click **Share** in the top-right corner of the dashboard.
1. Click the **Public dashboard** tab.
1. Enable the **Pause sharing dashboard** toggle.
The dashboard is no longer accessible, even with the link, until you make it shareable again.
## Revoke access
1. Click **Share** in the top-right corner of the dashboard.
1. Click the **Public dashboard** tab.
1. Click **Revoke public URL** to delete the public dashboard.
The link no longer works. You must create a new public URL, as in [Make a dashboard public](#make-a-dashboard-public).
## Email sharing
{{% admonition type="note" %}}
Available in [private preview](/docs/release-life-cycle/) in [Grafana Cloud](/docs/grafana-cloud). This feature will have a cost by active users after being promoted into general availability.
Please contact support to have the feature enabled.
{{% /admonition %}}
Email sharing allows you to share your public dashboard with only specific people by email, instead of having it accessible to anyone with the URL. When you use email sharing, recipients receive a one-time use link that's valid for **one hour**. Once the link is used, the viewer has access to the public dashboard for **30 days**.
### Invite a viewer
1. Click **Share** in the top-right corner of the dashboard.
1. Click the **Public dashboard** tab.
1. Acknowledge the implications of making the dashboard public by selecting all the checkboxes.
1. Click **Generate public URL** to make the dashboard public and make your link live.
1. Under Can view dashboard, click **Only specified people**.
1. Enter the email you want to share the public dashboard with.
1. Click **Invite**.
1. The recipient will receive an email with a one-time use link.
### Viewers requesting access
If a viewer without access tries to navigate to the public dashboard, they'll be asked to request access by providing their email. They will receive an email with a new one-time use link if the email they provided has already been invited to view the public dashboard and has not been revoked.
If the viewer doesn't have an invitation or it's been revoked, you won't be notified and no link is sent.
### Revoke access for a viewer
1. Click **Share** in the top-right corner of the dashboard.
1. Click the **Public dashboard** tab.
1. Click **Revoke** on the viewer you'd like to revoke access for.
Immediately, the viewer no longer has access to the public dashboard, nor can they use any existing one-time use links they may have.
### Reinvite a viewer
1. Click **Share** in the top-right corner of the dashboard.
1. Click the **Public dashboard** tab.
1. Click **Resend** on the viewer you'd like to re-share the public dashboard with.
The viewer will receive an email with a new one-time use link. This will invalidate all previously issued links for that viewer.
### View public dashboard users
To see a list of users who have accessed your dashboard by way of email sharing, take the following steps:
1. In the main sidebar navigation, click **Administration**.
1. Click **Users**.
1. Click the **Public dashboard users** tab.
From here, you can see the earliest time a user has been active in a dashboard, which public dashboards they have access to, and their role.
### Access limitations
One-time use links use browser cookies, so when a viewer is granted access through one of these links, they will only have access on the browser they used to claim the link.
A single viewer cannot generate multiple valid one-time use links. When a new one-time use link is issued for a viewer, all previous ones are invalidated.
If a Grafana user has read access to the parent dashboard, they can view the public dashboard without needing to have access granted.
## Assess public dashboard usage
> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud).
You can check usage analytics about your public dashboard by clicking the insights icon in the dashboard header:
{{< figure src="/media/docs/grafana/dashboards/screenshot-dashboard-insights-11.2.png" max-width="400px" class="docs-image--no-shadow" alt="Dashboard insights icon" >}}
Learn more about the kind of information provided in the [dashboard insights documentation](ref:dashboard-insights-documentation).
## Supported data sources
Public dashboards _should_ work with any data source that has the properties `backend` and `alerting` both set to true in its `plugin.json`. However, this can't always be
guaranteed because plugin developers can override this functionality. The following lists include data sources confirmed to work with public dashboards and data sources that should work, but have not been confirmed as compatible.
### Confirmed:
<table>
<tr>
<td>
<ul>
<li>ClickHouse</li>
<li>CloudWatch</li>
<li>Elasticsearch</li>
<li>Infinity</li>
<li>InfluxDB</li>
<li>Loki</li>
<li>Microsoft SQL Server</li>
</ul>
</td>
<td>
<ul>
<li>MongoDB</li>
<li>MySQL</li>
<li>Oracle Database</li>
<li>PostgreSQL</li>
<li>Prometheus</li>
<li>Redis</li>
<li>SQLite</li>
</ul>
</td>
</tr>
</table>
### Unsupported:
<table>
<tr>
<td>
<ul>
<li>Graphite</li>
</ul>
</td>
</tr>
</table>
### Unconfirmed:
<table>
<tr>
<td>
<ul>
<li>Altinity plugin for ClickHouse</li>
<li>Amazon Athena</li>
<li>Amazon Redshift</li>
<li>Amazon Timestream</li>
<li>Apache Cassandra</li>
<li>AppDynamics</li>
<li>Azure Data Explorer Datasource</li>
<li>Azure Monitor</li>
<li>CSV</li>
<li>DB2 Datasource</li>
<li>Databricks</li>
<li>Datadog</li>
<li>Dataset</li>
<li>Druid</li>
</ul>
</td>
<td>
<ul>
<li>Dynatrace</li>
<li>GitHub</li>
<li>Google BigQuery</li>
<li>Grafana for YNAB</li>
<li>Honeycomb</li>
<li>Jira</li>
<li>Mock</li>
<li>Neo4j Datasource</li>
<li>New Relic</li>
<li>OPC UA (Unified Architecture)</li>
<li>Open Distro for Elasticsearch</li>
<li>OpenSearch</li>
<li>OpenTSDB</li>
</ul>
</td>
<td>
<ul>
<li>Orbit</li>
<li>SAP HANA®</li>
<li>Salesforce</li>
<li>Sentry</li>
<li>ServiceNow</li>
<li>Snowflake</li>
<li>Splunk</li>
<li>Splunk Infrastructure Monitoring</li>
<li>Sqlyze data source</li>
<li>TDengine</li>
<li>Vertica</li>
<li>Wavefront</li>
<li>X-Ray</li>
<li>kdb+</li>
<li>simple grpc data source</li>
</ul>
</td>
</tr>
</table>
## Limitations
- Panels that use frontend data sources will fail to fetch data.
- Template variables are not supported.
- Exemplars will be omitted from the panel.
- Only annotations that query the `-- Grafana --` data source are supported.
- Organization annotations are not supported.
- Grafana Live and real-time event streams are not supported.
- Library panels are not supported.
- Data sources using Reverse Proxy functionality are not supported.
## Custom branding
If you're a Grafana Enterprise customer, you can use custom branding to change the appearance of a public dashboard footer. For more information, refer to [Custom branding](ref:custom-branding).

View File

@@ -1,343 +0,0 @@
---
aliases:
- ../reference/share_dashboard/ # /docs/grafana/latest/reference/share_dashboard/
- ../reference/share_panel/ # /docs/grafana/latest/reference/share_panel/
- ../share-dashboards-panels/ # /docs/grafana/latest/share-dashboards-panels/
- ../sharing/ # /docs/grafana/latest/sharing/
- ../sharing/playlists/ # /docs/grafana/latest/sharing/playlists/
- ../sharing/share-dashboard/ # /docs/grafana/latest/sharing/share-dashboard/
- ../sharing/share-panel/ # /docs/grafana/latest/sharing/share-panel/
- share-dashboard/ # /docs/grafana/latest/dashboards/share-dashboard/
keywords:
- grafana
- dashboard
- documentation
- share
- panel
- reporting
- export
- pdf
labels:
products:
- cloud
- enterprise
- oss
menuTitle: Sharing
title: Share dashboards and panels
description: Share Grafana dashboards and panels within your organization and publicly
weight: 650
refs:
image-rendering:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/image-rendering/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/image-rendering/
grafana-enterprise:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
shared-dashboards:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/share-dashboards-panels/shared-dashboards/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/grafana-cloud/visualizations/dashboards/share-dashboards-panels/shared-dashboards/
configure-report:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/create-reports/#create-or-update-a-report
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/create-reports/#create-or-update-a-report
image-rendering-config:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/image-rendering/#configuration
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/image-rendering/#configuration
---
# Share dashboards and panels
Grafana enables you to share dashboards and panels with other users within your organization and in certain situations, publicly on the web. You can share using:
- Direct links with users in and outside of your organization
- Snapshots
- Embeds
- PDFs
- JSON files
- Reports
- Library panels
You must have an authorized viewer permission to see an image rendered by a direct link.
The same permission is also required to view embedded links unless you have anonymous access permission enabled for your Grafana instance.
{{< admonition type="note" >}}
As of Grafana 8.0, anonymous access permission is not available in Grafana Cloud.
{{< /admonition >}}
## Share dashboards {#share-a-dashboard}
You can share dashboards in the following ways:
- [Internally with a link](#share-an-internal-link)
- [Externally with anyone or specific people](#share-an-external-link)
- [As a report](#schedule-a-report)
- [As a snapshot](#share-a-snapshot)
- [As a PDF export](#export-a-dashboard-as-pdf)
- [As a JSON file export](#export-a-dashboard-as-json)
When you share a dashboard externally as a link or by email, those dashboards are included in a list of your shared dashboards. To view the list and manage these dashboards, navigate to **Dashboards > Shared dashboards**.
{{< admonition type="note" >}}
If you change a dashboard, ensure that you save the changes before sharing.
{{< /admonition >}}
### Share an internal link
To share a customized, direct link to your dashboard within your organization, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share internally**.
1. (Optional) In the **Share internally** drawer that opens, set the following options:
- **Lock time range** - Change the current relative time range to an absolute time range. This option is enabled by default.
- **Shorten link** - Shorten the dashboard link. This option is enabled by default.
1. Select the theme for the dashboard. Choose from **Current**, **Dark**, or **Light**.
1. Click **Copy link**.
1. Send the copied link to a Grafana user with authorization to view the link.
1. Click the **X** at the top-right corner to close the share drawer.
#### Quick-share an internal link
Once you've customized an internal link, you can share it quickly by following these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** button, not the drop-down list icon, to copy a shortened link.
This link has any customizations, like time range locking or theme, that you've previously set. These are stored in the browser scope.
### Share an external link
Externally shared dashboards allow you to share your Grafana dashboard with anyone. This is useful when you want to make your dashboard available to the world without requiring access to your Grafana organization.
Learn how to configure and manage externally shared dashboards in [Externally shared dashboards](ref:shared-dashboards).
### Schedule a report
{{< admonition type="note" >}}
This feature is only available in Grafana Enterprise.
{{< /admonition >}}
To share your dashboard as a report, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Schedule a report**.
1. [Configure the report](ref:configure-report).
1. Depending on your schedule settings, you'll have different options at this step. Click either **Schedule send** or **Send now**.
You can also save the report as a draft.
To manage your reports, navigate to **Dashboards > Reporting > Reports**.
### Share a snapshot
A dashboard snapshot publicly shares a dashboard while removing sensitive data such as queries and panel links, leaving only visible metrics and series names. Anyone with the link can access the snapshot.
You can publish snapshots to your local instance or to [snapshots.raintank.io](http://snapshots.raintank.io). The latter is a free service provided by Grafana Labs that enables you to publish dashboard snapshots to an external Grafana instance. Anyone with the link can view it. You can set an expiration time if you want the snapshot removed after a certain time period.
{{< admonition type=note >}}
The snapshots.raintank.io option is disabled by default in Grafana Cloud. You can update [your config file](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#external_enabled) to enable this functionality.
{{< /admonition >}}
To see the other snapshots shared from your organization, navigate to **Dashboards > Snapshots** in the main menu.
To share your dashboard with anyone as a snapshot, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share snapshot**.
1. In the **Share snapshot** drawer that opens, enter a descriptive title for the snapshot in the **Snapshot name** field.
1. Select one of the following expiration options for the snapshot:
- **1 Hour**
- **1 Day**
- **1 Week**
- **Never**
1. Click **Publish snapshot** or **Publish to snapshots.raintank.io**.
Grafana generates the link of the snapshot. Note that you can't publish dashboard snapshots containing custom panels to snapshot.raintank.io.
1. Click **Copy link**, and share it either within your organization or publicly on the web.
1. Click the **X** at the top-right corner to close the share drawer.
#### Delete a snapshot
To delete existing snapshots, follow these steps:
1. Navigate to **Dashboards > Snapshots** in the main menu.
1. To confirm which snapshot you're about to delete, click **View** on the snapshot row.
The URLs for panel and dashboard snapshots from the same dashboard look similar and viewing them first can help you distinguish them.
1. Click the red **x** next to the snapshot that you want to delete.
The snapshot is immediately deleted. You might need to clear your browser cache or use a private or incognito browser to confirm this.
## Export dashboards
In addition to sharing dashboards as links, reports, and snapshots, you can export them as PDFs or JSON files.
### Export a dashboard as PDF
To export a dashboard in its current state as a PDF, follow these steps:
1. Click **Dashboards** in the main menu.
1. Open the dashboard you want to export.
1. Click the **Export** drop-down in the top-right corner and select **Export as PDF**.
1. In the **Export dashboard PDF** drawer that opens, select either **Landscape** or **Portrait** for the PDF orientation.
1. Select either **Grid** or **Simple** for the PDF layout.
1. Set the **Zoom** level; zoom in to enlarge text, or zoom out to see more data (like table columns) per panel.
1. Click **Generate PDF**.
The PDF opens in another tab where you can download it.
1. Click the **X** at the top-right corner to close the share drawer.
### Export a dashboard as JSON
Export a Grafana JSON file that contains everything you need, including layout, variables, styles, data sources, queries, and so on, so that you can later import the dashboard. To export a JSON file, follow these steps:
1. Click **Dashboards** in the main menu.
1. Open the dashboard you want to export.
1. Click the **Export** drop-down list in the top-right corner and select **Export as JSON**.
The **Export dashboard JSON** drawer opens.
1. Toggle the **Export the dashboard to use in another instance** switch to generate the JSON with a different data source UID.
1. Click **Download file** or **Copy to clipboard**.
1. Click the **X** at the top-right corner to close the share drawer.
## Share panels {#share-a-panel}
You can share a panels in the following ways:
- [Internally with a link](#share-an-internal-link)
- [As an embed](#share-an-embed)
- [As a snapshot](#panel-snapshot)
{{< admonition type="note" >}}
If you change a panel, ensure that you save the changes before sharing.
{{< /admonition >}}
### Share an internal link
To share a personalized, direct link to your panel within your organization, follow these steps:
1. Hover over any part of the panel you want to share to display the actions menu on the top right corner.
1. Click the menu and select **Share link**.
1. (Optional) In the **Link settings** drawer that opens, set the following options:
- **Lock time range** - Change the current relative time range to an absolute time range. This option is enabled by default.
- **Shorten link** - Shorten the panel link. This option is disabled by default.
1. Select the theme for the dashboard. Choose from **Current**, **Dark**, or **Light**.
1. Do one or both of the following:
- Click **Copy link**.
- Click **Render image**, which [renders the panel as a PNG image](ref:image-rendering).
1. Send the copied link or image URL to a Grafana user with authorization to view it.
1. Click the **X** at the top-right corner to close the share drawer.
#### Query string parameters for server-side rendered images
When you click **Render image** in the panel link settings, Grafana generates a PNG image of the panel with the following default parameters:
| Parameter | Description |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| width | Width in pixels. Default is 800. |
| height | Height in pixels. Default is 400. |
| tz | Timezone in the format `UTC%2BHH%3AMM` where HH and MM are offset in hours and minutes after UTC. |
| timeout | Number of seconds. The timeout can be increased if the query for the panel needs more than the default 30 seconds. |
| scale | Numeric value to configure device scale factor. Default is 1. Use a higher value to produce more detailed images (higher DPI). Supported in Grafana v7.0+. |
You can also update these parameters in the [image rendering configuration](ref:image-rendering-config).
The following example shows a link to a server-side rendered PNG:
```bash
https://play.grafana.org/render/d-solo/ktMs4D6Mk?from=2024-09-03T11:55:44.442Z&to=2024-09-03T17:55:44.442Z&panelId=panel-13&__feature.dashboardSceneSolo&width=1000&height=500&tz=UTC
```
### Share an embed
You can share a panel by embedding it on another website using an iframe. Users must be signed into Grafana to view the panel.
{{< admonition type="note" >}}
As of Grafana 8.0, anonymous access permission is no longer available for Grafana Cloud.
{{< /admonition >}}
To create a panel that can be embedded, follow these steps:
1. Hover over any part of the panel you want to share to display the actions menu on the top-right corner.
1. Click the menu and select **Share embed**.
The **Share embed** drawer opens.
1. (Optional) Toggle the **Lock time range** switch to set whether the panel uses the current relative time range or an absolute time range. This option is enabled by default.
1. Select the theme for the dashboard. Choose from **Current**, **Dark**, or **Light**.
1. (Optional) Make any changes to the HTML that you need.
1. Click **Copy to clipboard**.
1. Paste the HTML code into your website code.
1. Click the **X** at the top-right corner to close the share drawer.
Here's an example of what the HTML code might look like:
```html
<iframe
src="https://snapshots.raintank.io/dashboard-solo/snapshot/y7zwi2bZ7FcoTlB93WN7yWO4aMiz3pZb?from=1493369923321&to=1493377123321&panelId=4"
width="650"
height="300"
frameborder="0"
></iframe>
```
The result is an interactive Grafana visualization embedded in an iframe.
### Share a snapshot {#panel-snapshot}
A panel snapshot shares an interactive panel publicly while removing sensitive data such as queries and panel links, leaving only visible metrics and series names. Anyone with the link can access the snapshot.
You can publish snapshots to your local instance or to [snapshots.raintank.io](http://snapshots.raintank.io). The latter is a free service provided by Grafana Labs that enables you to publish dashboard snapshots to an external Grafana instance. Anyone with the link can view it. You can set an expiration time if you want the snapshot removed after a certain time period.
{{< admonition type=note >}}
The snapshots.raintank.io option is disabled by default in Grafana Cloud. You can update [your config file](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#external_enabled) to enable this functionality.
{{< /admonition >}}
To see the other snapshots shared from your organization, navigate to **Dashboards > Snapshots** in the main menu.
To share your panel with anyone as a snapshot, follow these steps:
1. Hover over any part of the panel you want to share to display the actions menu on the top-right corner.
1. Click the menu and select **Share snapshot**.
1. In the **Share snapshot** drawer that opens, enter a descriptive title for the snapshot in the **Snapshot name** field.
1. Select one of the following expiration options for the snapshot:
- **1 Hour**
- **1 Day**
- **1 Week**
- **Never**
1. Click **Publish snapshot** or **Publish to snapshots.raintank.io**.
Grafana generates the link of the snapshot. Note that you can't publish snapshots that include custom panels to snapshot.raintank.io.
1. Click **Copy link**, and share it either within your organization or publicly on the web.
1. Click the **X** at the top-right corner to close the share drawer.
#### Delete a snapshot
To delete existing snapshots, follow these steps:
1. Navigate to **Dashboards > Snapshots** in the main menu.
1. To confirm which snapshot you're about to delete, click **View** on the snapshot row.
The URLs for panel and dashboard snapshots from the same dashboard look similar and viewing them first can help you distinguish them.
1. Click the red **x** next to the snapshot URL that you want to delete.
The snapshot is immediately deleted. You may need to clear your browser cache or use a private or incognito browser to confirm this.

View File

@@ -0,0 +1,250 @@
---
aliases:
- ../administration/reports/
- ../enterprise/export-pdf/
- ../enterprise/reporting/
- ../reference/share_dashboard/
- ../reference/share_panel/
- ../share-dashboards-panels/
- ../sharing/
- ../sharing/playlists/
- ../sharing/share-dashboard/
- ../sharing/share-panel/
- ./
- reporting/
- share-dashboard/
keywords:
- grafana
- dashboard
- documentation
- share
- panel
- library panel
- playlist
- reporting
- export
- pdf
labels:
products:
- cloud
- enterprise
- oss
menuTitle: Sharing
title: Share dashboards and panels
description: Share Grafana dashboards and panels within your organization and publicly
weight: 700
refs:
image-rendering:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/image-rendering/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/image-rendering/
grafana-enterprise:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
---
# Share dashboards and panels
Grafana enables you to share dashboards and panels with other users within an organization and in certain situations, publicly on the Web. You can share using:
- A direct link
- A Snapshot
- An embedded link (for panels only)
- An export link (for dashboards only)
You must have an authorized viewer permission to see an image rendered by a direct link.
The same permission is also required to view embedded links unless you have anonymous access permission enabled for your Grafana instance.
{{< admonition type="note" >}}
As of Grafana 8.0, anonymous access permission is not available in Grafana Cloud.
{{< /admonition >}}
When you share a panel or dashboard as a snapshot, a snapshot (which is a panel or dashboard at the moment you take the snapshot) is publicly available on the web. Anyone with a link to it can access it. Because snapshots do not require any authorization to view, Grafana removes information related to the account it came from, as well as any sensitive data from the snapshot.
## Share a dashboard
You can share a dashboard as a direct link or as a snapshot. You can also export a dashboard.
{{< admonition type="note" >}}
If you change a dashboard, ensure that you save the changes before sharing.
{{< /admonition >}}
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click **Share** in the top-right corner.
The share dialog opens and shows the Link tab.
### Share a direct link
The **Link** tab shows the current time range, template variables, and the default theme. You can also share a shortened URL.
1. Click **Copy**.
This action copies the default or the shortened URL to the clipboard.
1. Send the copied URL to a Grafana user with authorization to view the link.
### Publish a snapshot
A dashboard snapshot shares an interactive dashboard publicly. Grafana strips sensitive data such as queries (metric, template and annotation) and panel links, leaving only the visible metric data and series names embedded in the dashboard. Dashboard snapshots can be accessed by anyone with the link.
You can publish snapshots to your local instance or to [snapshots.raintank.io](http://snapshots.raintank.io). The latter is a free service provided by Grafana Labs that enables you to publish dashboard snapshots to an external Grafana instance. Anyone with the link can view it. You can set an expiration time if you want the snapshot removed after a certain time period.
1. Click the **Snapshot** tab.
1. Click **Publish to snapshots.raintank.io** or **Publish Snapshot**.
Grafana generates a link of the snapshot.
1. Copy the snapshot link, and share it either within your organization or publicly on the web.
If you created a snapshot by mistake, click **Delete snapshot** in the dialog box to remove the snapshot from your Grafana instance.
#### Delete a snapshot
To delete existing snapshots, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click **Snapshots** to go to the snapshots management page.
1. Click the red **x** next to the snapshot URL that you want to delete.
The snapshot is immediately deleted. You may need to clear your browser cache or use a private or incognito browser to confirm this.
### Export a dashboard as JSON
The dashboard export action creates a Grafana JSON file that contains everything you need, including layout, variables, styles, data sources, queries, and so on, so that you can later import the dashboard.
1. Click **Dashboards** in the main menu.
1. Open the dashboard you want to export.
1. Click **Share** in the top-right corner.
1. Click **Export**.
If you're exporting the dashboard to use in another instance, with different data source UIDs, enable the **Export for sharing externally** switch.
1. Click **Save to file**.
Grafana downloads a JSON file to your local machine.
#### Make a dashboard portable
If you want to export a dashboard for others to use, you can add template variables for things like a metric prefix (use a constant variable) and server name.
A template variable of the type `Constant` is automatically hidden in the dashboard, and is also added as a required input when the dashboard is imported.
## Export dashboard as PDF
You can generate and save PDF files of any dashboard.
{{< admonition type="note" >}}
Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud/).
{{< /admonition >}}
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click **Share** in the top-right corner.
1. On the **PDF** tab, select a layout option for the exported dashboard: **Portrait** or **Landscape**.
1. Click **Save as PDF** to render the dashboard as a PDF file.
Grafana opens the PDF file in a new window or browser tab.
## Share a panel
You can share a panel as a direct link, as a snapshot, or as an embedded link. You can also create library panels using the **Share** option on any panel.
1. Hover over any part of the panel to display the actions menu on the top right corner.
1. Click the menu and select **Share**.
The share dialog opens and shows the **Link** tab.
### Use direct link
The **Link** tab shows the current time range, template variables, and the default theme. You can optionally enable a shortened URL to share.
1. Click **Copy**.
This action copies the default or the shortened URL to the clipboard.
1. Send the copied URL to a Grafana user with authorization to view the link.
1. You also optionally click **Direct link rendered image** to share an image of the panel.
For more information, refer to [Image rendering](ref:image-rendering).
The following example shows a link to a server-side rendered PNG:
```bash
https://play.grafana.org/d/000000012/grafana-play-home?orgId=1&from=1568719680173&to=1568726880174&panelId=4&fullscreen
```
#### Query string parameters for server-side rendered images
- **width:** Width in pixels. Default is 800.
- **height:** Height in pixels. Default is 400.
- **tz:** Timezone in the format `UTC%2BHH%3AMM` where HH and MM are offset in hours and minutes after UTC
- **timeout:** Number of seconds. The timeout can be increased if the query for the panel needs more than the default 30 seconds.
- **scale:** Numeric value to configure device scale factor. Default is 1. Use a higher value to produce more detailed images (higher DPI). Supported in Grafana v7.0+.
### Publish a snapshot
A panel snapshot shares an interactive panel publicly. Grafana strips sensitive data leaving only the visible metric data and series names embedded in the dashboard. Panel snapshots can be accessed by anyone with the link.
You can publish snapshots to your local instance or to [snapshots.raintank.io](http://snapshots.raintank.io). The latter is a free service provided by [Grafana Labs](https://grafana.com), that enables you to publish dashboard snapshots to an external Grafana instance.
{{< admonition type="note" >}}
As of Grafana 11, the option to publish to [snapshots.raintank.io](http://snapshots.raintank.io) is no longer available for Grafana Cloud.
{{< /admonition >}}
You can optionally set an expiration time if you want the snapshot to be removed after a certain time period.
1. In the **Share Panel** dialog, click **Snapshot** to go to the tab.
1. Click **Publish to snapshots.raintank.io** or **Publish Snapshot**.
Grafana generates the link of the snapshot.
1. Copy the snapshot link, and share it either within your organization or publicly on the web.
If you created a snapshot by mistake, click **Delete snapshot** in the dialog box to remove the snapshot from your Grafana instance.
#### Delete a snapshot
To delete existing snapshots, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click **Snapshots** to go to the snapshots management page.
1. Click the red **x** next to the snapshot URL that you want to delete.
The snapshot is immediately deleted. You may need to clear your browser cache or use a private or incognito browser to confirm this.
### Embed panel
You can embed a panel using an iframe on another web site. A viewer must be signed into Grafana to view the graph.
{{< admonition type="note" >}}
As of Grafana 8.0, anonymous access permission is no longer available for Grafana Cloud.
{{< /admonition >}}
Here is an example of the HTML code:
```html
<iframe
src="https://snapshots.raintank.io/dashboard-solo/snapshot/y7zwi2bZ7FcoTlB93WN7yWO4aMiz3pZb?from=1493369923321&to=1493377123321&panelId=4"
width="650"
height="300"
frameborder="0"
></iframe>
```
The result is an interactive Grafana graph embedded in an iframe.
### Library panel
To create a library panel from the **Share Panel** dialog:
1. Click **Library panel**.
1. In **Library panel name**, enter the name.
1. In **Save in folder**, select the folder in which to save the library panel. By default, the root level is selected.
1. Click **Create library panel** to save your changes.
1. Click **Save dashboard**.

View File

@@ -1,331 +0,0 @@
---
aliases:
- ../dashboard-public/ # /docs/grafana/latest/dashboards/dashboard-public/
labels:
products:
- cloud
- enterprise
- oss
title: Externally shared dashboards
menuTitle: Shared dashboards
description: Make your Grafana dashboards externally shared and share them with anyone
weight: 8
refs:
dashboard-sharing:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/share-dashboards-panels/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/share-dashboards-panels/
custom-branding:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/configure-custom-branding/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/configure-custom-branding/
dashboard-insights-documentation:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/assess-dashboard-usage/#dashboard-insights
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/assess-dashboard-usage/
caching:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/#query-and-resource-caching
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/#query-and-resource-caching
grafana-enterprise:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/
---
# Externally shared dashboards
{{< admonition type="note" >}}
This feature was previously called **Public dashboards**.
{{< /admonition >}}
Externally shared dashboards allow you to share your Grafana dashboard with anyone. This is useful when you want to make your dashboard available to the world without requiring access to your Grafana organization.
If you change a dashboard, ensure that you save the changes before sharing.
{{< admonition type="warning" >}}
Sharing your dashboard externally could result in a large number of queries to the data sources used by your dashboard.
This can be mitigated by using the Enterprise [caching](ref:caching) and/or rate limiting features.
{{< /admonition >}}
## Shared dashboards list
You can see a list of all your externally shared dashboards in one place by navigating to **Dashboards > Shared dashboards**. For each dashboard in the list, the page displays:
- Link to view the externally shared version of the dashboard
- Link to the shared dashboard configuration
- Options to pause or revoke access to the external dashboard
You can also click the name of the dashboard to navigate to the dashboard internally.
## Important notes about sharing your dashboard externally
- Anyone with the URL can access the dashboard.
- Externally shared dashboards are read-only.
- Arbitrary queries **cannot** be run against your data sources through externally shared dashboards. Externally shared dashboards can only execute the queries stored on the original dashboard.
## Share externally with specific people
{{< admonition type="note">}}
This feature was previously called **email sharing**.
Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud).
{{< /admonition >}}
To share a dashboard with specific external users, you can send them a link by email. Use this option when you only want to share your dashboard with specific people. When you share dashboards by email, recipients receive a one-time use link that's valid for **one hour**. Once the link is used, the viewer has access to the shared dashboard for **30 days**.
When you share a dashboard with an email link, your organization is billed per user, regardless of how many dashboards are shared. Grafana bills monthly per user until access is revoked.
To share a dashboard with specific people, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share externally**.
The **Share externally** drawer opens.
1. In the **Link access** drop-down list, select **Only specific people**.
1. Click the checkbox confirming that you understand payment is required to add users.
1. Click **Accept**.
1. In the **Invite** field, enter the email address of the person you want to invite and click **Invite** and repeat this process for all the people you want to invite.
You can only invite one person at a time.
1. (Optional) Set the following options:
- **Enable time range** - Allow people accessing the link to change the time range. This configuration screen shows the default time range of the dashboard.
- **Display annotations** - Allow people accessing the link to view the dashboard annotations.
1. (Optional) Click **Copy external link** and send the copied URL to any external user.
1. Click the **X** at the top-right corner to close the share drawer.
Once you've shared a dashboard externally, a **Public** label is displayed in the header of the dashboard.
### Viewers requesting access
If a viewer without access tries to navigate to the shared dashboard, they'll be asked to request access by providing their email. They'll receive an email with a new one-time use link if the email they provided has already been invited to view the shared dashboard and hasn't been revoked.
### Revoke access for a viewer
You can revoke access to the entire dashboard using the steps in [Update access to an external dashboard link](#update-access-to-an-external-dashboard-link), but you can also revoke access to the dashboard for specific people.
To revoke access for a viewer, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share externally**.
1. In the **Share externally** drawer that opens, click the menu icon (three dots) next to the email address of the viewer for whom you'd like to revoke access.
1. Click **Revoke access**.
1. Click the **X** at the top-right corner to close the share drawer.
The viewer immediately no longer has access to the dashboard, nor can they use any existing one-time use links they may have.
### Re-invite a viewer
To re-invite a viewer, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share externally**.
1. In the **Share externally** drawer that opens, click the menu icon (three dots) next to the email address of the viewer you'd like to invite again.
1. Click **Resend invite**.
1. Click the **X** at the top-right corner to close the share drawer.
The viewer receives an email with a new one-time use link. This invalidates all previously issued links for that viewer.
### View shared dashboard users
To see a list of users who have accessed your externally shared dashboard by way of an emailed link, follow these steps:
1. Click **Administration** in in the main menu.
1. Select **Users and access** > **Users**.
1. On the **Users** page, click the **Shared dashboard users** tab.
On this screen, you can see:
- The earliest time a user has been active in a dashboard
- When they last accessed a shared dashboard
- The dashboards to they have access
- Their role
You can also revoke a user's access to all shared dashboards on from this tab.
### Access limitations
One-time use links use browser cookies, so when a viewer is granted access through one of these links, they'll only have access on the browser they used to claim the link.
A single viewer can't generate multiple valid one-time use links for a dashboard. When a new one-time use link is issued for a viewer, all previous ones are invalidated.
If a Grafana user has read access to the parent dashboard, they can view the externally shared dashboard without needing to have access granted.
## Share externally to anyone with a link
To share your dashboard so that anyone with the link can access it, follow these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share externally**.
The **Share externally** drawer opens.
1. In the **Link access** drop-down list, select **Anyone with the link**.
1. Click the checkbox confirming that you understand the entire dashboard will be public.
1. Click **Accept**.
1. (Optional) Set the following options:
- **Enable time range** - Allow people accessing the link to change the time range. This configuration screen shows the default time range of the dashboard.
- **Display annotations** - Allow people accessing the link to view the dashboard annotations.
1. Click the **X** at the top-right corner to close the share drawer.
Now anyone with the link can access the dashboard until you pause or revoke access to it.
Once you've shared a dashboard externally, a **Public** label is displayed in the header of the dashboard.
### Update access to an external dashboard link
You can update the access to externally shared dashboard links by following these steps:
1. Click **Dashboards** in the main menu.
1. Click the dashboard you want to share.
1. Click the **Share** drop-down list in the top-right corner and select **Share externally**.
1. In the **Share externally** drawer that opens, do one of the following:
- Click **Pause access** so that people can't access the dashboard, but the link is maintained.
- Click **Resume access** so that people can access the dashboard again.
- Click **Revoke access** so that people can't access the dashboard unless a new external link is generated. Confirm that you want to revoke the link.
1. Click the **X** at the top-right corner to close the share drawer.
## Assess shared dashboard usage
{{< admonition type="note" >}}
Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud).
{{< /admonition >}}
You can check usage analytics about your externally shared dashboard by clicking the insights icon in the dashboard header:
![Dashboard insights icon](/media/docs/grafana/dashboards/screenshot-dashboard-insights-icon-11.2.png)
Learn more about the kind of information provided in the [dashboard insights documentation](ref:dashboard-insights-documentation).
## Supported data sources
Externally shared dashboards _should_ work with any data source that has the properties `backend` and `alerting` both set to true in its `plugin.json`. However, this can't always be
guaranteed because plugin developers can override this functionality. The following lists include data sources confirmed to work with externally shared dashboards and data sources that should work, but have not been confirmed as compatible.
### Confirmed:
<table>
<tr>
<td>
<ul>
<li>ClickHouse</li>
<li>CloudWatch</li>
<li>Elasticsearch</li>
<li>Infinity</li>
<li>InfluxDB</li>
<li>Loki</li>
<li>Microsoft SQL Server</li>
</ul>
</td>
<td>
<ul>
<li>MongoDB</li>
<li>MySQL</li>
<li>Oracle Database</li>
<li>PostgreSQL</li>
<li>Prometheus</li>
<li>Redis</li>
<li>SQLite</li>
</ul>
</td>
</tr>
</table>
### Unsupported:
<table>
<tr>
<td>
<ul>
<li>Graphite</li>
</ul>
</td>
</tr>
</table>
### Unconfirmed:
<table>
<tr>
<td>
<ul>
<li>Altinity plugin for ClickHouse</li>
<li>Amazon Athena</li>
<li>Amazon Redshift</li>
<li>Amazon Timestream</li>
<li>Apache Cassandra</li>
<li>AppDynamics</li>
<li>Azure Data Explorer Datasource</li>
<li>Azure Monitor</li>
<li>CSV</li>
<li>DB2 Datasource</li>
<li>Databricks</li>
<li>Datadog</li>
<li>Dataset</li>
<li>Druid</li>
</ul>
</td>
<td>
<ul>
<li>Dynatrace</li>
<li>GitHub</li>
<li>Google BigQuery</li>
<li>Grafana for YNAB</li>
<li>Honeycomb</li>
<li>Jira</li>
<li>Mock</li>
<li>Neo4j Datasource</li>
<li>New Relic</li>
<li>OPC UA (Unified Architecture)</li>
<li>Open Distro for Elasticsearch</li>
<li>OpenSearch</li>
<li>OpenTSDB</li>
</ul>
</td>
<td>
<ul>
<li>Orbit</li>
<li>SAP HANA®</li>
<li>Salesforce</li>
<li>Sentry</li>
<li>ServiceNow</li>
<li>Snowflake</li>
<li>Splunk</li>
<li>Splunk Infrastructure Monitoring</li>
<li>Sqlyze data source</li>
<li>TDengine</li>
<li>Vertica</li>
<li>Wavefront</li>
<li>X-Ray</li>
<li>kdb+</li>
<li>simple grpc data source</li>
</ul>
</td>
</tr>
</table>
## Limitations
- Panels that use frontend data sources will fail to fetch data.
- Template variables are not supported.
- Exemplars will be omitted from the panel.
- Only annotations that query the `-- Grafana --` data source are supported.
- Organization annotations are not supported.
- Grafana Live and real-time event streams are not supported.
- Library panels are not supported.
- Data sources using Reverse Proxy functionality are not supported.
## Custom branding
If you're a Grafana Enterprise customer, you can use custom branding to change the appearance of an externally shared dashboard footer. For more information, refer to [Custom branding](ref:custom-branding).

View File

@@ -66,11 +66,6 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/panel-overview/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/panel-overview/
export-dashboards:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/share-dashboards-panels/#export-dashboards
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/share-dashboards-panels/#export-dashboards
---
# Use dashboards
@@ -85,17 +80,15 @@ The dashboard user interface provides a number of features that you can use to c
The following image and descriptions highlight all dashboard features.
![An annotated image of a dashboard](/media/docs/grafana/dashboards/screenshot-dashboard-no-toggle-annotated-11.3.png)
![An annotated image of a dashboard](/media/docs/grafana/dashboards/screenshot-dashboard-annotated-11.2.png)
1. **Grafana home** - Click **Home** in the breadcrumb to go to the home page configured in the Grafana instance.
1. **Dashboard folder** - When you click the dashboard folder name, you can search for other dashboards contained in the folder and perform other [folder management tasks](ref:dashboard-folders).
1. **Dashboard title** - You can create your own dashboard titles or have Grafana create them for you using [generative AI features](ref:generative-ai-features).
1. **Mark as favorite** - Mark the dashboard as one of your favorites so it's included in your list of **Starred** dashboards in the main menu.
1. **Public label** - When you share a dashboard externally, it's marked with the **Public** label.
1. **Dashboard insights** - Click to view analytics about your dashboard including information about users, activity, query counts. Learn more about [dashboard analytics](ref:dashboard-analytics).
1. **Edit** - Click to leave view-only mode and enter edit mode, where you can make changes directly to the dashboard and access dashboard settings, as well as several panel editing functions.
1. **Export** - Access [dashboard exporting](ref:export-dashboards) options.
1. **Share dashboard** - Access several [dashboard sharing](ref:sharing) options.
1. **Edit** - Click to leave view-only mode and enter edit mode, where you can make changes directly to the dashboard and access dashboard settings, as well as several panel editing functions.
1. **Kiosk mode** - Click to display the dashboard on a large screen such as a TV or a kiosk. Kiosk mode hides elements such as navigation menus. Learn more about kiosk mode in our [How to Create Kiosks to Display Dashboards on a TV blog post](https://grafana.com/blog/2019/05/02/grafana-tutorial-how-to-create-kiosks-to-display-dashboards-on-a-tv/). Press `Enter` to leave kiosk mode.
1. **Variables** - Use [variables](ref:variables) to create more interactive and dynamic dashboards.
1. **Dashboard links** - Link to other dashboards, panels, and external websites. Learn more about [dashboard links](ref:dashboard-links).
@@ -130,11 +123,10 @@ By hovering over a panel with the mouse you can use some shortcuts that will tar
- `e`: Toggle panel edit view
- `v`: Toggle panel fullscreen view
- `pu`: Open share panel link configuration
- `pe`: Open share panel embed configuration
- `ps`: Open share panel snapshot configuration
- `pd`: Duplicate panel
- `pr`: Remove panel
- `ps`: Open Panel Share Modal
- `pd`: Duplicate Panel
- `pr`: Remove Panel
- `pl`: Toggle panel legend
## Set dashboard time range

View File

@@ -138,6 +138,8 @@ A data source that uses the result set from another panel in the same dashboard.
These built-in core data sources are also included in the Grafana documentation:
{{< column-list >}}
- [Alertmanager]({{< relref "./alertmanager" >}})
- [AWS CloudWatch]({{< relref "./aws-cloudwatch" >}})
- [Azure Monitor]({{< relref "./azure-monitor" >}})
@@ -157,6 +159,8 @@ These built-in core data sources are also included in the Grafana documentation:
- [Testdata]({{< relref "./testdata" >}})
- [Zipkin]({{< relref "./zipkin" >}})
{{< /column-list >}}
## Add additional data source plugins
You can add additional data sources as plugins (that are not available in core Grafana), which you can install or create yourself.

View File

@@ -238,6 +238,10 @@ You can attach these permissions to the IAM role or IAM user you configured in [
}
```
{{< admonition type="note" >}}
Cross-account observability lets you to retrieve metrics and logs across different accounts in a single region but you can't query EC2 Instance Attributes across accounts because those come from the EC2 API and not the CloudWatch API.
{{< /admonition >}}
### Configure CloudWatch settings
#### Namespaces of Custom Metrics

View File

@@ -4,7 +4,7 @@ aliases:
- ../data-sources/influxdb/provision-influxdb/
- ../features/datasources/influxdb/
- provision-influxdb/
description: Guide for using InfluxDB in Grafana
description: InfluxDB data source for Grafana
keywords:
- grafana
- influxdb
@@ -19,242 +19,42 @@ menuTitle: InfluxDB
title: InfluxDB data source
weight: 700
refs:
explore:
annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/build-dashboards/annotate-visualizations/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/
build-dashboards:
destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/annotate-visualizations/
alerting:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/build-dashboards/
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/build-dashboards/
data-source-management:
destination: /docs/grafana-cloud/alerting-and-irm/alerting/
transformations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/query-transform-data/transform-data/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/transform-data/
---
# InfluxDB data source
{{< docs/shared lookup="influxdb/intro.md" source="grafana" version="<GRAFANA_VERSION>" >}}
Grafana includes built-in support for InfluxDB.
This topic explains options, variables, querying, and other features specific to the InfluxDB data source, which include
its [feature-rich code editor for queries and visual query builder]({{< relref "./query-editor" >}}).
Grafana includes built-in support for InfluxDB. You do not have to install a plugin to add the InfluxDB data source.
For instructions on how to add a data source to Grafana, refer to
the [administration documentation](ref:data-source-management).
Only users with the organization administrator role can add data sources.
Administrators can also [configure the data source via YAML](#provision-the-data-source) with Grafana's provisioning
system.
Grafana offers multiple configuration options for the InfluxDB data source, including a choice of three query languages and a robust query editor that includes both a code editor and a visual query builder.
Once you've added the InfluxDB data source, you can [configure it](#configure-the-data-source) so that your Grafana
instance's users can create queries in its [query editor]({{< relref "./query-editor" >}}) when
they [build dashboards](ref:build-dashboards) and use [Explore](ref:explore).
## Get started with the InfluxDB data source
## Configure the data source
The following documents will help you get started with the InfluxDB data source in Grafana:
To configure basic settings for the data source, complete the following steps:
- [Get started with Grafana and InfluxDB](/docs/grafana/<GRAFANA_VERSION>/getting-started/get-started-grafana-influxdb/)
- [Configure the InfluxDB data source](./configure-influxdb-data-source/)
- [InfluxDB query editor](./query-editor/)
- [InfluxDB templates and variables](./template-variables/)
1. Click **Connections** in the left-side menu.
1. Under Your connections, click **Data sources**.
1. Enter `InfluxDB` in the search bar.
1. Select **InfluxDB**.
Once you have configured the data source you can:
The **Settings** tab of the data source is displayed.
1. Set the data source's basic configuration options carefully:
| Name | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Name** | Sets the name you use to refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`. |
| **Default** | Sets whether the data source is pre-selected for new panels. |
| **URL** | The HTTP protocol, IP address, and port of your InfluxDB API. InfluxDB's default API port is 8086. |
| **Min time interval** | _(Optional)_ Refer to [Min time interval](#configure-min-time-interval). |
| **Max series** | _(Optional)_ Limits the number of series and tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have many small time series and not all are shown. Defaults to 1,000. |
You can also configure settings specific to the InfluxDB data source. These options are described in the sections below.
### Min time interval
The **Min time interval** setting defines a lower limit for the auto group-by time interval.
This value _must_ be formatted as a number followed by a valid time identifier:
| Identifier | Description |
| ---------- | ----------- |
| `y` | year |
| `M` | month |
| `w` | week |
| `d` | day |
| `h` | hour |
| `m` | minute |
| `s` | second |
| `ms` | millisecond |
We recommend setting this value to match your InfluxDB write frequency.
For example, use `1m` if InfluxDB writes data every minute.
You can also override this setting in a dashboard panel under its data source options.
### Select a query language
InfluxDB data source options differ depending on which query language you select:
- [InfluxQL](https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/), a SQL-like language for querying
InfluxDB, with statements such as SELECT, FROM, WHERE, and GROUP BY that are familiar to SQL users.
InfluxQL is available in InfluxDB 1.0 onwards.
- [SQL](https://www.influxdata.com/products/sql/) native SQL language with
support [FlightSQL](https://www.influxdata.com/glossary/apache-arrow-flight-sql/).
- [Flux](https://docs.influxdata.com/influxdb/v2.0/query-data/get-started/), which provides significantly broader
functionality than InfluxQL. It supports not only queries but also built-in functions for data shaping, string
manipulation, and joining to non-InfluxDB data sources, but also processing time-series data.
It's similar to JavaScript with a functional style.
To help choose the best language for your needs, refer to
a [comparison of Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/)
and [why InfluxData created Flux](https://www.influxdata.com/blog/why-were-building-flux-a-new-data-scripting-and-query-language/).
{{% admonition type="note" %}}
Though not required, we recommend that you append your query language choice to the data source's **Name** setting:
- InfluxDB-InfluxQL
- InfluxDB-SQL
- InfluxDB-Flux
{{% /admonition %}}
### Configure InfluxQL
Configure these options if you select the InfluxQL (classic InfluxDB) query language:
| Name | Description |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Allowed cookies** | Defines which cookies are forwarded to the data source. All other cookies are deleted. |
| **Database** | Sets the ID of the bucket to query. Copy this from the [Buckets page](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) of the InfluxDB UI. |
| **User** | Sets the username to sign into InfluxDB. |
| **Password** | Defines the token you use to query the bucket defined in **Database**. Copy this from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI. |
| **HTTP mode** | Sets the HTTP method used to query your data source. The POST verb allows for larger queries that would return an error using the GET verb. Defaults to GET. |
### Configure SQL
Configure these options if you select the SQL query language:
| Name | Description |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Database** | Sets the ID of the bucket to query. Copy this from the Buckets page of the InfluxDB UI. |
| **Token** | API token used for SQL queries. It can be generated on InfluxDB Cloud dashboard under [Load Data > API Tokens](https://docs.influxdata.com/influxdb/cloud-serverless/get-started/setup/#create-an-all-access-api-token) menu. |
| **Insecure Connection** | Disable gRPC TLS security. |
### Configure Flux
Configure these options if you select the Flux query language:
| Name | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Organization** | The [Influx organization](https://v2.docs.influxdata.com/v2.0/organizations/) that will be used for Flux queries. This is also used to for the `v.organization` query macro. |
| **Token** | The authentication token used for Flux queries. With Influx 2.0, use the [influx authentication token to function](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/). Token must be set as `Authorization` header with the value `Token <generated-token>`. For influx 1.8, the token is `username:password`. |
| **Default bucket** | _(Optional)_ The [Influx bucket](https://v2.docs.influxdata.com/v2.0/organizations/buckets/) that will be used for the `v.defaultBucket` macro in Flux queries. |
### Provision the data source
You can define and configure the data source in YAML files as part of Grafana's provisioning system.
For more information about provisioning, and for available configuration options, refer
to [Provisioning Grafana][provisioning-data-sources].
{{% admonition type="note" %}}
`database` [field is deprecated](https://github.com/grafana/grafana/pull/58647).
We suggest to use `dbName` field in `jsonData`. Please see the examples below.
No need to change existing provisioning settings.
{{% /admonition %}}
#### Provisioning examples
**InfluxDB 1.x example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v1
type: influxdb
access: proxy
user: grafana
url: http://localhost:8086
jsonData:
dbName: site
httpMode: GET
secureJsonData:
password: grafana
```
**InfluxDB 2.x for Flux example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v2_Flux
type: influxdb
access: proxy
url: http://localhost:8086
jsonData:
version: Flux
organization: organization
defaultBucket: bucket
tlsSkipVerify: true
secureJsonData:
token: token
```
**InfluxDB 2.x for InfluxQL example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v2_InfluxQL
type: influxdb
access: proxy
url: http://localhost:8086
jsonData:
dbName: site
httpHeaderName1: 'Authorization'
secureJsonData:
httpHeaderValue1: 'Token <token>'
```
**InfluxDB 3.x for SQL example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v3_InfluxQL
type: influxdb
access: proxy
url: http://localhost:8086
jsonData:
version: SQL
dbName: site
httpMode: POST
insecureGrpc: false
secureJsonData:
token: '<api-token>'
```
## Query the data source
The InfluxDB data source's query editor has two modes, InfluxQL and Flux, depending on your choice of query language in
the [data source configuration](#configure-the-data-source):
For details, refer to the [query editor documentation]({{< relref "./query-editor" >}}).
## Use template variables
Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables.
Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed
in your dashboard.
Grafana refers to such variables as template variables.
For details, see the [template variables documentation]({{< relref "./template-variables" >}}).
- Add [annotations](ref:annotations)
- Set up [alerting](ref:alerting)
- Add [transformations](ref:transformations)

View File

@@ -0,0 +1,259 @@
---
aliases:
- ../data-sources/influxdb/
- ../data-sources/influxdb/provision-influxdb/
- ../features/datasources/influxdb/
- provision-influxdb/
description: Guide for using InfluxDB in Grafana
keywords:
- grafana
- influxdb
- guide
- flux
labels:
products:
- cloud
- enterprise
- oss
menuTitle: Configure the InfluxDB data source
title: Configure the InfluxDB data source
weight: 300
refs:
provision-grafana:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/provisioning/#provision-grafana
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/provisioning/#provision-grafana
---
# Configure the InfluxDB data source
This document provides instructions for configuring the InfluxDB data source and explains the available configuration options.
## Before you begin
To configure the InfluxDB data source you must have the `Administrator` role.
{{< admonition type="note" >}}
Select the query language you want to use with InfluxDB before adding the InfluxDB data source. Configuration options differ based on query language type.
{{< /admonition >}}
InfluxData provides three query languages. Some key points to consider:
- SQL is only available for InfluxDB v3.x.
- Flux is a functional data scripting language for InfluxDB 2.x. Refer to [Query InfluxDB with Flux](https://docs.influxdata.com/influxdb/cloud/query-data/get-started/query-influxdb/) for a basic guide on working with Flux.
- InfluxQL is SQL-like query language developed by InfluxData. It doesn't support more advanced functions such as JOINs.
To help choose the best language for your needs, refer to
a [comparison of Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/)
and [Why InfluxData created Flux](https://www.influxdata.com/blog/why-were-building-flux-a-new-data-scripting-and-query-language/).
## Add the InfluxDB data source
Complete the following steps to set up a new InfluxDB data source:
1. Click **Connections** in the left-side menu.
2. Click **Add new connection**.
3. Type `InfluxDB` in the search bar.
4. Select the **InfluxDB** data source.
5. Click **Add new data source** in the upper right.
You are taken to the **Settings** tab where you will configure the data source.
## InfluxDB common configuration options
The following configuration options apply to **all three query language options**.
- **Name** - Sets the name you use to refer to the data source in panels and queries. Examples: `InfluxDB-InfluxQL`, `InfluxDB_SQL`.
- **Default** - Toggle to set as the default data source.
- **Query language** - Select the query language for your InfluxDB instance. The three options are:
- **InfluxQL** - SQL-like language for querying InfluxDB, with statements such as SELECT, FROM, WHERE, and GROUP BY that are familiar to SQL users.
- **SQL** - Native SQL language starting with InfluxDB v.3.0. Refer to InfluxData's [SQL reference documentation](https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/) for a list of supported statements, operators, and functions.
- **Flux** - Flux is a data scripting language developed by InfluxData that allows you to query, analyze, and act on data. Refer to [Get started with Flux](https://docs.influxdata.com/influxdb/cloud/query-data/get-started/) for guidance on using Flux.
**HTTP section:**
- **URL** - The HTTP protocol, IP address, and port of your InfluxDB API. InfluxDBs default API port is `8086`.
- **Allowed cookies** - Defines which cookies are forwarded to the data source. All other cookies are deleted by default.
- **Timeout** - Set an HTTP request timeout in seconds.
**Auth section:**
- **Basic auth** - The most common authentication method. Use your InfluxData user name and password to authenticate. Toggling requires you to add the user and password under **Basic auth details**.
- **With credentials** - Toggle to enable credentials such as cookies or auth headers to be sent with cross-site requests.
- **TLS client auth** - Toggle to use client authentication. When enabled, add the `Server name`, `Client cert` and `Client key` under the **TLS/SSL auth details** section. The client provides a certificate that the server validates to establish the clients trusted identity. The client key encrypts the data between client and server.
- **With CA cert** - Authenticate with a CA certificate. Follow the instructions of your CA (Certificate Authority) to download the certificate file.
- **Skip TLS verify** - Toggle to bypass TLS certificate validation.
- **Forward OAuth identity** - Forward the OAuth access token (and also the OIDC ID token if available) of the user querying the data source.
**Basic auth details:**
If you enable **Basic auth** under the Auth section you need to configure the following:
- **User** - Add the username used to sign in to InfluxDB.
- **Password** - Defines the token you use to query the bucket defined in **Database**. Retrieve this from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) in the InfluxDB UI.
**TLS/SSL auth details:**
TLS/SSL certificates are encrypted and stored in the Grafana database.
- **CA cert** - If you toggle **With CA cert** add your self-signed cert here.
- **Server name** - Name of the server. Example: server1.domain.com
- **Client cert** - Add the client certificate.
- **Client key** - Add the client key.
**Custom HTTP headers:**
- **Header** - Add a custom HTTP header. Select an option from the drop-down. Allows custom headers to be passed based on the needs of your InfluxDB instance.
- **Value** - The value for the header.
**Private data source connect:**
- **Private data source connect** - _Only for Grafana Cloud users._ Private data source connect, or PDC, allows you to establish a private, secured connection between a Grafana Cloud instance, or stack, and data sources secured within a private network. Click the drop-down to locate the URL for PDC. For more information regarding Grafana PDC refer to [Private data source connect (PDC)](https://grafana.com/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/).
Click **Manage private data source connect** to be taken to your PDC connection page, where you'll find your PDC configuration details.
Once you have added your connection settings, click **Save & test** to test the data source connection.
### InfluxQL-specific configuration section
The following settings are specific to the InfluxQL query language option.
**InfluxQL InfluxDB details section:**
- **Database** - Sets the ID of the bucket to query. Refer to [View buckets](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) in InfluxData's documentation on how to locate the list of available buckets and their corresponding IDs.
- **User** - The user name used to sign in to InfluxDB.
- **Password** - Defines the token used to query the bucket defined in **Database**. Retrieve the password from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI.
- **HTTP method** - Sets the HTTP method used to query your data source. The POST method allows for larger queries that would return an error using the GET method. The default method is `POST`.
- **Min time interval** - _(Optional)_ Sets the minimum time interval for auto group-by. Grafana recommends setting this to match the data write frequency. For example, if your data is written every minute, its recommended to set this interval to 1 minute, so that each group contains data from each new write. The default is `10s`. Refer to [Min time interval](#min-time-interval) for format examples.
- **Max series** - _(Optional)_ Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is `1000`.
### SQL-specific configuration section
The following settings are specific to the SQL query language option.
**SQL InfluxDB details section:**
- **Database** - Specify the **bucket ID**. Refer to the **Buckets page** in the InfluxDB UI to locate the ID.
- **Token** The API token used for SQL queries. Generated on InfluxDB Cloud dashboard under [Load Data > API Tokens](https://docs.influxdata.com/influxdb/cloud-serverless/get-started/setup/#create-an-all-access-api-token) menu.
- **Insecure Connection** - Toggle to disable gRPC TLS security.
- **Max series** - _(Optional)_ Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is `1000`.
### Flux-specific configuration section
The following settings are specific to the Flux query language option.
**Flux InfluxDB details section:**
- **Organization** - The [Influx organization](https://v2.docs.influxdata.com/v2.0/organizations/) used for Flux queries. Also used for the `v.organization` query macro.
- **Token** - The authentication token used for Flux queries. With Influx 2.0, use the [influx authentication token to function](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/). Token must be set as `Authorization` header with the value `Token <generated-token>`. For Influx 1.8, the token is `username:password`.
- **Default bucket** - _(Optional)_ The [Influx bucket](https://v2.docs.influxdata.com/v2.0/organizations/buckets/) used for the `v.defaultBucket` macro in Flux queries.
- **Min time interval** - Sets the minimum time interval for auto group-by. Grafana recommends aligning this setting with the data write frequency. For example, if data is written every minute, set the interval to 1 minute to ensure each group includes data from every new write. The default is `10s`.
- **Max series** - Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is `1000`.
### Min time interval
The **Min time interval** setting defines a lower limit for the auto group-by time interval.
This value **must be** formatted as a number followed by a valid time identifier:
| Identifier | Description |
| ---------- | ----------- |
| `y` | year |
| `M` | month |
| `w` | week |
| `d` | day |
| `h` | hour |
| `m` | minute |
| `s` | second |
| `ms` | millisecond |
You can also override this setting in a dashboard panel under its data source options.
## Provision the InfluxDB data source
You can define and configure the data source in YAML files as part of Grafana's provisioning system.
For more information about provisioning, and for available configuration options, refer
to [Provision Grafana](ref:provision-grafana).
{{% admonition type="note" %}}
The `database` [field is deprecated](https://github.com/grafana/grafana/pull/58647).
Grafana recommends using the `dbName` field in `jsonData`. There is no need to change existing provisioning settings.
{{% /admonition %}}
### Provisioning examples
Provisioning differs based on query language.
**InfluxDB 1.x example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v1
type: influxdb
access: proxy
user: grafana
url: http://localhost:8086
jsonData:
dbName: site
httpMode: GET
secureJsonData:
password: grafana
```
**InfluxDB 2.x for Flux example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v2_Flux
type: influxdb
access: proxy
url: http://localhost:8086
jsonData:
version: Flux
organization: organization
defaultBucket: bucket
tlsSkipVerify: true
secureJsonData:
token: token
```
**InfluxDB 2.x for InfluxQL example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v2_InfluxQL
type: influxdb
access: proxy
url: http://localhost:8086
jsonData:
dbName: site
httpHeaderName1: 'Authorization'
secureJsonData:
httpHeaderValue1: 'Token <token>'
```
**InfluxDB 3.x for SQL example:**
```yaml
apiVersion: 1
datasources:
- name: InfluxDB_v3_InfluxQL
type: influxdb
access: proxy
url: http://localhost:8086
jsonData:
version: SQL
dbName: site
httpMode: POST
insecureGrpc: false
secureJsonData:
token: '<api-token>'
```

View File

@@ -2,14 +2,15 @@
aliases:
- ../../data-sources/influxdb/query-editor/
- influxdb-flux/
description: Guide for Flux in Grafana
description: This topic describes the InfluxDB query editor, modes and querying the InfluxDB data source.
labels:
products:
- cloud
- enterprise
- oss
title: Query Editor
weight: 200
title: InfluxDB query Editor
menuTitle: Query editor
weight: 400
refs:
explore:
- pattern: /docs/grafana/
@@ -31,45 +32,80 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/visualizations/logs/
- pattern: /docs/grafana-cloud/
destination: grafana-cloud/visualizations/panels-visualizations/visualizations/logs/
query-editor:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/panels-visualizations/query-transform-data/#query-editors
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/#query-editors
build-dashboards:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/build-dashboards/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/
data-source-management:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/data-source-management/
annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/build-dashboards/annotate-visualizations/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/annotate-visualizations/
configure-influxdb-data-source:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/datasources/influxdb/configure-influxdb-data-source/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/datasources/influxdb/configure-influxdb-data-source/
---
# InfluxDB query editor
This topic explains querying specific to the InfluxDB data source.
For general documentation on querying data sources in Grafana, see [Query and transform data](ref:query-transform-data).
Grafana's query editors are unique to each data source. For general information on Grafana query editors, refer to [Query editors](ref:query-editor). For general information on querying data sources in Grafana, refer to [Query and transform data](ref:query-transform-data).
The InfluxDB query editor is located on the [Explore page](ref:explore). You can also access the InfluxDB query editor from a dashboard panel. Click the ellipsis in the upper right of the panel and select **Edit**.
You can also use the query editor to retrieve [log data](#query-logs) and [annotate](#apply-annotations) visualizations.
## Choose a query editing mode
The InfluxDB data source's query editor has two modes depending on your choice of query language in
the [data source configuration]({{< relref "../#configure-the-data-source" >}}):
The InfluxDB data source has three different types of query editors, each corresponding to the query language selected in the [data source configuration](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/datasources/influxdb/configure-influxdb-data-source/#influxdb-configuration-options):
- [InfluxQL](#influxql-query-editor)
- [SQL](#sql-query-editor)
- [Flux](#flux-query-editor)
You also use the query editor to retrieve [log data](#query-logs) and [annotate](#apply-annotations) visualizations.
Editor options vary based on query language.
## InfluxQL query editor
The InfluxQL query editor helps you select metrics and tags to create InfluxQL queries.
The InfluxQL query editor helps you select metrics and tags to create InfluxQL queries. There are two modes: `visual editor mode` and `raw query mode`. To switch between the two modes click the **pencil icon** in the upper right.
**To enter edit mode:**
Visual query editor mode contains the following components:
1. Hover over any part of the panel to display the actions menu on the top right corner.
1. Click the menu and select **Edit**.
- **FROM** - Select a measurement to query.
- **WHERE** - Select filters by clicking the **+ sign**.
- **SELECT** - Select fields and functions from the drop-down. You can add multiple fields and functions by clicking the **+ sign**.
- **GROUP BY** - Select a tag from the drop-down menu.
- **TIMEZONE** - _Optional_ Group data by a specific timezone.
- **ORDER BY TIME** - Sort data by time in either ascending or descending order.
- **LIMIT** - _Optional_ Limits the number of rows returned by the query.
- **SLIMIT** - _Optional_ Limits the number of series returned by the query. Refer to [SLIMIT clause](https://docs.influxdata.com/influxdb/cloud/query-data/influxql/explore-data/limit-and-slimit/#slimit-clause) for more information on this option.
- **FORMAT AS** - Select a format option from the drop-down menu.
- **ALIAS** - Add an alias. Refer to [Alias patterns](#alias-patterns) for more information.
### Raw query editor mode
You can write raw InfluxQL queries by switching to raw query mode. Click the pencil in the upper right of the query editor to switch modes. Note that when you switch to visual editor mode, you will lose any changes made in raw query mode.
If you use raw query mode, your query must include `WHERE $timeFilter`. You should also provide a group by time and an aggregation function. Otherwise, InfluxDB may return hundreds of thousands of data points, potentially causing your browser to hang.
![InfluxQL query editor](/static/img/docs/influxdb/influxql-query-editor-8-0.png)
### Filter data (WHERE)
To add a tag filter, click the plus icon to the right of the `WHERE` condition.
To remove tag filters, click the tag key, then select **--remove tag filter--**.
#### Match by regular expressions
### Match by regular expressions
You can enter regular expressions for metric names or tag filter values.
Wrap the regex pattern in forward slashes (`/`).
Wrap the regex pattern in forward slashes (`/`), as shown in this example: `/measurement/`.
Grafana automatically adjusts the filter tag condition to use the InfluxDB regex match condition operator (`=~`).
@@ -77,56 +113,35 @@ Grafana automatically adjusts the filter tag condition to use the InfluxDB regex
In the `SELECT` row, you can specify which fields and functions to use.
If you have a group by time, you must have an aggregation function.
Some functions like `derivative` also require an aggregation function.
If you **group by time** you must use an aggregation function. Certain functions such as `derivative` also require an aggregation function.
The editor helps you build this part of the query.
For example:
If you have the following:
![](/static/img/docs/influxdb/select_editor.png)
This query editor input generates an InfluxDB `SELECT` clause:
The query editor input generates an InfluxDB `SELECT` clause:
```sql
SELECT derivative(mean("value"), 10s) / 10 AS "REQ/s"
FROM....
```
**To select multiple fields:**
You can also use a \* in a SELECT statement to select all fields.
1. Click the plus button.
1. Select **Field > field** to add another `SELECT` clause.
```sql
SELECT * FROM <measurement_name>
```
You can also `SELECT` an asterisk (`*`) to select all fields.
### GROUP BY results
### Group query results
To group results by a tag, specify the tag in the **GROUP BY** row:
To group results by a tag, define it in a "Group By".
1. Click the **+ sign** in the GROUP BY row.
1. Select a tag from the drop-down.
**To group by a tag:**
You can GROUP BY multiple options.
1. Click the plus icon at the end of the GROUP BY row.
1. Select a tag from the dropdown that appears.
**To remove the "Group By":**
1. Click the tag.
1. Click the "x" icon.
### Text editor mode (RAW)
You can write raw InfluxQL queries by switching the editor mode.
However, be careful when writing queries manually.
If you use raw query mode, your query _must_ include at least `WHERE $timeFilter`.
Also, _always_ provide a group by time and an aggregation function.
Otherwise, InfluxDB can easily return hundreds of thousands of data points that can hang your browser.
**To switch to raw query mode:**
1. Click the hamburger icon.
1. Toggle **Switch editor mode**.
To remove a GROUP BY option click the **X icon** next to the option.
### Alias patterns
@@ -138,20 +153,21 @@ Otherwise, InfluxDB can easily return hundreds of thousands of data points that
| `$col` | Column name. |
| `$tag_exampletag` | The value of the `exampletag` tag. The syntax is `$tag*yourTagName` and must start with `$tag*`. To use your tag as an alias in the ALIAS BY field, you must use the tag to group by in the query. |
You can also use `[[tag_hostname]]` pattern replacement syntax.
You can also use the `[[tag_hostname]]` pattern replacement syntax.
For example, entering the value `Host: [[tag_hostname]]` in the ALIAS BY field replaces it with the `hostname` tag value
for each legend value.
An example legend value would be `Host: server1`.
For example, entering the value `Host: [[tag_hostname]]` in the ALIAS BY field replaces it with the `hostname` tag value for each legend value.
An example legend value is `Host: server1`.
## SQL query editor
Grafana support [SQL querying language](https://docs.influxdata.com/influxdb/cloud-serverless/query-data/sql/)
with [InfluxDB v3.0](https://www.influxdata.com/blog/introducing-influxdb-3-0/) and higher.
Grafana supports the [SQL query language](https://docs.influxdata.com/influxdb/cloud-serverless/query-data/sql/) in [InfluxDB v3.0](https://www.influxdata.com/blog/introducing-influxdb-3-0/) and higher.
You construct your SQL query directly in the query editor.
### Macros
You can use macros within the query to replace them with the values from Grafana's context.
You can use macros in your query to automatically substitute them with values from Grafana's context.
| Macro example | Replaced with |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -179,12 +195,12 @@ Examples:
## Flux query editor
Grafana supports Flux when running InfluxDB v1.8 and higher.
If your data source is [configured for Flux]({{< relref "./#configure-the-data-source" >}}), you can use
the [Flux query and scripting language](https://www.influxdata.com/products/flux/) in the query editor, which serves as
If your data source is [configured for Flux](ref:configure-influxdb-data-source), you can use
the [Flux](https://docs.influxdata.com/flux/v0/) in the query editor, which serves as
a text editor for raw Flux queries with macro support.
For more information and connection details, refer
to [1.8 compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility).
to [InfluxDB 1.8 API compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility).
### Use macros
@@ -199,7 +215,7 @@ Macros support copying and pasting from [Chronograf](https://www.influxdata.com/
| `v.defaultBucket` | The data source configuration's "Default Bucket" setting. |
| `v.organization` | The data source configuration's "Organization" setting. |
For example, the query editor interpolates this query:
For example, consider the following Flux query:
```flux
from(bucket: v.defaultBucket)
@@ -210,8 +226,7 @@ from(bucket: v.defaultBucket)
|> yield(name: "mean")
```
Into this query to send to InfluxDB, with interval and time period values changing according to the active time
selection:
This Flux query is interpolated into the following query and sent to InfluxDB, with the interval and time period values changing according to the active time selection:
```flux
from(bucket: "grafana")
@@ -222,33 +237,20 @@ from(bucket: "grafana")
|> yield(name: "mean")
```
To view the interpolated version of a query with the query inspector, refer to [Panel Inspector](ref:panel-inspector).
To view the interpolated version of a query with the Query inspector, refer to [Panel Inspector](ref:panel-inspector).
## Query logs
You can query and display log data from InfluxDB in [Explore](ref:explore) and with the [Logs panel](ref:logs) for dashboards.
You can query and display log data from InfluxDB in [Explore](ref:explore) and in the dashboard [Logs panel](ref:logs).
Select the InfluxDB data source, then enter a query to display your logs.
Select an InfluxDB data source in the Query editor. Under the **Select measurement field** next to the **FROM** section, choose a measurement containing your log data, then choose the appropriate fields that will display the log message. Add any additional filters by clicking the **+ sign** next to the **WHERE** field. Add additional conditions in the GROUP BY, ORDER BY and the rest of the options.
### Create log queries
The Logs Explorer next to the query field, accessed by the **Measurements/Fields** button, lists measurements and
fields.
Choose the desired measurement that contains your log data, then choose which field to use to display the log message.
Once InfluxDB returns the result, the log panel lists log rows and displays a bar chart, where the x axis represents the
time and the y axis represents the frequency/count.
### Filter search
To add a filter, click the plus icon to the right of the **Measurements/Fields** button, or next to a condition.
To remove tag filters, click the first select, then choose **--remove filter--**.
After InfluxDB returns the results, the log panel displays log rows along with a bar chart. The x-axis represents time, while the y-axis shows the frequency or count.
## Apply annotations
[Annotations][annotate-visualizations] overlay rich event information on top of graphs.
You can add annotation queries in the Dashboard menu's Annotations view.
[Annotations](ref:annotations) overlay rich event information on top of graphs.
You can add annotation queries in the dashboard menu's **Annotations view**.
For InfluxDB, your query **must** include `WHERE $timeFilter`.

View File

@@ -17,7 +17,7 @@ labels:
- oss
menuTitle: Template variables
title: InfluxDB template variables
weight: 300
weight: 600
refs:
add-template-variables-chained-variables:
- pattern: /docs/grafana/
@@ -39,57 +39,62 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/variables/add-template-variables/#add-ad-hoc-filters
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/variables/add-template-variables/#add-ad-hoc-filters
add-template-variables-adds-a-query-variable:
add-template-variables-add-a-query-variable:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/variables/add-template-variables/#add-a-query-variable
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/variables/add-template-variables/#add-a-query-variable
variable-best-practices:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/dashboards/variables/#variable-best-practices
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/dashboards/variables/#variable-best-practices
---
# InfluxDB template variables
Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables.
Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard.
Grafana refers to such variables as template variables.
Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana displays these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.
For an introduction to templating and template variables, refer to the [Templating](ref:variables) and [Add and manage variables](ref:add-template-variables) documentation.
For additional information using variables and templates, refer to the following documentation:
- [Variables](ref:variables)
- [Templates](ref:variables)
- [Add and manage variables](ref:add-template-variables)
- [Variable best practices](ref:variable-best-practices)
## Use query variables
If you add a query template variable, you can write an InfluxDB exploration (metadata) query.
These queries can return results like measurement names, key names, or key values.
By adding a query template variable, you can write an InfluxDB metadata exploration query. These queries return results such as measurement names, key names, and key values.
For more information, refer to [Add query variable](ref:add-template-variables-adds-a-query-variable).
For more information, refer to [Add a query variable](ref:add-template-variables-add-a-query-variable).
For example, to create a variable that contains all values for tag `hostname`, specify a query like this in the query variable **Query**:
To create a variable containing all values for the `hostname` tag, use the following query format in the **Query** variable:
```sql
SHOW TAG VALUES WITH KEY = "hostname"
```
### Chain or nest variables
## Chain or nest variables
You can also create nested variables, sometimes called [chained variables](ref:add-template-variables-chained-variables).
For example, if you had a variable called `region`, you could have the `hosts` variable show only hosts from the selected region with a query like:
For example, if you have a variable named `region`, you can configure the `hosts` variable to display only hosts from the selected region using the following query:
```sql
SHOW TAG VALUES WITH KEY = "hostname" WHERE region = '$region'
```
You can fetch key names for a given measurement:
You can also fetch key names for a given measurement:
```sql
SHOW TAG KEYS [FROM <measurement_name>]
```
If you have a variable with key names, you can use this variable in a group-by clause.
This helps you change group-by using the variable list at the top of the dashboard.
If you have a variable containing key names, you can use it in a **GROUP BY** clause. This allows you to adjust the grouping by selecting from the variable list at the top of the dashboard
### Use ad hoc filters
## Use ad hoc filters
InfluxDB supports the special **Ad hoc filters** variable type.
You can use this variable type to specify any number of key/value filters, and Grafana applies them automatically to all of your InfluxDB queries.
InfluxDB supports the **Ad hoc filters** variable type. This variable type allows you to define multiple key/value filters, which Grafana then automatically applies to all your InfluxDB queries.
For more information, refer to [Add ad hoc filters](ref:add-template-variables-add-ad-hoc-filters).
@@ -97,13 +102,13 @@ For more information, refer to [Add ad hoc filters](ref:add-template-variables-a
The InfluxDB data source supports two variable syntaxes for use in the **Query** field:
- `$<varname>`, which is easier to read and write but does not allow you to use a variable in the middle of a word.
- `$<varname>` - This syntax is easy to read and write but does not allow you to use a variable in the middle of a word or expression.
```sql
SELECT mean("value") FROM "logins" WHERE "hostname" =~ /^$host$/ AND $timeFilter GROUP BY time($__interval), "hostname"
```
- `${varname}`
- `${varname}` - Use this syntax when you want to interpolate a variable in the middle of an expression.
```sql
SELECT mean("value") FROM "logins" WHERE "hostname" =~ /^[[host]]$/ AND $timeFilter GROUP BY time($__interval), "hostname"
@@ -113,4 +118,4 @@ When you enable the **Multi-value** or **Include all value** options, Grafana co
### Templated dashboard example
To view an example templated dashboard, refer to this [InfluxDB templated dashboard](https://play.grafana.org/d/f62a0410-5abb-4dd8-9dfc-caddfc3e2ffd/eccb2445-b0a2-5e83-8e0f-6d5ea53ad575).
To view an example of a templated dashboard, refer to this [InfluxDB example dashboard](https://play.grafana.org/d/f62a0410-5abb-4dd8-9dfc-caddfc3e2ffd/eccb2445-b0a2-5e83-8e0f-6d5ea53ad575).

View File

@@ -430,9 +430,7 @@ SELECT hostname FROM my_host WHERE hostname LIKE '$__searchFilter'
### Using Variables in Queries
From Grafana 4.3.0 to 4.6.0, template variables are always quoted automatically. If your template variables are strings, do not wrap them in quotes in where clauses.
From Grafana 4.7.0, template variable values are only quoted when the template variable is a `multi-value`.
Template variable values are only quoted when the template variable is a `multi-value`.
If the variable is a multi-value variable then use the `IN` comparison operator rather than `=` to match against multiple values.

View File

@@ -155,7 +155,7 @@ We also bundle a dashboard within Grafana so you can start viewing your metrics
1. Navigate to the data source's [configuration page](ref:configure-prometheus-data-source).
1. Select the **Dashboards** tab.
This displays dashboards for Grafana and Prometheus.
This displays dashboards for Grafana and Prometheus.
1. Select **Import** for the dashboard to import.

View File

@@ -51,7 +51,7 @@ To use profiling data, you should:
- [Configure your application to send profiles](/docs/pyroscope/<PYROSCOPE_VERSION>/configure-client/)
- [Configure the Grafana Pyroscope data source](./configure-pyroscope-data-source/).
- [View and query profiling data in Explore](./query-profile-data/)
- [View and query profiling data using Explore Profiles or the query editor ](./query-profile-data/)
## Integrate profiles into dashboards

View File

@@ -1,5 +1,5 @@
---
description: Use the query editor to explore your Pyroscope data.
description: Explore your profiling data using Explore Profiles or the Pyroscope query editor.
keywords:
- query
- profiling
@@ -28,6 +28,16 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/explore/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/
explore-profiles:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/simplified-exploration/profiles/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/simplified-exploration/profiles/
explore-profile-install:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/explore/simplified-exploration/profiles/access/
- pattern: /docs/grafana-cloud/
destination: /docs/grafana-cloud/visualizations/simplified-exploration/profiles/access/
provisioning-data-sources:
- pattern: /docs/grafana/
destination: /docs/grafana/<GRAFANA_VERSION>/administration/provisioning/#datasources
@@ -37,8 +47,64 @@ refs:
# Query profile data
You can query your profile data using the built-in data source query editor or you can use the open source Grafana Explore Profiles app.
## Explore Profiles
[Explore Profiles](ref:explore-profiles) is a native Grafana application designed to integrate seamlessly with Pyroscope, the open source continuous profiling platform, providing a smooth, queryless experience for browsing and analyzing profiling data.
You can use Explore Profiles in Grafana Cloud or in your own Grafana instance.
For more information, refer to [Access or install Explore Profiles](ref:explore-profiles-install).
### Use cases
There are several different modes for viewing, analyzing, and comparing profiling data.
The main use cases are the following:
- Proactive: Cutting costs, addressing latency issues, or optimizing memory usage for applications
- Reactive: Resolving incidents with line-level accuracy or debugging active latency/memory issues
Explore Profiles provides an intuitive interface to specifically support these use cases.
You get a holistic view of all of your services and how they're functioning, but also the ability to drill down for more targeted root cause analysis.
Explore Profiles offers a convenient platform to analyze profiles and get insights that are impossible to get from using other traditional signals like logs, metrics, or tracing.
{{< youtube id="x9aPw_CbIQc" >}}
{{< docs/play title="the Grafana Play site" url="https://play.grafana.org/a/grafana-pyroscope-app/profiles-explorer" >}}
### Continuous profiling
While code profiling has been a long-standing practice, continuous profiling represents a modern and more advanced approach to performance monitoring.
This technique adds two critical dimensions to traditional profiles:
Time
: Profiling data is collected _continuously_, providing a time-centric view that allows querying performance data from any point in the past.
Metadata
: Profiles are enriched with metadata, adding contextual depth to the performance data.
These dimensions, coupled with the detailed nature of performance profiles, make continuous profiling a uniquely valuable tool.
### Flame graphs
<!-- vale Grafana.We = NO -->
Flame graphs help you visualize resource allocation and performance bottlenecks, and you even get suggested recommendations and performance fixes via AI-driven flame graph analysis, as well as line-level insights from our GitHub integration.
<!-- vale Grafana.We = YES -->
On views with a flame graph, you can use **Explain flame graph** to provide an AI flame graph analysis that explains the performance bottleneck, root cause, and recommended fix.
For more information, refer to [Flame graph AI](https://grafana.com/docs/grafana-cloud/monitor-applications/profiles/flamegraph-ai/).
## Pyroscope query editor
The Pyroscope data source query editor gives you access to a profile type selector, a label selector, and collapsible options.
Like Explore Profiles, the query editor also provides a flame graph to visualize data.
![Query editor](/media/docs/pyroscope/query-editor/query-editor.png 'Query editor')
To access the query editor:
@@ -52,9 +118,9 @@ To access the query editor:
{{< figure src="/media/docs/pyroscope/query-editor/select-profile.png" class="docs-image--no-shadow" max-width="450px" caption="Profile selector" >}}
1. Use the labels selector input to filter by labels. Pyroscope uses similar syntax to Prometheus to filter labels.
Refer to [Pyroscope documentation](https://grafana.com/docs/pyroscope/latest/) for available operators and syntax.
Refer to [Pyroscope documentation](https://grafana.com/docs/pyroscope/<PYROSCOPE_VERSION>/) for available operators and syntax.
While the label selector can be left empty to query all profiles without filtering by labels, the profile type or app must be selected for the query to be valid.
While the label selector can be left empty to query all profiles without filtering by labels, you must select a profile type or app for the query to be valid.
Grafana doesn't show any data if the profile type or app isnt selected when a query runs.

View File

@@ -159,21 +159,7 @@ Trace to logs can also be used with other tracing data sources, such as Jaeger a
![Trace to logs settings](/media/docs/grafana/data-sources/tempo/tempo-data-source-trace-to-logs.png)
There are two ways to configure the trace to logs feature:
- Use a simplified configuration with default query, or
- Configure a custom query where you can use a [template language](ref:variable-syntax) to interpolate variables from the trace or span.
### Use a simple configuration
1. Select the target data source from the drop-down list.
You can also click **Open advanced data source picker** to see more options, including adding a data source.
1. Set start and end time shift. As the logs timestamps may not exactly match the timestamps of the spans in trace it may be necessary to search in larger or shifted time range to find the desired logs.
1. Select which tags to use in the logs query.
The tags you configure must be present in the span's attributes or resources for a trace to logs span link to appear. You can optionally configure a new name for the tag. This is useful, for example, if the tag has dots in the name and the target data source does not allow using dots in labels. In that case, you can for example remap `http.status` (the span attribute) to `http_status` (the data source field). "Data source" in this context can refer to Loki, or another log data source.
1. Optional: If your logs consistently trace or span IDs, you can use one or both of the **Filter by trace ID** and **Filter by span ID** settings.
You can configure a custom query where you can use a [template language](ref:variable-syntax) to interpolate variables from the trace or span.
### Configure a custom query
@@ -328,7 +314,9 @@ You can configure the **Hide search** setting to hide the search query option in
### TraceID query
The **TraceID query** setting modifies how TraceID queries are run. The time range can be used when there are performance issues or timeouts since it will narrow down the search to the defined range. This setting is disabled by default.
The **TraceID query** setting modifies how TraceID queries are run.
The time range can be used when there are performance issues or timeouts since it narrows down the search to the defined range.
This setting is disabled by default.
You can configure this setting as follows:
@@ -424,4 +412,6 @@ datasources:
spanBar:
type: 'Tag'
tag: 'http.path'
streamingEnabled:
search: true
```

View File

@@ -66,7 +66,7 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
- [Other API]({{< relref "other/" >}})
- [Playlists API]({{< relref "playlist/" >}})
- [Preferences API]({{< relref "preferences/" >}})
- [Shared dashboards API]({{< relref "dashboard_public/" >}})
- [Public dashboard API]({{< relref "dashboard_public/" >}})
- [Query history API]({{< relref "query_history/" >}})
- [Service account API]({{< relref "serviceaccount/" >}})
- [Short URL API]({{< relref "short_url/" >}})

View File

@@ -2,7 +2,7 @@
aliases:
- ../../http_api/dashboard_public/
canonical: /docs/grafana/latest/developers/http_api/dashboard_public/
description: Grafana Shared Dashboards HTTP API
description: Grafana Public Dashboard HTTP API
keywords:
- grafana
- http
@@ -13,7 +13,7 @@ labels:
products:
- enterprise
- oss
title: Shared Dashboards HTTP API
title: Public Dashboard HTTP API
refs:
role-based-access-control-permissions:
- pattern: /docs/grafana/
@@ -22,7 +22,7 @@ refs:
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/access-control/custom-role-actions-scopes/
---
# Shared Dashboards API
# Public Dashboard API
{{% admonition type="note" %}}
@@ -30,21 +30,21 @@ If you're running Grafana Enterprise, you'll need to have specific permissions f
{{% /admonition %}}
## Create a shared dashboard
## Create a public dashboard
`POST /api/dashboards/uid/:uid/public-dashboards/`
Creates a new shared dashboard.
Creates a new public dashboard.
**Required permissions**
See note in the [introduction](#shared-dashboards-api) for an explanation.
See note in the [introduction](#public-dashboard-api) for an explanation.
| Action | Scope |
| ------------------------- | -------------------------------- |
| `dashboards.public:write` | `dashboards:uid:<dashboard UID>` |
**Example Request for new shared dashboard**:
**Example Request for new public dashboard**:
```http
POST /api/dashboards/uid/xCpsVuc4z/public-dashboards/ HTTP/1.1
@@ -64,10 +64,10 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
- **share** Optional. Set the share mode. The default value is `public`.
**Example Response**:
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 78
```
@@ -96,7 +96,7 @@ Content-Length: 78
Will update the public dashboard given the specified unique identifier (uid).
**Required permissions**
See note in the [introduction](#public-dashboard-api) for an explanation.
| Action | Scope |
@@ -115,21 +115,21 @@ Content-Length: 107
JSON Body schema:
- **timeSelectionEnabled** Optional. Set to `true` to enable the time picker in the shared dashboard. The default value is `false`.
- **timeSelectionEnabled** Optional. Set to `true` to enable the time picker in the public dashboard. The default value is `false`.
- **isEnabled** Optional. Set to `true` to enable the public dashboard. The default value is `false`.
- **annotationsEnabled** Optional. Set to `true` to show annotations. The default value is `false`.
- **share** Optional. Set the share mode. The default value is `public`.
**Example Response**:
```http
HTTP/1.1 200 OK
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 78
```
Status Codes:
Status Codes:
- **200** Updated
- **400** Errors (such as invalid json, missing or invalid fields)
@@ -147,8 +147,8 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
## Get public dashboard by dashboard uid
`GET /api/dashboards/uid/:uid/public-dashboards/`
`GET /api/dashboards/uid/:uid/public-dashboards/`
Will return the public dashboard given the dashboard unique identifier (uid).
@@ -180,7 +180,7 @@ Status Codes:
Status Codes:
- **200** Found
- **401** Unauthorized
- **401** Unauthorized
- **403** Access denied
- **404** Not found
@@ -196,15 +196,15 @@ Content-Length: 107
| Action | Scope |
| ------------------------- | -------------------------------- |
| `dashboards.public:write` | `dashboards:uid:<dashboard UID>` |
| `dashboards.public:write` | `dashboards:uid:<dashboard UID>` |
**Example Request**:
```http
```http
DELETE /api/dashboards/uid/xCpsVuc4z/public-dashboards/cd56d9fd-f3d4-486d-afba-a21760e2acbe HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
Status Codes:
@@ -245,17 +245,17 @@ Status Codes:
- **200** Found
- **401** Unauthorized
- **403** Access denied
- **404** Dashboard not found
- **404** Not found
## Delete shared dashboard by dashboard uid and shared dashboard uid
## Delete public dashboard by dashboard uid and public dashboard uid
`DELETE /api/dashboards/uid/:uid/public-dashboards/:publicDashboardUid`
Will delete the shared dashboard given the specified unique identifier (uid).
Will delete the public dashboard given the specified unique identifier (uid).
**Required permissions**
See note in the [introduction](#shared-dashboard-api) for an explanation.
See note in the [introduction](#public-dashboard-api) for an explanation.
| Action | Scope |
| ------------------------- | -------------------------------- |
@@ -276,13 +276,13 @@ Status Codes:
- **401** Unauthorized
- **403** Access denied
## Get a list of all shared dashboards with pagination
## Get a list of all public dashboards with pagination
`GET /api/dashboards/public-dashboards`
**Required permissions**
See note in the [introduction](#shared-dashboard-api) for an explanation.
See note in the [introduction](#public-dashboard-api) for an explanation.
| Action | Scope |
| ----------------- | -------------------------------- |

View File

@@ -61,7 +61,7 @@ Grafana Enterprise adds the following features:
- [Data source permissions]({{< relref "../administration/data-source-management#data-source-permissions" >}}) to restrict query access to specific teams and users.
- [Data source query and resource caching]({{< relref "../administration/data-source-management#query-and-resource-caching" >}}) to temporarily store query results in Grafana to reduce data source load and rate limiting.
- [Reporting]({{< relref "../dashboards/create-reports" >}}) to generate a PDF report from any dashboard and set up a schedule to have it emailed to whomever you choose.
- [Export dashboard as PDF]({{< relref "../dashboards/share-dashboards-panels#export-a-dashboard-as-pdf" >}})
- [Export dashboard as PDF]({{< relref "../dashboards/share-dashboards-panels#export-dashboard-as-pdf" >}})
- [Custom branding]({{< relref "../setup-grafana/configure-grafana/configure-custom-branding" >}}) to customize Grafana from the brand and logo to the footer links.
- [Usage insights]({{< relref "../dashboards/assess-dashboard-usage" >}}) to understand how your Grafana instance is used.
- [Recorded queries]({{< relref "../administration/recorded-queries" >}}) to see trends over time for your data sources.

View File

@@ -143,14 +143,26 @@ If there's only one data link in the visualization, clicking anywhere on the vis
You can configure data links for the following visualizations:
| | | |
| ------------------------------ | ------------------------------------ | ------------------------------------ |
| [Bar chart](ref:bar-chart) | [Heatmap](ref:heatmap) | [Status history](ref:status-history) |
| [Bar gauge](ref:bar-gauge) | [Histogram](ref:histogram) | [Table](ref:table) |
| [Candlestick](ref:candlestick) | [Pie chart](ref:pie-chart) | [Time series](ref:time-series) |
| [Canvas](ref:canvas) | [Stat](ref:stat) | [Trend](ref:trend) |
| [Gauge](ref:gauge) | [State timeline](ref:state-timeline) | [XY chart](ref:xy-chart) |
| [Geomap](ref:geomap) | | |
{{< column-list >}}
- [Bar chart](ref:bar-chart)
- [Bar gauge](ref:bar-gauge)
- [Candlestick](ref:candlestick)
- [Canvas](ref:canvas)
- [Gauge](ref:gauge)
- [Geomap](ref:geomap)
- [Heatmap](ref:heatmap)
- [Histogram](ref:histogram)
- [Pie chart](ref:pie-chart)
- [Stat](ref:stat)
- [State timeline](ref:state-timeline)
- [Status history](ref:status-history)
- [Table](ref:table)
- [Time series](ref:time-series)
- [Trend](ref:trend)
- [XY chart](ref:xy-chart)
{{< /column-list >}}
## Data link variables

Some files were not shown because too many files have changed in this diff Show More