mirror of
https://github.com/grafana/grafana.git
synced 2025-12-20 19:44:55 +08:00
Compare commits
286 Commits
docs/add-d
...
v8.1.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34b8880d53 | ||
|
|
ccfa71bc71 | ||
|
|
fc4978fdee | ||
|
|
f2a07cc62e | ||
|
|
6740611758 | ||
|
|
07f2ff99d6 | ||
|
|
dea96e6763 | ||
|
|
3426447fb4 | ||
|
|
833587b4c2 | ||
|
|
3696026205 | ||
|
|
4e6eb817ec | ||
|
|
c857fb0d49 | ||
|
|
6678215a1c | ||
|
|
58ea9c81c8 | ||
|
|
7a0abab141 | ||
|
|
151fd1fecd | ||
|
|
5163782a13 | ||
|
|
d6764b59b0 | ||
|
|
c00888db42 | ||
|
|
61847c32d9 | ||
|
|
0c4d98def4 | ||
|
|
6855cdff7c | ||
|
|
6352cc18ba | ||
|
|
9d4a7b0290 | ||
|
|
58e890dec6 | ||
|
|
71a9bf0203 | ||
|
|
da32c785c6 | ||
|
|
5acc7ea503 | ||
|
|
6e9b0b6ee1 | ||
|
|
abca3c81b0 | ||
|
|
4347b32f0e | ||
|
|
9d4a77127d | ||
|
|
951f26304b | ||
|
|
f427f11bda | ||
|
|
77f610a1f3 | ||
|
|
2cc19d6a7a | ||
|
|
178b2ea0e5 | ||
|
|
5e03bce5d2 | ||
|
|
feb4fbaae9 | ||
|
|
c046d8cec2 | ||
|
|
72d10b8ddb | ||
|
|
5a1c145aee | ||
|
|
4ad607ecc9 | ||
|
|
99392d016f | ||
|
|
a61f38238c | ||
|
|
3c673048d8 | ||
|
|
f39a38a9b5 | ||
|
|
9240425952 | ||
|
|
217f9438c6 | ||
|
|
4f215e06f1 | ||
|
|
ccef062388 | ||
|
|
08eab136b6 | ||
|
|
43696bad09 | ||
|
|
9e6962be65 | ||
|
|
64dc3a946d | ||
|
|
f45404c8ab | ||
|
|
0176693fe9 | ||
|
|
86f86d6fba | ||
|
|
b992d6c228 | ||
|
|
3760a3ab23 | ||
|
|
bb646150f5 | ||
|
|
bf158b2c4a | ||
|
|
b4b0ee91be | ||
|
|
bfcf311f8f | ||
|
|
5f7e249f40 | ||
|
|
742947f6c3 | ||
|
|
af6e673891 | ||
|
|
f5211483ea | ||
|
|
b780f77e74 | ||
|
|
72ead468b2 | ||
|
|
4e2cbb7028 | ||
|
|
a622b4ae58 | ||
|
|
902ea4299c | ||
|
|
eac0c08b13 | ||
|
|
8cfc6571d8 | ||
|
|
786174ce94 | ||
|
|
0a3ccc1701 | ||
|
|
b9a77c6208 | ||
|
|
133c136847 | ||
|
|
592829cbed | ||
|
|
f3592a4e2b | ||
|
|
51d3926cde | ||
|
|
5512b07939 | ||
|
|
c745d2fd43 | ||
|
|
e928c334c2 | ||
|
|
f195dcc37a | ||
|
|
33a7e11344 | ||
|
|
c65399eaad | ||
|
|
bcb405e40c | ||
|
|
6c4f476597 | ||
|
|
44a659d1dc | ||
|
|
ed5f8c1426 | ||
|
|
8d2a6073d1 | ||
|
|
a4b4958279 | ||
|
|
7964cc6789 | ||
|
|
6c29821253 | ||
|
|
70a0dc57ac | ||
|
|
79016c5d39 | ||
|
|
67c46e85a9 | ||
|
|
845e73cecd | ||
|
|
1a711659f5 | ||
|
|
98c540ce8a | ||
|
|
954f55785a | ||
|
|
267c4d376b | ||
|
|
57cdd0239f | ||
|
|
edff57c2ef | ||
|
|
bbcf11723a | ||
|
|
103f8fa094 | ||
|
|
8dd9ecf7cb | ||
|
|
4b91dc7168 | ||
|
|
59067a72b8 | ||
|
|
1f802e1491 | ||
|
|
e4bb887ddd | ||
|
|
a7db2a20dc | ||
|
|
3aa311f869 | ||
|
|
c760ca90db | ||
|
|
73f0217abf | ||
|
|
4fbb9da0d2 | ||
|
|
cf9c019310 | ||
|
|
17219bf052 | ||
|
|
cfeb21b12c | ||
|
|
577d9d52f6 | ||
|
|
ed5966a452 | ||
|
|
81916e8a3f | ||
|
|
c4ffd13612 | ||
|
|
0194e87bf7 | ||
|
|
5ff1eecfeb | ||
|
|
ab43bcf08a | ||
|
|
1fe8b3a7b0 | ||
|
|
3baec71cce | ||
|
|
9271d76f1a | ||
|
|
5e380f40e5 | ||
|
|
5619aa7a5b | ||
|
|
d6a13c45d2 | ||
|
|
c6e35018c6 | ||
|
|
0ed6741259 | ||
|
|
37266efdb2 | ||
|
|
3d1fd54973 | ||
|
|
7b8440ad46 | ||
|
|
95b407e39a | ||
|
|
9bed8070ae | ||
|
|
07e9b15579 | ||
|
|
cea45e4f90 | ||
|
|
75ba1d438e | ||
|
|
485780476b | ||
|
|
0d4e9b540e | ||
|
|
e12111ee6e | ||
|
|
3f7725c891 | ||
|
|
d4497432a0 | ||
|
|
ee64547584 | ||
|
|
638993ccff | ||
|
|
cc1d39872a | ||
|
|
a4154b376f | ||
|
|
a434c52cee | ||
|
|
3415030a1d | ||
|
|
6325bd89b2 | ||
|
|
42a2058b4d | ||
|
|
e56828d9fa | ||
|
|
709c5e8db4 | ||
|
|
9b23169f00 | ||
|
|
1dcecdb89a | ||
|
|
b22b337c87 | ||
|
|
a0f7d34bda | ||
|
|
45e0238642 | ||
|
|
1eb4460cf9 | ||
|
|
b1efd95af1 | ||
|
|
c47396f7b5 | ||
|
|
611b5123ba | ||
|
|
90ec5d992a | ||
|
|
c20101c3e0 | ||
|
|
8d2b7b134b | ||
|
|
3e52d66c79 | ||
|
|
90c87a52f7 | ||
|
|
a6d95e8b6e | ||
|
|
2ee831969d | ||
|
|
302c542aba | ||
|
|
45c67c5b82 | ||
|
|
b3570b823d | ||
|
|
e8a7f71f31 | ||
|
|
98a175f158 | ||
|
|
4916a721f8 | ||
|
|
f16de24c2f | ||
|
|
81114a3972 | ||
|
|
82d548f1de | ||
|
|
62e720c06b | ||
|
|
c65d3ea147 | ||
|
|
3a05320d00 | ||
|
|
49dca774f3 | ||
|
|
889e1ab729 | ||
|
|
30071cee1a | ||
|
|
dd15b33f74 | ||
|
|
3a69f8e915 | ||
|
|
bbee1b26c5 | ||
|
|
de4bf9b9f3 | ||
|
|
f3df336b17 | ||
|
|
6513bbfaf2 | ||
|
|
857bd77fc2 | ||
|
|
a91f08222e | ||
|
|
8ad4703f6d | ||
|
|
5e26c6148d | ||
|
|
48e5f17392 | ||
|
|
db240265ff | ||
|
|
9a89e0c157 | ||
|
|
0e5a6a62be | ||
|
|
4ab256c132 | ||
|
|
dd42424a01 | ||
|
|
2549519180 | ||
|
|
5291563f6c | ||
|
|
6f40b883e1 | ||
|
|
e3a270a041 | ||
|
|
f8b8b4f578 | ||
|
|
7039d3ce27 | ||
|
|
784b924e9f | ||
|
|
b05581cc23 | ||
|
|
b6e20abe61 | ||
|
|
62a64d3233 | ||
|
|
43cced54a0 | ||
|
|
617cf0646d | ||
|
|
7442a7c66e | ||
|
|
dfa1a2cd41 | ||
|
|
ee81dc3b01 | ||
|
|
6cd4182ec9 | ||
|
|
716b254973 | ||
|
|
1d12f22190 | ||
|
|
fc5e1dbd15 | ||
|
|
22a357cc7d | ||
|
|
bd3e140852 | ||
|
|
7a823fe895 | ||
|
|
4eb9c6f06c | ||
|
|
9ccc02f5a3 | ||
|
|
64bd269f1e | ||
|
|
7b3275d4ed | ||
|
|
b312a60627 | ||
|
|
0075a3c014 | ||
|
|
8c70bebf90 | ||
|
|
411e19ed4b | ||
|
|
62d0c516cb | ||
|
|
78b225a5c2 | ||
|
|
a952824e35 | ||
|
|
b0dd5762f8 | ||
|
|
f778fdbbe8 | ||
|
|
d1cd7e7c64 | ||
|
|
0f5446d768 | ||
|
|
33ab22229f | ||
|
|
d74d4d6be9 | ||
|
|
e9bea6053c | ||
|
|
376cbf75b0 | ||
|
|
65d0e4227e | ||
|
|
41315b0935 | ||
|
|
0d29421a87 | ||
|
|
1bad6de8cc | ||
|
|
2fbfe987f0 | ||
|
|
c2d807a1c8 | ||
|
|
3c4754b19f | ||
|
|
c440fd4f5a | ||
|
|
28972eaf4b | ||
|
|
a7017f2729 | ||
|
|
31cc177e31 | ||
|
|
abf351f776 | ||
|
|
1a353a1eea | ||
|
|
2b97f6a507 | ||
|
|
4478259f70 | ||
|
|
38cb26bd5b | ||
|
|
1f0339179f | ||
|
|
f3f8972505 | ||
|
|
0a08cf10e5 | ||
|
|
a8f5445d47 | ||
|
|
631c12ec91 | ||
|
|
d388afece6 | ||
|
|
b0fe99911a | ||
|
|
8392ebdacb | ||
|
|
147704deb9 | ||
|
|
078d716be9 | ||
|
|
04cb471599 | ||
|
|
6564f22772 | ||
|
|
13cd3ea28b | ||
|
|
d5e0665081 | ||
|
|
909141592d | ||
|
|
fda235a862 | ||
|
|
154231a58d | ||
|
|
197e4344da | ||
|
|
64b008e28b | ||
|
|
bc9ac1199b | ||
|
|
2b15e1a962 | ||
|
|
4308a77e27 | ||
|
|
f18749927c |
738
.drone.yml
738
.drone.yml
File diff suppressed because it is too large
Load Diff
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
@@ -3,7 +3,7 @@ name: publish_docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v8.1.x
|
||||
paths:
|
||||
- 'docs/sources/**'
|
||||
- 'packages/grafana-*/**'
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
host: github.com
|
||||
github_pat: '${{ secrets.GH_BOT_ACCESS_TOKEN }}'
|
||||
source_folder: docs/sources
|
||||
target_folder: content/docs/grafana/next
|
||||
target_folder: content/docs/grafana/latest
|
||||
allow_no_changes: 'true'
|
||||
- shell: bash
|
||||
run: |
|
||||
|
||||
@@ -10,3 +10,4 @@ e2e/tmp
|
||||
public/build/
|
||||
public/sass/*.generated.scss
|
||||
devenv/
|
||||
public/lib/monaco
|
||||
|
||||
1796
CHANGELOG.md
1796
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
11
Dockerfile
11
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM node:14.16.0-alpine3.13 as js-builder
|
||||
FROM node:16-alpine3.14 as js-builder
|
||||
|
||||
WORKDIR /usr/src/app/
|
||||
|
||||
@@ -17,25 +17,24 @@ COPY emails emails
|
||||
ENV NODE_ENV production
|
||||
RUN yarn build
|
||||
|
||||
FROM golang:1.16.1-alpine3.13 as go-builder
|
||||
FROM golang:1.16.1-alpine3.14 as go-builder
|
||||
|
||||
RUN apk add --no-cache gcc g++
|
||||
|
||||
WORKDIR $GOPATH/src/github.com/grafana/grafana
|
||||
|
||||
COPY go.mod go.sum embed.go ./
|
||||
|
||||
RUN go mod verify
|
||||
|
||||
COPY cue cue
|
||||
COPY cue.mod cue.mod
|
||||
COPY public/app/plugins public/app/plugins
|
||||
COPY pkg pkg
|
||||
COPY build.go package.json ./
|
||||
|
||||
RUN go mod verify
|
||||
RUN go run build.go build
|
||||
|
||||
# Final stage
|
||||
FROM alpine:3.13
|
||||
FROM alpine:3.14.2
|
||||
|
||||
LABEL maintainer="Grafana team <hello@grafana.com>"
|
||||
|
||||
|
||||
@@ -22,14 +22,13 @@ FROM golang:1.16 AS go-builder
|
||||
WORKDIR /src/grafana
|
||||
|
||||
COPY go.mod go.sum embed.go ./
|
||||
|
||||
RUN go mod verify
|
||||
|
||||
COPY build.go package.json ./
|
||||
COPY pkg pkg/
|
||||
COPY cue cue/
|
||||
COPY cue.mod cue.mod/
|
||||
COPY public/app/plugins public/app/plugins/
|
||||
|
||||
RUN go mod verify
|
||||
RUN go run build.go build
|
||||
|
||||
FROM ubuntu:20.04
|
||||
|
||||
6
Makefile
6
Makefile
@@ -36,7 +36,7 @@ build-server: ## Build Grafana server.
|
||||
$(GO) run build.go build-server
|
||||
|
||||
build-cli: ## Build Grafana CLI application.
|
||||
@echo "build in CI environment"
|
||||
@echo "build grafana-cli"
|
||||
$(GO) run build.go build-cli
|
||||
|
||||
build-js: ## Build frontend assets.
|
||||
@@ -91,7 +91,7 @@ shellcheck: $(SH_FILES) ## Run checks for shell scripts.
|
||||
build-docker-dev: ## Build Docker image for development (fast).
|
||||
@echo "build development container"
|
||||
@echo "\033[92mInfo:\033[0m the frontend code is expected to be built already."
|
||||
$(GO) run build.go -goos linux -pkg-arch amd64 ${OPT} build pkg-archive latest
|
||||
$(GO) run build.go -goos linux -pkg-arch amd64 ${OPT} build latest
|
||||
cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
|
||||
cd packaging/docker && docker build --tag grafana/grafana:dev .
|
||||
|
||||
@@ -141,7 +141,7 @@ clean: ## Clean up intermediate build artifacts.
|
||||
rm -rf public/build
|
||||
|
||||
# This repository's configuration is protected (https://readme.drone.io/signature/).
|
||||
# Use this make target to regenerate the configuration YAML files when
|
||||
# Use this make target to regenerate the configuration YAML files when
|
||||
# you modify starlark files.
|
||||
drone:
|
||||
drone starlark
|
||||
|
||||
@@ -995,12 +995,12 @@
|
||||
[geomap]
|
||||
# Set the JSON configuration for the default basemap
|
||||
;default_baselayer_config = `{
|
||||
"type": "xyz",
|
||||
"config": {
|
||||
"attribution": "Open street map",
|
||||
"url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
}
|
||||
}`
|
||||
; "type": "xyz",
|
||||
; "config": {
|
||||
; "attribution": "Open street map",
|
||||
; "url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
; }
|
||||
;}`
|
||||
|
||||
# Enable or disable loading other base map layers
|
||||
;enable_custom_baselayers = true
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"text": {},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
@@ -87,7 +88,7 @@
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"csvContent": "Name,Stat1,Stat2\nStockholm, 10, 15\nNew York, 19, 5\nLondon, 10, 1\nNegative, 15, -5\nLong value, 15,10",
|
||||
"csvContent": "Time,Name,Stat1,Stat2\n2020-01-01T00:00:00Z,Stockholm, 10, 15\n2020-01-01T00:00:00Z,New York, 19, 5\n2020-01-01T00:00:00Z,London, 10, 1\n2020-01-01T00:00:00Z,Negative, 15, -5\n2020-01-01T00:00:00Z,Long value, 15,10",
|
||||
"refId": "A",
|
||||
"scenarioId": "csv_content"
|
||||
}
|
||||
@@ -154,6 +155,7 @@
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"text": {},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
@@ -226,6 +228,7 @@
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"text": {},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
@@ -298,6 +301,7 @@
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "always",
|
||||
"stacking": "none",
|
||||
"text": {},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
@@ -368,6 +372,7 @@
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"text": {
|
||||
"size": 10,
|
||||
"valueSize": 25
|
||||
@@ -443,6 +448,7 @@
|
||||
},
|
||||
"orientation": "horizontal",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"text": {},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
@@ -516,6 +522,7 @@
|
||||
},
|
||||
"orientation": "horizontal",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"text": {},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -94,7 +94,7 @@ aliases = ["/docs/grafana/v1.1", "/docs/grafana/latest/guides/reference/admin",
|
||||
<img src="/static/img/docs/logos/icon_cloudmonitoring.svg">
|
||||
<h5>Google Cloud Monitoring</h5>
|
||||
</a>
|
||||
<a href="{{< relref "datasources/cloudwatch.md" >}}" class="nav-cards__item nav-cards__item--ds">
|
||||
<a href="{{< relref "datasources/aws-cloudwatch/_index.md" >}}" class="nav-cards__item nav-cards__item--ds">
|
||||
<img src="/static/img/docs/logos/icon_cloudwatch.svg">
|
||||
<h5>AWS CloudWatch</h5>
|
||||
</a>
|
||||
|
||||
@@ -10,18 +10,21 @@ weight = 400
|
||||
Grafana CLI is a small executable that is bundled with Grafana server. It can be executed on the same machine Grafana server is running on. Grafana CLI has `plugins` and `admin` commands, as well as global options.
|
||||
|
||||
To list all commands and options:
|
||||
|
||||
```
|
||||
grafana-cli -h
|
||||
```
|
||||
|
||||
## Invoking Grafana CLI
|
||||
|
||||
To invoke Grafana CLI, add the path to the grafana binaries in your `PATH` environment variable. Alternately, if your current directory is the `bin` directory, use `./grafana-cli`. Otherwise, you can specify full path to the CLI. For example, on Linux `/usr/share/grafana/bin/grafana-cli` and on Windows `C:\Program Files\GrafanaLabs\grafana\bin\grafana-cli.exe`.
|
||||
|
||||
>**Note:** Some commands, such as installing or removing plugins, require `sudo` on Linux. If you are on Windows, run Windows PowerShell as Administrator.
|
||||
> **Note:** Some commands, such as installing or removing plugins, require `sudo` on Linux. If you are on Windows, run Windows PowerShell as Administrator.
|
||||
|
||||
## Grafana CLI command syntax
|
||||
|
||||
The general syntax for commands in Grafana CLI is:
|
||||
|
||||
```bash
|
||||
grafana-cli [global options] command [command options] [arguments...]
|
||||
```
|
||||
@@ -37,6 +40,7 @@ Each global option applies only to the command in which it is used. For example,
|
||||
`--help` or `-h` displays the help, including default paths and Docker configuration information.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli -h
|
||||
```
|
||||
@@ -46,6 +50,7 @@ grafana-cli -h
|
||||
`--version` or `-v` prints the version of Grafana CLI currently running.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli -v
|
||||
```
|
||||
@@ -55,6 +60,7 @@ grafana-cli -v
|
||||
`--pluginsDir value` overrides the path to where your local Grafana instance stores plugins. Use this option if you want to install, update, or remove a plugin somewhere other than the default directory ("/var/lib/grafana/plugins") [$GF_PLUGIN_DIR].
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --pluginsDir "/var/lib/grafana/devplugins" plugins install <plugin-id>
|
||||
```
|
||||
@@ -64,6 +70,7 @@ grafana-cli --pluginsDir "/var/lib/grafana/devplugins" plugins install <plugin-i
|
||||
`--repo value` allows you to download and install or update plugins from a repository other than the default Grafana repo.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --repo "https://example.com/plugins" plugins install <plugin-id>
|
||||
```
|
||||
@@ -73,6 +80,7 @@ grafana-cli --repo "https://example.com/plugins" plugins install <plugin-id>
|
||||
`--pluginUrl value` allows you to download a .zip file containing a plugin from a local URL instead of downloading it from the default Grafana source.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --pluginUrl https://company.com/grafana/plugins/<plugin-id>-<plugin-version>.zip plugins install <plugin-id>
|
||||
```
|
||||
@@ -84,6 +92,7 @@ grafana-cli --pluginUrl https://company.com/grafana/plugins/<plugin-id>-<plugin-
|
||||
`--insecure` allows you to turn off Transport Layer Security (TLS) verification (insecure). You might want to do this if you are downloading a plugin from a non-default source.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --insecure --pluginUrl https://company.com/grafana/plugins/<plugin-id>-<plugin-version>.zip plugins install <plugin-id>
|
||||
```
|
||||
@@ -93,6 +102,7 @@ grafana-cli --insecure --pluginUrl https://company.com/grafana/plugins/<plugin-i
|
||||
`--debug` or `-d` enables debug logging. Debug output is returned and shown in the terminal.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --debug plugins install <plugin-id>
|
||||
```
|
||||
@@ -104,6 +114,7 @@ grafana-cli --debug plugins install <plugin-id>
|
||||
For example, you can use it to redirect logging to another file (maybe to log plugin installations in Grafana Cloud) or when resetting the admin password and you have non-default values for some important configuration value (like where the database is located).
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --configOverrides cfg:default.paths.log=/dev/null plugins install <plugin-id>
|
||||
```
|
||||
@@ -113,6 +124,7 @@ grafana-cli --configOverrides cfg:default.paths.log=/dev/null plugins install <p
|
||||
Sets the path for the Grafana install/home path, defaults to working directory. You do not need to use this if you are in the Grafana installation directory when using the CLI.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --homepath "/usr/share/grafana" admin reset-admin-password <new password>
|
||||
```
|
||||
@@ -122,6 +134,7 @@ grafana-cli --homepath "/usr/share/grafana" admin reset-admin-password <new pass
|
||||
`--config value` overrides the default location where Grafana expects the configuration file. Refer to [Configuration]({{< relref "../administration/configuration.md" >}}) for more information about configuring Grafana and default configuration file locations.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli --config "/etc/configuration/" admin reset-admin-password mynewpassword
|
||||
```
|
||||
@@ -157,6 +170,7 @@ grafana-cli plugins ls
|
||||
```
|
||||
|
||||
### Update all installed plugins
|
||||
|
||||
```bash
|
||||
grafana-cli plugins update-all
|
||||
```
|
||||
@@ -208,6 +222,7 @@ If you need to set the password in a script, then you can use the [Grafana User
|
||||
`encrypt-datasource-passwords` migrates passwords from unsecured fields to secure_json_data field. Returns `ok` unless there is an error. Safe to execute multiple times.
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
grafana-cli admin data-migration encrypt-datasource-passwords
|
||||
```
|
||||
|
||||
@@ -8,19 +8,15 @@ weight = 150
|
||||
|
||||
# Configuration
|
||||
|
||||
Grafana has a number of configuration options that you can specify in a `.ini` configuration file or specified using environment variables.
|
||||
Grafana has default and custom configuration files. You can customize your Grafana instance by modifying the custom configuration file or by using environment variables. To see the list of settings for a Grafana instance, refer to [View server settings]({{< relref "view-server/view-server-settings.md" >}}).
|
||||
|
||||
> **Note:** You must restart Grafana for any configuration changes to take effect.
|
||||
> **Note:** After you add custom options, [uncomment](#remove-comments-in-the-ini-files) the relevant sections of the configuration file. Restart Grafana for your changes to take effect.
|
||||
|
||||
To see all settings currently applied to the Grafana server, refer to [View server settings]({{< relref "view-server/view-server-settings.md" >}}).
|
||||
## Configuration file location
|
||||
|
||||
## Config file locations
|
||||
The default settings for a Grafana instance are stored in the `$WORKING_DIR/conf/defaults.ini` file. _Do not_ change the location in this file.
|
||||
|
||||
_Do not_ change `defaults.ini`! Grafana defaults are stored in this file. Depending on your OS, make all configuration changes in either `custom.ini` or `grafana.ini`.
|
||||
|
||||
- Default configuration from `$WORKING_DIR/conf/defaults.ini`
|
||||
- Custom configuration from `$WORKING_DIR/conf/custom.ini`
|
||||
- The custom configuration file path can be overridden using the `--config` parameter
|
||||
Depending on your OS, your custom configuration file is either the `$WORKING_DIR/conf/defaults.ini` file or the `/usr/local/etc/grafana/grafana.ini` file. The custom configuration file path can be overridden using the `--config` parameter.
|
||||
|
||||
### Linux
|
||||
|
||||
@@ -32,25 +28,23 @@ Refer to [Configure a Grafana Docker image]({{< relref "configure-docker.md" >}}
|
||||
|
||||
### Windows
|
||||
|
||||
`sample.ini` is in the same directory as `defaults.ini` and contains all the settings commented out. Copy `sample.ini` and name it `custom.ini`.
|
||||
On Windows, the `sample.ini` file is located in the same directory as `defaults.ini` file. It contains all the settings commented out. Copy `sample.ini` and name it `custom.ini`.
|
||||
|
||||
### macOS
|
||||
|
||||
By default, the configuration file is located at `/usr/local/etc/grafana/grafana.ini`. For a Grafana instance installed using Homebrew, edit the `grafana.ini` file directly. Otherwise, add a configuration file named `custom.ini` to the `conf` folder to override any of the settings defined in `conf/defaults.ini`.
|
||||
By default, the configuration file is located at `/usr/local/etc/grafana/grafana.ini`. For a Grafana instance installed using Homebrew, edit the `grafana.ini` file directly. Otherwise, add a configuration file named `custom.ini` to the `conf` folder to override the settings defined in `conf/defaults.ini`.
|
||||
|
||||
## Comments in .ini Files
|
||||
## Remove comments in the .ini files
|
||||
|
||||
Semicolons (the `;` char) are the standard way to comment out lines in a `.ini` file. If you want to change a setting, you must delete the semicolon (`;`) in front of the setting before it will work.
|
||||
Grafana uses semicolons (the `;` char) to comment out lines in a `.ini` file. You must uncomment each line in the `custom.ini` or the `grafana.ini` file that you are modify by removing `;` from the beginning of that line. Otherwise your changes will be ignored.
|
||||
|
||||
**Example**
|
||||
For example:
|
||||
|
||||
```
|
||||
# The HTTP port to use
|
||||
;http_port = 3000
|
||||
```
|
||||
|
||||
A common problem is forgetting to uncomment a line in the `custom.ini` (or `grafana.ini`) file which causes the configuration option to be ignored.
|
||||
|
||||
## Configure with environment variables
|
||||
|
||||
All options in the configuration file can be overridden using environment variables using the syntax:
|
||||
@@ -206,7 +200,6 @@ Another way is to put a web server like Nginx or Apache in front of Grafana and
|
||||
|
||||
### domain
|
||||
|
||||
|
||||
### enforce_domain
|
||||
|
||||
Redirect to correct domain if the host header does not match the domain. Prevents DNS rebinding attacks. Default is `false`.
|
||||
@@ -423,6 +416,7 @@ For more details check the [Transport.MaxConnsPerHost](https://golang.org/pkg/ne
|
||||
The maximum number of idle connections that Grafana will maintain. Default is `100`. For more details check the [Transport.MaxIdleConns](https://golang.org/pkg/net/http/#Transport.MaxIdleConns) documentation.
|
||||
|
||||
### max_idle_connections_per_host
|
||||
|
||||
[Deprecated - use max_idle_connections instead]
|
||||
|
||||
The maximum number of idle connections per host that Grafana will maintain. Default is `2`. For more details check the [Transport.MaxIdleConnsPerHost](https://golang.org/pkg/net/http/#Transport.MaxIdleConnsPerHost) documentation.
|
||||
@@ -588,7 +582,7 @@ As of Grafana v7.3, this also limits the refresh interval options in Explore.
|
||||
|
||||
Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json".
|
||||
|
||||
>**Note:** On Linux, Grafana uses `/usr/share/grafana/public/dashboards/home.json` as the default home dashboard location.
|
||||
> **Note:** On Linux, Grafana uses `/usr/share/grafana/public/dashboards/home.json` as the default home dashboard location.
|
||||
|
||||
<hr />
|
||||
|
||||
@@ -828,7 +822,7 @@ Azure cloud environment where Grafana is hosted:
|
||||
|
||||
| Azure Cloud | Value |
|
||||
| ------------------------------------------------ | ---------------------- |
|
||||
| Microsoft Azure public cloud | AzureCloud (*default*) |
|
||||
| Microsoft Azure public cloud | AzureCloud (_default_) |
|
||||
| Microsoft Chinese national cloud | AzureChinaCloud |
|
||||
| US Government cloud | AzureUSGovernment |
|
||||
| Microsoft German national cloud ("Black Forest") | AzureGermanCloud |
|
||||
@@ -1099,6 +1093,16 @@ Sets a global limit on number of alert rules that can be created. Default is -1
|
||||
|
||||
<hr>
|
||||
|
||||
## [unified_alerting]
|
||||
|
||||
For more information about the Grafana 8 alerts, refer to [Unified Alerting]({{< relref "../alerting/unified-alerting/_index.md" >}}).
|
||||
|
||||
### admin_config_poll_interval_seconds
|
||||
|
||||
Specify the frequency of polling for admin config changes. The default value is `60`.
|
||||
|
||||
<hr>
|
||||
|
||||
## [alerting]
|
||||
|
||||
For more information about the Alerting feature in Grafana, refer to [Alerts overview]({{< relref "../alerting/_index.md" >}}).
|
||||
@@ -1416,7 +1420,7 @@ Optional extra path inside bucket.
|
||||
|
||||
### enable_signed_urls
|
||||
|
||||
If set to true, Grafana creates a [signed URL](https://cloud.google.com/storage/docs/access-control/signed-urls] for
|
||||
If set to true, Grafana creates a [signed URL](https://cloud.google.com/storage/docs/access-control/signed-urls) for
|
||||
the image uploaded to Google Cloud Storage.
|
||||
|
||||
### signed_url_expiration
|
||||
@@ -1520,7 +1524,7 @@ The `allowed_origins` option is a comma-separated list of additional origins (`O
|
||||
|
||||
If not set (default), then the origin is matched over [root_url]({{< relref "#root_url" >}}) which should be sufficient for most scenarios.
|
||||
|
||||
Origin patterns support wildcard symbol "*".
|
||||
Origin patterns support wildcard symbol "\*".
|
||||
|
||||
For example:
|
||||
|
||||
@@ -1529,11 +1533,35 @@ For example:
|
||||
allowed_origins = "https://*.example.com"
|
||||
```
|
||||
|
||||
### ha_engine
|
||||
|
||||
> **Note**: Available in Grafana v8.1 and later versions.
|
||||
|
||||
**Experimental**
|
||||
|
||||
The high availability (HA) engine name for Grafana Live. By default, it's not set. The only possible value is "redis".
|
||||
|
||||
For more information, refer to [Configure Grafana Live HA setup]({{< relref "../live/live-ha-setup.md" >}}).
|
||||
|
||||
### ha_engine_address
|
||||
|
||||
> **Note**: Available in Grafana v8.1 and later versions.
|
||||
|
||||
**Experimental**
|
||||
|
||||
Address string of selected the high availability (HA) Live engine. For Redis, it's a `host:port` string. Example:
|
||||
|
||||
```ini
|
||||
[live]
|
||||
ha_engine = redis
|
||||
ha_engine_address = 127.0.0.1:6379
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
## [plugin.grafana-image-renderer]
|
||||
|
||||
For more information, refer to [Image rendering]({{< relref "image_rendering.md" >}}).
|
||||
For more information, refer to [Image rendering]({{< relref "../image-rendering/" >}}).
|
||||
|
||||
### rendering_timezone
|
||||
|
||||
@@ -1569,7 +1597,7 @@ It can be useful to set this to `true` when troubleshooting.
|
||||
|
||||
### rendering_args
|
||||
|
||||
Additional arguments to pass to the headless browser instance. Default is --no-sandbox. The list of Chromium flags can be found at (https://peter.sh/experiments/chromium-command-line-switches/). Separate multiple arguments with commas.
|
||||
Additional arguments to pass to the headless browser instance. Defaults are `--no-sandbox,--disable-gpu`. The list of Chromium flags can be found at (https://peter.sh/experiments/chromium-command-line-switches/). Separate multiple arguments with commas.
|
||||
|
||||
### rendering_chrome_bin
|
||||
|
||||
@@ -1694,4 +1722,4 @@ default_baselayer_config = `{
|
||||
|
||||
### enable_custom_baselayers
|
||||
|
||||
Set this to `true` to disable loading other custom base maps and hide them in the Grafana UI. Default is `false`.
|
||||
Set this to `true` to disable loading other custom base maps and hide them in the Grafana UI. Default is `false`.
|
||||
|
||||
@@ -40,14 +40,14 @@ docker run -d --user $ID --volume "$PWD/data:/var/lib/grafana" -p 3000:3000 graf
|
||||
|
||||
The following settings are hard-coded when launching the Grafana Docker container and can only be overridden using environment variables, not in `conf/grafana.ini`.
|
||||
|
||||
Setting | Default value
|
||||
----------------------|---------------------------
|
||||
GF_PATHS_CONFIG | /etc/grafana/grafana.ini
|
||||
GF_PATHS_DATA | /var/lib/grafana
|
||||
GF_PATHS_HOME | /usr/share/grafana
|
||||
GF_PATHS_LOGS | /var/log/grafana
|
||||
GF_PATHS_PLUGINS | /var/lib/grafana/plugins
|
||||
GF_PATHS_PROVISIONING | /etc/grafana/provisioning
|
||||
| Setting | Default value |
|
||||
| --------------------- | ------------------------- |
|
||||
| GF_PATHS_CONFIG | /etc/grafana/grafana.ini |
|
||||
| GF_PATHS_DATA | /var/lib/grafana |
|
||||
| GF_PATHS_HOME | /usr/share/grafana |
|
||||
| GF_PATHS_LOGS | /var/log/grafana |
|
||||
| GF_PATHS_PLUGINS | /var/lib/grafana/plugins |
|
||||
| GF_PATHS_PROVISIONING | /etc/grafana/provisioning |
|
||||
|
||||
## Logging
|
||||
|
||||
@@ -92,5 +92,5 @@ You may also specify multiple profiles to `GF_AWS_PROFILES` (e.g.
|
||||
Supported variables:
|
||||
|
||||
- `GF_AWS_${profile}_ACCESS_KEY_ID`: AWS access key ID (required).
|
||||
- `GF_AWS_${profile}_SECRET_ACCESS_KEY`: AWS secret access key (required).
|
||||
- `GF_AWS_${profile}_SECRET_ACCESS_KEY`: AWS secret access key (required).
|
||||
- `GF_AWS_${profile}_REGION`: AWS region (optional).
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
+++
|
||||
title = "Image rendering"
|
||||
description = ""
|
||||
keywords = ["grafana", "image", "rendering", "plugin"]
|
||||
weight = 300
|
||||
+++
|
||||
|
||||
# Image rendering
|
||||
|
||||
Grafana supports automatic rendering of panels as PNG images. This allows Grafana to automatically generate images of your panels to include in [alert notifications]({{< relref "../alerting/old-alerting/notifications.md" >}}).
|
||||
|
||||
>**Note:** Image rendering of dashboards is not supported at this time.
|
||||
|
||||
While an image is being rendered, the PNG image is temporarily written to the file system. When the image is rendered, the PNG image is temporarily written to the `png` folder in the Grafana `data` folder.
|
||||
|
||||
A background job runs every 10 minutes and removes temporary images. You can configure how long an image should be stored before being removed by configuring the [temp-data-lifetime]({{< relref "../administration/configuration/#temp-data-lifetime" >}}) setting.
|
||||
|
||||
You can also render a PNG by clicking the dropdown arrow next to a panel title, then clicking **Share > Direct link rendered image**.
|
||||
|
||||
## Memory requirements
|
||||
|
||||
Minimum free memory recommendation is 16GB on the system doing the rendering.
|
||||
|
||||
Rendering images can require a lot of memory, mainly because Grafana creates browser instances in the background for the actual rendering. If multiple images are rendered in parallel, then the rendering has a bigger memory footprint. One advantage of using the remote rendering service is that the rendering will be done on the remote system, so your local system resources will not be affected by rendering.
|
||||
|
||||
## Alerting and render limits
|
||||
|
||||
Alert notifications can include images, but rendering many images at the same time can overload the server where the renderer is running. For instructions of how to configure this, see [concurrent_render_limit]({{< relref "../administration/configuration/#concurrent_render_limit" >}}).
|
||||
|
||||
## Install Grafana Image Renderer plugin
|
||||
|
||||
The [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) is a plugin that runs on the backend and handles rendering panels and dashboards as PNG images using headless Chrome.
|
||||
|
||||
To install the plugin, refer to the [Grafana Image Renderer Installation instructions](https://grafana.com/grafana/plugins/grafana-image-renderer/?tab=installation).
|
||||
|
||||
## Run in custom Grafana Docker image
|
||||
|
||||
We recommend setting up another Docker container for rendering and using remote rendering. Refer to [Remote rendering service]({{< relref "#remote-rendering-service" >}}) for instructions.
|
||||
|
||||
If you still want to install the plugin in the Grafana Docker image, refer to [Build with Grafana Image Renderer plugin pre-installed]({{< relref "../installation/docker/#build-with-grafana-image-renderer-plugin-pre-installed" >}}).
|
||||
|
||||
## Remote rendering service
|
||||
|
||||
> Requires an internet connection.
|
||||
|
||||
The [Grafana Image Renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) can also be run as a remote HTTP rendering service. In this setup, Grafana renders an image by making a HTTP request to the remote rendering service, which in turn renders the image and returns it back in the HTTP response to Grafana.
|
||||
|
||||
You can run the remote HTTP rendering service using Docker or as a standalone Node.js application.
|
||||
|
||||
### Run in Docker
|
||||
|
||||
The following example shows how to run Grafana and the remote HTTP rendering service in two separate Docker containers using Docker Compose.
|
||||
|
||||
Create a `docker-compose.yml` with the following content:
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana:main
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
GF_RENDERING_SERVER_URL: http://renderer:8081/render
|
||||
GF_RENDERING_CALLBACK_URL: http://grafana:3000/
|
||||
GF_LOG_FILTERS: rendering:debug
|
||||
renderer:
|
||||
image: grafana/grafana-image-renderer:latest
|
||||
ports:
|
||||
- 8081
|
||||
```
|
||||
|
||||
And then run:
|
||||
|
||||
```bash
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
## Run as standalone Node.js application
|
||||
|
||||
The following example describes how to build and run the remote HTTP rendering service as a standalone Node.js application and configure Grafana appropriately.
|
||||
|
||||
1. Clone the [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) Git repository.
|
||||
1. Install dependencies and build:
|
||||
|
||||
```bash
|
||||
yarn install --pure-lockfile
|
||||
yarn run build
|
||||
```
|
||||
|
||||
1. Run the server:
|
||||
|
||||
```bash
|
||||
node build/app.js server --port=8081
|
||||
```
|
||||
|
||||
1. Update Grafana configuration:
|
||||
|
||||
```
|
||||
[rendering]
|
||||
server_url = http://localhost:8081/render
|
||||
callback_url = http://localhost:3000/
|
||||
```
|
||||
|
||||
1. Restart Grafana.
|
||||
|
||||
## PhantomJS
|
||||
|
||||
> Starting from Grafana v7.0.0, all PhantomJS support has been removed. Please use the Grafana Image Renderer plugin or remote rendering service.
|
||||
|
||||
## Troubleshoot image rendering
|
||||
|
||||
Enable debug log messages for rendering in the Grafana configuration file and inspect the Grafana server log.
|
||||
|
||||
```bash
|
||||
[log]
|
||||
filters = rendering:debug
|
||||
```
|
||||
|
||||
### Grafana image renderer plugin and remote rendering service
|
||||
|
||||
The plugin and rendering service uses [Chromium browser](https://www.chromium.org/) which depends on certain libraries.
|
||||
If you don't have all of those libraries installed in your system you may encounter errors when trying to render an image, e.g.
|
||||
|
||||
```bash
|
||||
Rendering failed: Error: Failed to launch chrome!/var/lib/grafana/plugins/grafana-image-renderer/chrome-linux/chrome:
|
||||
error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
|
||||
```
|
||||
|
||||
In general you can use the [`ldd`](https://en.wikipedia.org/wiki/Ldd_(Unix)) utility to figure out what shared libraries
|
||||
are not installed in your system:
|
||||
|
||||
```bash
|
||||
cd <grafana-image-render plugin directory>
|
||||
ldd chrome-linux/chrome
|
||||
linux-vdso.so.1 (0x00007fff1bf65000)
|
||||
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2047945000)
|
||||
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2047924000)
|
||||
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f204791a000)
|
||||
libX11.so.6 => not found
|
||||
libX11-xcb.so.1 => not found
|
||||
libxcb.so.1 => not found
|
||||
libXcomposite.so.1 => not found
|
||||
...
|
||||
```
|
||||
|
||||
**Ubuntu:**
|
||||
|
||||
On Ubuntu 18.10 the following dependencies have been confirmed as needed for the image rendering to function.
|
||||
|
||||
```bash
|
||||
libx11-6 libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrender1 libxtst6 libglib2.0-0 libnss3 libcups2 libdbus-1-3 libxss1 libxrandr2 libgtk-3-0 libgtk-3-0 libasound2 libxcb-dri3-0 libgbm1
|
||||
```
|
||||
|
||||
**Debian:**
|
||||
|
||||
On Debian 9 (Stretch) the following dependencies have been confirmed as needed for the image rendering to function.
|
||||
|
||||
```bash
|
||||
libx11 libcairo bcairo2 libcairo2 libxtst6 libxcomposite1 libx11-xcb1 libxcursor1 libxdamage1 libnss3 libcups libcups2 libXss libXss1 libxss1 libxrandr2 libasound2 libatk1.0-0 libatk-bridge2.0-0 libpangocairo-1.0-0 libgtk-3-0 libgbm1
|
||||
```
|
||||
|
||||
On Debian 10 (Buster) the following dependencies have been confirmed as needed for the image rendering to function.
|
||||
|
||||
```bash
|
||||
libxdamage1 libxext6 libxi6 libxtst6 libnss3 libnss3 libcups2 libxss1 libxrandr2 libasound2 libatk1.0-0 libatk-bridge2.0-0 libpangocairo-1.0-0 libpango-1.0-0 libcairo2 libatspi2.0-0 libgtk3.0-cil libgdk3.0-cil libx11-xcb-dev libgbm1
|
||||
```
|
||||
|
||||
**Centos:**
|
||||
|
||||
On a minimal Centos installation, the following dependencies have been confirmed as needed for the image rendering to function:
|
||||
|
||||
```bash
|
||||
libXcomposite libXdamage libXtst cups libXScrnSaver pango atk adwaita-cursor-theme adwaita-icon-theme at at-spi2-atk at-spi2-core cairo-gobject colord-libs dconf desktop-file-utils ed emacs-filesystem gdk-pixbuf2 glib-networking gnutls gsettings-desktop-schemas gtk-update-icon-cache gtk3 hicolor-icon-theme jasper-libs json-glib libappindicator-gtk3 libdbusmenu libdbusmenu-gtk3 libepoxy liberation-fonts liberation-narrow-fonts liberation-sans-fonts liberation-serif-fonts libgusb libindicator-gtk3 libmodman libproxy libsoup libwayland-cursor libwayland-egl libxkbcommon m4 mailx nettle patch psmisc redhat-lsb-core redhat-lsb-submod-security rest spax time trousers xdg-utils xkeyboard-config alsa-lib
|
||||
```
|
||||
|
||||
### Certificate signed by internal certificate authorities
|
||||
|
||||
In many cases, Grafana runs on internal servers and uses certificates that have not been signed by a CA ([Certificate Authority](https://en.wikipedia.org/wiki/Certificate_authority)) known to Chrome, and therefore cannot be validated. Chrome internally uses NSS ([Network Security Services](https://en.wikipedia.org/wiki/Network_Security_Services)) for cryptographic operations such as the validation of certificates.
|
||||
|
||||
If you are using the Grafana Image Renderer with a Grafana server that uses a certificate signed by such a custom CA (for example a company-internal CA), rendering images will fail and you will see messages like this in the Grafana log:
|
||||
|
||||
```
|
||||
t=2019-12-04T12:39:22+0000 lvl=error msg="Render request failed" logger=rendering error=map[] url="https://192.168.106.101:3443/d-solo/zxDJxNaZk/graphite-metrics?orgId=1&refresh=1m&from=1575438321300&to=1575459921300&var-Host=master1&panelId=4&width=1000&height=500&tz=Europe%2FBerlin&render=1" timestamp=0001-01-01T00:00:00.000Z
|
||||
t=2019-12-04T12:39:22+0000 lvl=error msg="Rendering failed." logger=context userId=1 orgId=1 uname=admin error="Rendering failed: Error: net::ERR_CERT_AUTHORITY_INVALID at https://192.168.106.101:3443/d-solo/zxDJxNaZk/graphite-metrics?orgId=1&refresh=1m&from=1575438321300&to=1575459921300&var-Host=master1&panelId=4&width=1000&height=500&tz=Europe%2FBerlin&render=1"
|
||||
t=2019-12-04T12:39:22+0000 lvl=error msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/render/d-solo/zxDJxNaZk/graphite-metrics status=500 remote_addr=192.168.106.101 time_ms=310 size=1722 referer="https://grafana.xxx-xxx/d/zxDJxNaZk/graphite-metrics?orgId=1&refresh=1m"
|
||||
```
|
||||
|
||||
(The severity-level `error` in the above messages might be misspelled with a single `r`)
|
||||
|
||||
If this happens, then you have to add the certificate to the trust store. If you have the certificate file for the internal root CA in the file `internal-root-ca.crt.pem`, then use these commands to create a user specific NSS trust store for the Grafana user (`grafana` for the purpose of this example) and execute the following steps:
|
||||
|
||||
```[root@server ~]# [ -d /usr/share/grafana/.pki/nssdb ] || mkdir -p /usr/share/grafana/.pki/nssdb
|
||||
[root@merver ~]# certutil -d sql:/usr/share/grafana/.pki/nssdb -A -n internal-root-ca -t C -i /etc/pki/tls/certs/internal-root-ca.crt.pem
|
||||
[root@server ~]# chown -R grafana: /usr/share/grafana/.pki/nssdb
|
||||
```
|
||||
|
||||
### Custom Chrome/Chromium
|
||||
|
||||
As a last resort, if you already have [Chrome](https://www.google.com/chrome/) or [Chromium](https://www.chromium.org/)
|
||||
installed on your system, then you can configure [Grafana Image renderer plugin](#grafana-image-renderer-plugin) to use this
|
||||
instead of the pre-packaged version of Chromium.
|
||||
|
||||
> Please note that this is not recommended, since you may encounter problems if the installed version of Chrome/Chromium is not
|
||||
> compatible with the [Grafana Image renderer plugin](#grafana-image-renderer-plugin).
|
||||
|
||||
To override the path to the Chrome/Chromium executable, set an environment variable and make sure that it's available for the Grafana process. For example:
|
||||
|
||||
```bash
|
||||
export GF_PLUGIN_RENDERING_CHROME_BIN="/usr/bin/chromium-browser"
|
||||
```
|
||||
@@ -11,6 +11,6 @@ Grafana supports [Jaeger tracing](https://www.jaegertracing.io/).
|
||||
|
||||
Grafana can emit Jaeger traces for its HTTP API endpoints and propagate Jaeger trace information to data sources.
|
||||
All HTTP endpoints are logged evenly (annotations, dashboard, tags, and so on).
|
||||
When a trace ID is propagated, it is reported with operation 'HTTP /datasources/proxy/:id/*'.
|
||||
When a trace ID is propagated, it is reported with operation 'HTTP /datasources/proxy/:id/\*'.
|
||||
|
||||
Refer to [Configuration]({{< relref "configuration.md#tracing-jaeger" >}}) for information about enabling Jaeger tracing.
|
||||
|
||||
@@ -20,10 +20,11 @@ Follow these instructions if you are a Grafana Server Admin.
|
||||
|
||||
{{< docs/list >}}
|
||||
{{< docs/shared "manage-users/view-server-org-list.md" >}}
|
||||
|
||||
1. In the organization list, click the name of the organization that you want to change.
|
||||
1. In **Name**, enter the new organization name.
|
||||
1. Click **Update**.
|
||||
{{< /docs/list >}}
|
||||
{{< /docs/list >}}
|
||||
|
||||
### Organization Admin change organization name
|
||||
|
||||
@@ -31,14 +32,16 @@ If you are an Organization Admin, follow these steps:
|
||||
|
||||
{{< docs/list >}}
|
||||
{{< docs/shared "preferences/org-preferences-list.md" >}}
|
||||
|
||||
1. In **Organization name**, enter the new name.
|
||||
1. Click **Update organization name**.
|
||||
{{< /docs/list >}}
|
||||
{{< /docs/list >}}
|
||||
|
||||
## Change team name or email
|
||||
|
||||
Organization administrators and team administrators can change team names and email addresses.
|
||||
To change the team name or email, follow these steps:
|
||||
|
||||
1. Hover your cursor over the **Configuration** (gear) icon in the side menu.
|
||||
1. Click **Teams**. Grafana displays the team list.
|
||||
1. In the team list, click the name of the team that you want to change.
|
||||
|
||||
@@ -52,9 +52,10 @@ Organization and team administrators can change the UI theme for all users in a
|
||||
|
||||
{{< docs/list >}}
|
||||
{{< docs/shared "manage-users/view-team-list.md" >}}
|
||||
|
||||
1. Click on the team that you want to change the UI theme for and then navigate to the **Settings** tab.
|
||||
{{< docs/shared "preferences/select-ui-theme-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
{{< docs/shared "preferences/select-ui-theme-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
|
||||
## Change your personal UI theme
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@ Organization administrators and team administrators can choose a default timezon
|
||||
|
||||
{{< docs/list >}}
|
||||
{{< docs/shared "manage-users/view-team-list.md" >}}
|
||||
|
||||
1. Click on the team you that you want to change the timezone for and then navigate to the **Settings** tab.
|
||||
{{< docs/shared "preferences/select-timezone-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
{{< docs/shared "preferences/select-timezone-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
|
||||
## Set your personal timezone
|
||||
|
||||
@@ -41,4 +42,4 @@ You can change the timezone for your user account. This setting overrides timezo
|
||||
{{< docs/list >}}
|
||||
{{< docs/shared "preferences/navigate-user-preferences-list.md" >}}
|
||||
{{< docs/shared "preferences/select-timezone-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
{{< /docs/list >}}
|
||||
|
||||
@@ -40,7 +40,7 @@ Users with the Grafana Server Admin flag on their account or access to the confi
|
||||
default_home_dashboard_path = data/main-dashboard.json
|
||||
```
|
||||
|
||||
>**Note:** On Linux, Grafana uses `/usr/share/grafana/public/dashboards/home.json` as the default home dashboard location.
|
||||
> **Note:** On Linux, Grafana uses `/usr/share/grafana/public/dashboards/home.json` as the default home dashboard location.
|
||||
|
||||
## Set the home dashboard for your organization
|
||||
|
||||
@@ -59,9 +59,10 @@ Organization administrators and Team Admins can choose a home dashboard for a te
|
||||
{{< docs/list >}}
|
||||
{{< docs/shared "preferences/navigate-to-the-dashboard-list.md" >}}
|
||||
{{< docs/shared "manage-users/view-team-list.md" >}}
|
||||
|
||||
1. Click on the team that you want to change the home dashboard for and then navigate to the **Settings** tab.
|
||||
{{< docs/shared "preferences/select-home-dashboard-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
{{< docs/shared "preferences/select-home-dashboard-list.md" >}}
|
||||
{{< /docs/list >}}
|
||||
|
||||
## Set your personal home dashboard
|
||||
|
||||
|
||||
@@ -141,49 +141,50 @@ Please refer to each datasource documentation for specific provisioning examples
|
||||
|
||||
Since not all datasources have the same configuration settings we only have the most common ones as fields. The rest should be stored as a json blob in the `jsonData` field. Here are the most common settings that the core datasources use.
|
||||
|
||||
| Name | Type | Datasource | Description |
|
||||
| ----------------------- | ------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| tlsAuth | boolean | _All_ | Enable TLS authentication using client cert configured in secure json data |
|
||||
| tlsAuthWithCACert | boolean | _All_ | Enable TLS authentication using CA cert |
|
||||
| tlsSkipVerify | boolean | _All_ | Controls whether a client verifies the server's certificate chain and host name. |
|
||||
| Name | Type | Datasource | Description |
|
||||
| ----------------------- | ------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| tlsAuth | boolean | _All_ | Enable TLS authentication using client cert configured in secure json data |
|
||||
| tlsAuthWithCACert | boolean | _All_ | Enable TLS authentication using CA cert |
|
||||
| tlsSkipVerify | boolean | _All_ | Controls whether a client verifies the server's certificate chain and host name. |
|
||||
| serverName | string | _All_ | Optional. Controls the server name used for certificate common name/subject alternative name verification. Defaults to using the data source URL. |
|
||||
| timeout | string | _All_ | Request timeout in seconds. Overrides dataproxy.timeout option |
|
||||
| graphiteVersion | string | Graphite | Graphite version |
|
||||
| timeInterval | string | Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL | Lowest interval/step value that should be used for this data source. |
|
||||
| httpMode | string | Influxdb | HTTP Method. 'GET', 'POST', defaults to GET |
|
||||
| maxSeries | number | Influxdb | Max number of series/tables that Grafana processes |
|
||||
| httpMethod | string | Prometheus | HTTP Method. 'GET', 'POST', defaults to POST |
|
||||
| customQueryParameters | string | Prometheus | Query parameters to add, as a URL-encoded string. |
|
||||
| esVersion | string | Elasticsearch | Elasticsearch version (E.g. `7.0.0`, `7.6.1`) |
|
||||
| timeField | string | Elasticsearch | Which field that should be used as timestamp |
|
||||
| interval | string | Elasticsearch | Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly' |
|
||||
| logMessageField | string | Elasticsearch | Which field should be used as the log message |
|
||||
| logLevelField | string | Elasticsearch | Which field should be used to indicate the priority of the log message |
|
||||
| sigV4Auth | boolean | Elasticsearch and Prometheus | Enable usage of SigV4 |
|
||||
| sigV4AuthType | string | Elasticsearch and Prometheus | SigV4 auth provider. default/credentials/keys |
|
||||
| sigV4ExternalId | string | Elasticsearch and Prometheus | Optional SigV4 External ID |
|
||||
| sigV4AssumeRoleArn | string | Elasticsearch and Prometheus | Optional SigV4 ARN role to assume |
|
||||
| sigV4Region | string | Elasticsearch and Prometheus | SigV4 AWS region |
|
||||
| sigV4Profile | string | Elasticsearch and Prometheus | Optional SigV4 credentials profile |
|
||||
| authType | string | Cloudwatch | Auth provider. default/credentials/keys |
|
||||
| externalId | string | Cloudwatch | Optional External ID |
|
||||
| assumeRoleArn | string | Cloudwatch | Optional ARN role to assume |
|
||||
| defaultRegion | string | Cloudwatch | Optional default AWS region |
|
||||
| customMetricsNamespaces | string | Cloudwatch | Namespaces of Custom Metrics |
|
||||
| profile | string | Cloudwatch | Optional credentials profile |
|
||||
| tsdbVersion | string | OpenTSDB | Version |
|
||||
| tsdbResolution | string | OpenTSDB | Resolution |
|
||||
| sslmode | string | PostgreSQL | SSLmode. 'disable', 'require', 'verify-ca' or 'verify-full' |
|
||||
| tlsConfigurationMethod | string | PostgreSQL | SSL Certificate configuration, either by 'file-path' or 'file-content' |
|
||||
| sslRootCertFile | string | PostgreSQL | SSL server root certificate file, must be readable by the Grafana user |
|
||||
| sslCertFile | string | PostgreSQL | SSL client certificate file, must be readable by the Grafana user |
|
||||
| sslKeyFile | string | PostgreSQL | SSL client key file, must be readable by _only_ the Grafana user |
|
||||
| encrypt | string | MSSQL | Connection SSL encryption handling. 'disable', 'false' or 'true' |
|
||||
| postgresVersion | number | PostgreSQL | Postgres version as a number (903/904/905/906/1000) meaning v9.3, v9.4, ..., v10 |
|
||||
| timescaledb | boolean | PostgreSQL | Enable usage of TimescaleDB extension |
|
||||
| maxOpenConns | number | MySQL, PostgreSQL and MSSQL | Maximum number of open connections to the database (Grafana v5.4+) |
|
||||
| maxIdleConns | number | MySQL, PostgreSQL and MSSQL | Maximum number of connections in the idle connection pool (Grafana v5.4+) |
|
||||
| connMaxLifetime | number | MySQL, PostgreSQL and MSSQL | Maximum amount of time in seconds a connection may be reused (Grafana v5.4+) |
|
||||
| timeout | string | _All_ | Request timeout in seconds. Overrides dataproxy.timeout option |
|
||||
| graphiteVersion | string | Graphite | Graphite version |
|
||||
| timeInterval | string | Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL | Lowest interval/step value that should be used for this data source. |
|
||||
| httpMode | string | Influxdb | HTTP Method. 'GET', 'POST', defaults to GET |
|
||||
| maxSeries | number | Influxdb | Max number of series/tables that Grafana processes |
|
||||
| httpMethod | string | Prometheus | HTTP Method. 'GET', 'POST', defaults to POST |
|
||||
| customQueryParameters | string | Prometheus | Query parameters to add, as a URL-encoded string. |
|
||||
| manageAlerts | boolean | Prometheus and Loki | Manage alerts via Alerting UI |
|
||||
| esVersion | string | Elasticsearch | Elasticsearch version (E.g. `7.0.0`, `7.6.1`) |
|
||||
| timeField | string | Elasticsearch | Which field that should be used as timestamp |
|
||||
| interval | string | Elasticsearch | Index date time format. nil(No Pattern), 'Hourly', 'Daily', 'Weekly', 'Monthly' or 'Yearly' |
|
||||
| logMessageField | string | Elasticsearch | Which field should be used as the log message |
|
||||
| logLevelField | string | Elasticsearch | Which field should be used to indicate the priority of the log message |
|
||||
| sigV4Auth | boolean | Elasticsearch and Prometheus | Enable usage of SigV4 |
|
||||
| sigV4AuthType | string | Elasticsearch and Prometheus | SigV4 auth provider. default/credentials/keys |
|
||||
| sigV4ExternalId | string | Elasticsearch and Prometheus | Optional SigV4 External ID |
|
||||
| sigV4AssumeRoleArn | string | Elasticsearch and Prometheus | Optional SigV4 ARN role to assume |
|
||||
| sigV4Region | string | Elasticsearch and Prometheus | SigV4 AWS region |
|
||||
| sigV4Profile | string | Elasticsearch and Prometheus | Optional SigV4 credentials profile |
|
||||
| authType | string | Cloudwatch | Auth provider. default/credentials/keys |
|
||||
| externalId | string | Cloudwatch | Optional External ID |
|
||||
| assumeRoleArn | string | Cloudwatch | Optional ARN role to assume |
|
||||
| defaultRegion | string | Cloudwatch | Optional default AWS region |
|
||||
| customMetricsNamespaces | string | Cloudwatch | Namespaces of Custom Metrics |
|
||||
| profile | string | Cloudwatch | Optional credentials profile |
|
||||
| tsdbVersion | string | OpenTSDB | Version |
|
||||
| tsdbResolution | string | OpenTSDB | Resolution |
|
||||
| sslmode | string | PostgreSQL | SSLmode. 'disable', 'require', 'verify-ca' or 'verify-full' |
|
||||
| tlsConfigurationMethod | string | PostgreSQL | SSL Certificate configuration, either by 'file-path' or 'file-content' |
|
||||
| sslRootCertFile | string | PostgreSQL | SSL server root certificate file, must be readable by the Grafana user |
|
||||
| sslCertFile | string | PostgreSQL | SSL client certificate file, must be readable by the Grafana user |
|
||||
| sslKeyFile | string | PostgreSQL | SSL client key file, must be readable by _only_ the Grafana user |
|
||||
| encrypt | string | MSSQL | Connection SSL encryption handling. 'disable', 'false' or 'true' |
|
||||
| postgresVersion | number | PostgreSQL | Postgres version as a number (903/904/905/906/1000) meaning v9.3, v9.4, ..., v10 |
|
||||
| timescaledb | boolean | PostgreSQL | Enable usage of TimescaleDB extension |
|
||||
| maxOpenConns | number | MySQL, PostgreSQL and MSSQL | Maximum number of open connections to the database (Grafana v5.4+) |
|
||||
| maxIdleConns | number | MySQL, PostgreSQL and MSSQL | Maximum number of connections in the idle connection pool (Grafana v5.4+) |
|
||||
| connMaxLifetime | number | MySQL, PostgreSQL and MSSQL | Maximum amount of time in seconds a connection may be reused (Grafana v5.4+) |
|
||||
|
||||
#### Secure Json Data
|
||||
|
||||
@@ -191,15 +192,15 @@ Since not all datasources have the same configuration settings we only have the
|
||||
|
||||
Secure json data is a map of settings that will be encrypted with [secret key]({{< relref "configuration.md#secret-key" >}}) from the Grafana config. The purpose of this is only to hide content from the users of the application. This should be used for storing TLS Cert and password that Grafana will append to the request on the server side. All of these settings are optional.
|
||||
|
||||
| Name | Type | Datasource | Description |
|
||||
| ----------------- | ------ | ---------- | --------------------------------------- |
|
||||
| tlsCACert | string | _All_ | CA cert for out going requests |
|
||||
| tlsClientCert | string | _All_ | TLS Client cert for outgoing requests |
|
||||
| tlsClientKey | string | _All_ | TLS Client key for outgoing requests |
|
||||
| password | string | _All_ | password |
|
||||
| basicAuthPassword | string | _All_ | password for basic authentication |
|
||||
| accessKey | string | Cloudwatch | Access key for connecting to Cloudwatch |
|
||||
| secretKey | string | Cloudwatch | Secret key for connecting to Cloudwatch |
|
||||
| Name | Type | Datasource | Description |
|
||||
| ----------------- | ------ | ---------------------------- | -------------------------------------------------------- |
|
||||
| tlsCACert | string | _All_ | CA cert for out going requests |
|
||||
| tlsClientCert | string | _All_ | TLS Client cert for outgoing requests |
|
||||
| tlsClientKey | string | _All_ | TLS Client key for outgoing requests |
|
||||
| password | string | _All_ | password |
|
||||
| basicAuthPassword | string | _All_ | 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 |
|
||||
|
||||
@@ -319,9 +320,11 @@ By default, Grafana deletes dashboards in the database if the file is removed. Y
|
||||
> or `uid` within the same installation as this will cause weird behaviors.
|
||||
|
||||
### Provision folders structure from filesystem to Grafana
|
||||
|
||||
If you already store your dashboards using folders in a git repo or on a filesystem, and also you want to have the same folder names in the Grafana menu, you can use `foldersFromFilesStructure` option.
|
||||
|
||||
For example, to replicate these dashboards structure from the filesystem to Grafana,
|
||||
|
||||
```
|
||||
/etc/dashboards
|
||||
├── /server
|
||||
@@ -331,18 +334,21 @@ For example, to replicate these dashboards structure from the filesystem to Graf
|
||||
├── /requests_dashboard.json
|
||||
└── /resources_dashboard.json
|
||||
```
|
||||
|
||||
you need to specify just this short provision configuration file.
|
||||
|
||||
```yaml
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: dashboards
|
||||
type: file
|
||||
updateIntervalSeconds: 30
|
||||
options:
|
||||
path: /etc/dashboards
|
||||
foldersFromFilesStructure: true
|
||||
- name: dashboards
|
||||
type: file
|
||||
updateIntervalSeconds: 30
|
||||
options:
|
||||
path: /etc/dashboards
|
||||
foldersFromFilesStructure: true
|
||||
```
|
||||
|
||||
`server` and `application` will become new folders in Grafana menu.
|
||||
|
||||
> **Note:** `folder` and `folderUid` options should be empty or missing to make `foldersFromFilesStructure` work.
|
||||
@@ -426,7 +432,7 @@ The following sections detail the supported settings and secure settings for eac
|
||||
#### Alert notification `pushover`
|
||||
|
||||
| Name | Secure setting |
|
||||
| -------- | -------------- |
|
||||
| ---------- | -------------- |
|
||||
| apiToken | yes |
|
||||
| userKey | yes |
|
||||
| device | |
|
||||
@@ -439,11 +445,11 @@ The following sections detail the supported settings and secure settings for eac
|
||||
|
||||
#### Alert notification `discord`
|
||||
|
||||
| Name | Secure setting |
|
||||
| -------------- | -------------- |
|
||||
| url | yes |
|
||||
| avatar_url | |
|
||||
| message | |
|
||||
| Name | Secure setting |
|
||||
| ---------- | -------------- |
|
||||
| url | yes |
|
||||
| avatar_url | |
|
||||
| content | |
|
||||
|
||||
#### Alert notification `slack`
|
||||
|
||||
@@ -500,7 +506,7 @@ The following sections detail the supported settings and secure settings for eac
|
||||
#### Alert notification `sensugo`
|
||||
|
||||
| Name | Secure setting |
|
||||
| -------- | -------------- |
|
||||
| --------- | -------------- |
|
||||
| url | |
|
||||
| apikey | yes |
|
||||
| entity | |
|
||||
|
||||
@@ -28,7 +28,7 @@ Require all network requests being made by Grafana to go through a proxy server.
|
||||
|
||||
## Limit Viewer query permissions
|
||||
|
||||
Users with the Viewer role can enter *any possible query* in *any* of the data sources available in the **organization**, not just the queries that are defined on the dashboards for which the user has Viewer permissions.
|
||||
Users with the Viewer role can enter _any possible query_ in _any_ of the data sources available in the **organization**, not just the queries that are defined on the dashboards for which the user has Viewer permissions.
|
||||
|
||||
**For example:** In a Grafana instance with one data source, one dashboard, and one panel that has one query defined, you might assume that a Viewer can only see the result of the query defined in that panel. Actually, the Viewer has access to send any query to the data source. With a command-line tool like curl (there are lots of tools for this), the Viewer can make their own query to the data source and potentially access sensitive data.
|
||||
|
||||
@@ -41,6 +41,6 @@ To address this vulnerability, you can restrict data source query access in the
|
||||
|
||||
When you enable anonymous access to a dashboard, it is publicly available. This section lists the security implications of enabling Anonymous access.
|
||||
|
||||
- Anyone with the URL can access the dashboard.
|
||||
- Anyone with the URL can access the dashboard.
|
||||
- Anyone can make view calls to the API and list all folders, dashboards, and data sources.
|
||||
- Anyone can make arbitrary queries to any data source that the Grafana instance is configured with.
|
||||
|
||||
@@ -18,7 +18,7 @@ and other persistent data. So the default embedded SQLite database will not work
|
||||
|
||||
First, you need to set up MySQL or Postgres on another server and configure Grafana to use that database.
|
||||
You can find the configuration for doing that in the [[database]]({{< relref "../administration/configuration.md#database" >}}) section in the Grafana config.
|
||||
Grafana will now persist all long term data in the database. How to configure the database for high availability is out of scope for this guide. We recommend finding an expert on for the database you're using.
|
||||
Grafana will now persist all long term data in the database. How to configure the database for high availability is out of scope for this guide. We recommend finding an expert on the database you're using.
|
||||
|
||||
## Alerting
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ These instructions assume you have already added Prometheus as a data source in
|
||||
static_configs:
|
||||
- targets: ['localhost:3000']
|
||||
```
|
||||
|
||||
1. Restart Prometheus. Your new job should appear on the Targets tab.
|
||||
1. In Grafana, hover your mouse over the **Configuration** (gear) icon on the left sidebar and then click **Data Sources**.
|
||||
1. Select the **Prometheus** data source.
|
||||
@@ -81,6 +82,7 @@ These instructions assume you have already added Graphite as a data source in Gr
|
||||
```
|
||||
|
||||
1. Enable [metrics.graphite] options:
|
||||
|
||||
```
|
||||
# Send internal metrics to Graphite
|
||||
[metrics.graphite]
|
||||
|
||||
@@ -8,6 +8,8 @@ weight = 300
|
||||
|
||||
# View Grafana server settings
|
||||
|
||||
> Refer to [Fine-grained access control]({{< relref "../../enterprise/access-control/_index.md" >}}) in Grafana Enterprise to understand how you can control access with fine-grained permissions.
|
||||
|
||||
If you are a Grafana server administrator, use the Settings tab to view the settings that are applied to your Grafana server via the [Configuration]({{< relref "../configuration.md#config-file-locations" >}}) file and any environmental variables.
|
||||
|
||||
> **Note:** Only Grafana server administrators can access the **Server Admin** menu. For more information about about administrative permissions, refer to [Grafana server admin]({{< relref "../../permissions/_index.md" >}}).
|
||||
|
||||
@@ -7,6 +7,8 @@ weight = 400
|
||||
|
||||
# View Grafana server stats
|
||||
|
||||
> Refer to [Fine-grained access control]({{< relref "../../enterprise/access-control/_index.md" >}}) in Grafana Enterprise to understand how you can control access with fine-grained permissions.
|
||||
|
||||
If you are a Grafana server admin, then you can view useful statistics about your Grafana server in the Stats tab.
|
||||
|
||||
> **Note:** Only Grafana server administrators can access the **Server Admin** menu. For more information about about administrative permissions, refer to [Grafana server admin]({{< relref "../../permissions/_index.md" >}}).
|
||||
@@ -45,5 +47,5 @@ If a user belongs to several organizations, then that user is counted once as a
|
||||
|
||||
For example, if Sofia is a Viewer in two organizations, an Editor in two organizations, and Admin in three organizations, then she would be reflected in the stats as:
|
||||
|
||||
- Total users 1
|
||||
- Total admins 1
|
||||
- Total users 1
|
||||
- Total admins 1
|
||||
|
||||
@@ -7,7 +7,9 @@ weight = 110
|
||||
|
||||
Alerts allow you to know about problems in your systems moments after they occur. Robust and actionable alerts help you identify and resolve issues quickly, minimizing disruption to your services.
|
||||
|
||||
Grafana 8.0 has new and improved alerts. The new alerting system are an [opt-in]({{< relref "./unified-alerting/opt-in.md" >}}) feature that centralizes alerting information for Grafana managed alerts and alerts from Prometheus-compatible data sources in one UI and API.
|
||||
Grafana 8.0 has new and improved alerts. The new alerting system is an [opt-in]({{< relref "./unified-alerting/opt-in.md" >}}) feature that centralizes alerting information for Grafana managed alerts and alerts from Prometheus-compatible data sources in one UI and API.
|
||||
|
||||
> **Note:** Out of the box, Grafana still supports old [legacy dashboard alerts]({{< relref "./old-alerting/_index.md" >}}). We encourage you to create issues in the Grafana GitHub repository for bugs found while testing Grafana 8 alerts.
|
||||
|
||||
Alerts have four main components:
|
||||
|
||||
@@ -26,4 +28,4 @@ As part of the new alert changes, we have introduced a new data source, Alertman
|
||||
|
||||
> **Note:** Out of the box, Grafana still supports old Grafana alerts. They are legacy alerts at this time, and will be deprecated in a future release. For more information, refer to [Legacy Grafana alerts]({{< relref "./old-alerting/_index.md" >}}).
|
||||
|
||||
To learn more about the differences between new alerts and the legacy alerts, refer to [What's New with Grafana 8 Alerts]({{< relref "../alerting/difference-old-new.md" >}}).
|
||||
To learn more about the differences between new alerts and the legacy alerts, refer to [What's New with Grafana 8 Alerts]({{< relref "../alerting/difference-old-new.md" >}}).
|
||||
|
||||
@@ -6,16 +6,21 @@ weight = 112
|
||||
+++
|
||||
|
||||
# What's New with Grafana 8 Alerts
|
||||
|
||||
The Alerts released with Grafana 8.0 are an opt-in feature that centralizes alerting information for Grafana managed alerts and alerts from Prometheus-compatible datasources in one UI and API. You are able to create and edit alerting rules for Grafana managed alerts, Cortex alerts, and Loki alerts as well as see alerting information from prometheus-compatible datasources in a single, searchable view.
|
||||
|
||||
## Multi-dimensional alerting
|
||||
Create alerts that will give you system-wide visibility with a single alerting rule. With Grafana 8 alerts, you are able to generate multiple alert instances from a single rule eg. creating a rule to monitor disk usage for multiple mount points on a single host. The evaluation engine is able to return multiple time series from a single query. Each time series is identified by its label set.
|
||||
|
||||
Create alerts that will give you system-wide visibility with a single alerting rule. With Grafana 8 alerts, you are able to generate multiple alert instances from a single rule eg. creating a rule to monitor disk usage for multiple mount points on a single host. The evaluation engine is able to return multiple time series from a single query. Each time series is identified by its label set.
|
||||
|
||||
## Create alerts outside of Dashboards
|
||||
Grafana legacy alerts were tied to a dashboard. Grafana 8 Alerts allow you to create queries and expressions that can combine data from multiple sources, in unique ways. You are still able to link dashboards and panels to alerting rules, allowing you to quickly troubleshoot the system under observation, by linking a dashboard and/or panel ID to the alerting rule.
|
||||
|
||||
Grafana legacy alerts were tied to a dashboard. Grafana 8 Alerts allow you to create queries and expressions that can combine data from multiple sources, in unique ways. You are still able to link dashboards and panels to alerting rules, allowing you to quickly troubleshoot the system under observation, by linking a dashboard and/or panel ID to the alerting rule.
|
||||
|
||||
## Create Loki and Cortex alerting rules
|
||||
With Grafana 8 Alerts you are able to manage your Loki and Cortex alerting rules using the same UI and API as your Grafana managed alerts.
|
||||
|
||||
With Grafana 8 Alerts you are able to manage your Loki and Cortex alerting rules using the same UI and API as your Grafana managed alerts.
|
||||
|
||||
## View and search for alerts from Prometheus
|
||||
|
||||
You can now display all of your alerting information in one, searchable UI. Alerts for Prometheus compatible datasources are listed below Grafana managed alerts. Search for labels across multiple datasources to quickly find all of the relevant alerts.
|
||||
|
||||
@@ -17,7 +17,7 @@ Currently only the graph panel visualization supports alerts.
|
||||
Legacy alerts have two main components:
|
||||
|
||||
- Alert rule - When the alert is triggered. Alert rules are defined by one or more conditions that are regularly evaluated by Grafana.
|
||||
- Notification channel - How the alert is delivered. When the conditions of an alert rule are met, the Grafana notifies the channels configured for that alert.
|
||||
- Notification channel - How the alert is delivered. When the conditions of an alert rule are met, the Grafana notifies the channels configured for that alert.
|
||||
|
||||
## Alert tasks
|
||||
|
||||
@@ -37,20 +37,21 @@ Currently alerting supports a limited form of high availability. Since v4.2.0 of
|
||||
Grafana managed alerts are evaluated by the Grafana backend. Rule evaluations are scheduled, according to the alert rule configuration, and queries are evaluated by an engine that is part of core Grafana.
|
||||
|
||||
Alert rules can only query backend data sources with alerting enabled:
|
||||
|
||||
- builtin or developed and maintained by grafana: `Graphite`, `Prometheus`, `Loki`, `InfluxDB`, `Elasticsearch`,
|
||||
`Google Cloud Monitoring`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`
|
||||
`Google Cloud Monitoring`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`
|
||||
- any community backend data sources with alerting enabled (`backend` and `alerting` properties are set in the [plugin.json]({{< relref "../../developers/plugins/metadata.md" >}}))
|
||||
|
||||
## Metrics from the alert engine
|
||||
|
||||
The alert engine publishes some internal metrics about itself. You can read more about how Grafana publishes [internal metrics]({{< relref "../../administration/view-server/internal-metrics.md" >}}).
|
||||
|
||||
Metric Name | Type | Description
|
||||
---------- | ----------- | ----------
|
||||
`alerting.alerts` | gauge | How many alerts by state
|
||||
`alerting.request_duration_seconds` | histogram | Histogram of requests to the Alerting API
|
||||
`alerting.active_configurations` | gauge | The number of active, non default alertmanager configurations for grafana managed alerts
|
||||
`alerting.rule_evaluations_total` | counter | The total number of rule evaluations
|
||||
`alerting.rule_evaluation_failures_total` | counter | The total number of rule evaluation failures
|
||||
`alerting.rule_evaluation_duration_seconds` | summary | The duration for a rule to execute
|
||||
`alerting.rule_group_rules` | gauge | The number of rules
|
||||
| Metric Name | Type | Description |
|
||||
| ------------------------------------------- | --------- | ---------------------------------------------------------------------------------------- |
|
||||
| `alerting.alerts` | gauge | How many alerts by state |
|
||||
| `alerting.request_duration_seconds` | histogram | Histogram of requests to the Alerting API |
|
||||
| `alerting.active_configurations` | gauge | The number of active, non default alertmanager configurations for grafana managed alerts |
|
||||
| `alerting.rule_evaluations_total` | counter | The total number of rule evaluations |
|
||||
| `alerting.rule_evaluation_failures_total` | counter | The total number of rule evaluation failures |
|
||||
| `alerting.rule_evaluation_duration_seconds` | summary | The duration for a rule to execute |
|
||||
| `alerting.rule_group_rules` | gauge | The number of rules |
|
||||
|
||||
@@ -96,16 +96,16 @@ Below are conditions you can configure how the rule evaluation engine should han
|
||||
| --------------- | ------------------------------------------------------------------------------------------ |
|
||||
| No Data | Set alert rule state to `NoData` |
|
||||
| Alerting | Set alert rule state to `Alerting` |
|
||||
| Keep Last State | Keep the current alert rule state, whatever it is. |
|
||||
| Keep Last State | Keep the current alert rule state, whatever it is. |
|
||||
| Ok | Not sure why you would want to send yourself an alert when things are okay, but you could. |
|
||||
|
||||
### Execution errors or timeouts
|
||||
|
||||
Tell Grafana how to handle execution or timeout errors.
|
||||
|
||||
| Error or timeout option | Description |
|
||||
| ----------------------- | --------------------------------------------------- |
|
||||
| Alerting | Set alert rule state to `Alerting` |
|
||||
| Error or timeout option | Description |
|
||||
| ----------------------- | -------------------------------------------------- |
|
||||
| Alerting | Set alert rule state to `Alerting` |
|
||||
| Keep Last State | Keep the current alert rule state, whatever it is. |
|
||||
|
||||
If you have an unreliable time series store from which queries sometime timeout or fail randomly you can set this option to `Keep Last State` in order to basically ignore them.
|
||||
@@ -124,4 +124,3 @@ The actual notifications are configured and shared between multiple alerts. Read
|
||||
## Alert state history and annotations
|
||||
|
||||
Alert state changes are recorded in the internal annotation table in Grafana's database. The state changes are visualized as annotations in the alert rule's graph panel. You can also go into the `State history` submenu in the alert tab to view and clear state history.
|
||||
|
||||
|
||||
@@ -37,41 +37,40 @@ This is done from the Notification channels page.
|
||||
|
||||
These examples show how often and when reminders are sent for a triggered alert.
|
||||
|
||||
Alert rule evaluation interval | Send reminders every | Reminder sent every (after last alert notification)
|
||||
---------- | ----------- | -----------
|
||||
`30s` | `15s` | ~30 seconds
|
||||
`1m` | `5m` | ~5 minutes
|
||||
`5m` | `15m` | ~15 minutes
|
||||
`6m` | `20m` | ~24 minutes
|
||||
`1h` | `15m` | ~1 hour
|
||||
`1h` | `2h` | ~2 hours
|
||||
| Alert rule evaluation interval | Send reminders every | Reminder sent every (after last alert notification) |
|
||||
| ------------------------------ | -------------------- | --------------------------------------------------- |
|
||||
| `30s` | `15s` | ~30 seconds |
|
||||
| `1m` | `5m` | ~5 minutes |
|
||||
| `5m` | `15m` | ~15 minutes |
|
||||
| `6m` | `20m` | ~24 minutes |
|
||||
| `1h` | `15m` | ~1 hour |
|
||||
| `1h` | `2h` | ~2 hours |
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
## List of supported notifiers
|
||||
|
||||
Name | Type | Supports images | Support alert rule tags
|
||||
-----|------|---------------- | -----------------------
|
||||
[DingDing](#dingdingdingtalk) | `dingding` | yes, external only | no
|
||||
[Discord](#discord) | `discord` | yes | no
|
||||
[Email](#email) | `email` | yes | no
|
||||
[Google Hangouts Chat](#google-hangouts-chat) | `googlechat` | yes, external only | no
|
||||
Hipchat | `hipchat` | yes, external only | no
|
||||
[Kafka](#kafka) | `kafka` | yes, external only | no
|
||||
Line | `line` | yes, external only | no
|
||||
Microsoft Teams | `teams` | yes, external only | no
|
||||
[Opsgenie](#opsgenie) | `opsgenie` | yes, external only | yes
|
||||
[Pagerduty](#pagerduty) | `pagerduty` | yes, external only | yes
|
||||
Prometheus Alertmanager | `prometheus-alertmanager` | yes, external only | yes
|
||||
[Pushover](#pushover) | `pushover` | yes | no
|
||||
Sensu | `sensu` | yes, external only | no
|
||||
[Sensu Go](#sensu-go) | `sensugo` | yes, external only | no
|
||||
[Slack](#slack) | `slack` | yes | no
|
||||
Telegram | `telegram` | yes | no
|
||||
Threema | `threema` | yes, external only | no
|
||||
VictorOps | `victorops` | yes, external only | yes
|
||||
[Webhook](#webhook) | `webhook` | yes, external only | yes
|
||||
[Zenduty](#zenduty) | `webhook` | yes, external only | yes
|
||||
| Name | Type | Supports images | Support alert rule tags |
|
||||
| --------------------------------------------- | ------------------------- | ------------------ | ----------------------- |
|
||||
| [DingDing](#dingdingdingtalk) | `dingding` | yes, external only | no |
|
||||
| [Discord](#discord) | `discord` | yes | no |
|
||||
| [Email](#email) | `email` | yes | no |
|
||||
| [Google Hangouts Chat](#google-hangouts-chat) | `googlechat` | yes, external only | no |
|
||||
| Hipchat | `hipchat` | yes, external only | no |
|
||||
| [Kafka](#kafka) | `kafka` | yes, external only | no |
|
||||
| Line | `line` | yes, external only | no |
|
||||
| Microsoft Teams | `teams` | yes, external only | no |
|
||||
| [Opsgenie](#opsgenie) | `opsgenie` | yes, external only | yes |
|
||||
| [Pagerduty](#pagerduty) | `pagerduty` | yes, external only | yes |
|
||||
| Prometheus Alertmanager | `prometheus-alertmanager` | yes, external only | yes |
|
||||
| [Pushover](#pushover) | `pushover` | yes | no |
|
||||
| Sensu | `sensu` | yes, external only | no |
|
||||
| [Sensu Go](#sensu-go) | `sensugo` | yes, external only | no |
|
||||
| [Slack](#slack) | `slack` | yes | no |
|
||||
| Telegram | `telegram` | yes | no |
|
||||
| Threema | `threema` | yes, external only | no |
|
||||
| VictorOps | `victorops` | yes, external only | yes |
|
||||
| [Webhook](#webhook) | `webhook` | yes, external only | yes |
|
||||
|
||||
### Email
|
||||
|
||||
@@ -83,10 +82,10 @@ able to access the image.
|
||||
|
||||
> **Note:** Template variables are not supported in email alerts.
|
||||
|
||||
Setting | Description
|
||||
---------- | -----------
|
||||
Single email | Send a single email to all recipients. Disabled per default.
|
||||
Addresses | Email addresses to recipients. You can enter multiple email addresses using a ";" separator.
|
||||
| Setting | Description |
|
||||
| ------------ | -------------------------------------------------------------------------------------------- |
|
||||
| Single email | Send a single email to all recipients. Disabled per default. |
|
||||
| Addresses | Email addresses to recipients. You can enter multiple email addresses using a ";" separator. |
|
||||
|
||||
### Slack
|
||||
|
||||
@@ -98,17 +97,17 @@ firing alerts in the Slack messages you have to configure either the [external i
|
||||
in Grafana or a bot integration via Slack Apps. [Follow Slack's guide to set up a bot integration](https://api.slack.com/bot-users) and use the token
|
||||
provided, which starts with "xoxb".
|
||||
|
||||
Setting | Description
|
||||
---------- | -----------
|
||||
Url | Slack incoming webhook URL, or eventually the [chat.postMessage](https://api.slack.com/methods/chat.postMessage) Slack API endpoint.
|
||||
Username | Set the username for the bot's message.
|
||||
Recipient | Allows you to override the Slack recipient. You must either provide a channel Slack ID, a user Slack ID, a username reference (@<user>, all lowercase, no whitespace), or a channel reference (#<channel>, all lowercase, no whitespace). If you use the `chat.postMessage` Slack API endpoint, this is required.
|
||||
Icon emoji | Provide an emoji to use as the icon for the bot's message. Ex :smile:
|
||||
Icon URL | Provide a URL to an image to use as the icon for the bot's message.
|
||||
Mention Users | Optionally mention one or more users in the Slack notification sent by Grafana. You have to refer to users, comma-separated, via their corresponding Slack IDs (which you can find by clicking the overflow button on each user's Slack profile).
|
||||
Mention Groups | Optionally mention one or more groups in the Slack notification sent by Grafana. You have to refer to groups, comma-separated, via their corresponding Slack IDs (which you can get from each group's Slack profile URL).
|
||||
Mention Channel | Optionally mention either all channel members or just active ones.
|
||||
Token | If provided, Grafana will upload the generated image via Slack's file.upload API method, not the external image destination. If you use the `chat.postMessage` Slack API endpoint, this is required.
|
||||
| Setting | Description |
|
||||
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Url | Slack incoming webhook URL, or eventually the [chat.postMessage](https://api.slack.com/methods/chat.postMessage) Slack API endpoint. |
|
||||
| Username | Set the username for the bot's message. |
|
||||
| Recipient | Allows you to override the Slack recipient. You must either provide a channel Slack ID, a user Slack ID, a username reference (@<user>, all lowercase, no whitespace), or a channel reference (#<channel>, all lowercase, no whitespace). If you use the `chat.postMessage` Slack API endpoint, this is required. |
|
||||
| Icon emoji | Provide an emoji to use as the icon for the bot's message. Ex :smile: |
|
||||
| Icon URL | Provide a URL to an image to use as the icon for the bot's message. |
|
||||
| Mention Users | Optionally mention one or more users in the Slack notification sent by Grafana. You have to refer to users, comma-separated, via their corresponding Slack IDs (which you can find by clicking the overflow button on each user's Slack profile). |
|
||||
| Mention Groups | Optionally mention one or more groups in the Slack notification sent by Grafana. You have to refer to groups, comma-separated, via their corresponding Slack IDs (which you can get from each group's Slack profile URL). |
|
||||
| Mention Channel | Optionally mention either all channel members or just active ones. |
|
||||
| Token | If provided, Grafana will upload the generated image via Slack's file.upload API method, not the external image destination. If you use the `chat.postMessage` Slack API endpoint, this is required. |
|
||||
|
||||
If you are using the token for a slack bot, then you have to invite the bot to the channel you want to send notifications and add the channel to the recipient field.
|
||||
|
||||
@@ -116,12 +115,12 @@ If you are using the token for a slack bot, then you have to invite the bot to t
|
||||
|
||||
To setup Opsgenie you will need an API Key and the Alert API Url. These can be obtained by configuring a new [Grafana Integration](https://docs.opsgenie.com/docs/grafana-integration).
|
||||
|
||||
Setting | Description
|
||||
--------|------------
|
||||
Alert API URL | The API URL for your Opsgenie instance. This will normally be either `https://api.opsgenie.com` or, for EU customers, `https://api.eu.opsgenie.com`.
|
||||
API Key | The API Key as provided by Opsgenie for your configured Grafana integration.
|
||||
Override priority | Configures the alert priority using the `og_priority` tag. The `og_priority` tag must have one of the following values: `P1`, `P2`, `P3`, `P4`, or `P5`. Default is `False`.
|
||||
Send notification tags as | Specify how you would like [Notification Tags]({{< relref "create-alerts.md/#notifications" >}}) delivered to Opsgenie. They can be delivered as `Tags`, `Extra Properties` or both. Default is Tags. See note below for more information.
|
||||
| Setting | Description |
|
||||
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Alert API URL | The API URL for your Opsgenie instance. This will normally be either `https://api.opsgenie.com` or, for EU customers, `https://api.eu.opsgenie.com`. |
|
||||
| API Key | The API Key as provided by Opsgenie for your configured Grafana integration. |
|
||||
| Override priority | Configures the alert priority using the `og_priority` tag. The `og_priority` tag must have one of the following values: `P1`, `P2`, `P3`, `P4`, or `P5`. Default is `False`. |
|
||||
| Send notification tags as | Specify how you would like [Notification Tags]({{< relref "create-alerts.md/#notifications" >}}) delivered to Opsgenie. They can be delivered as `Tags`, `Extra Properties` or both. Default is Tags. See note below for more information. |
|
||||
|
||||
> **Note:** When notification tags are sent as `Tags` they are concatenated into a string with a `key:value` format. If you prefer to receive the notifications tags as key/values under Extra Properties in Opsgenie then change the `Send notification tags as` to either `Extra Properties` or `Tags & Extra Properties`.
|
||||
|
||||
@@ -129,45 +128,47 @@ Send notification tags as | Specify how you would like [Notification Tags]({{< r
|
||||
|
||||
To set up PagerDuty, all you have to do is to provide an integration key.
|
||||
|
||||
Setting | Description
|
||||
---------- | -----------
|
||||
Integration Key | Integration key for PagerDuty.
|
||||
Severity | Level for dynamic notifications, default is `critical` (1)
|
||||
Auto resolve incidents | Resolve incidents in PagerDuty once the alert goes back to ok
|
||||
Message in details | Removes the Alert message from the PD summary field and puts it into custom details instead (2)
|
||||
| Setting | Description |
|
||||
| ---------------------- | ----------------------------------------------------------------------------------------------- |
|
||||
| Integration Key | Integration key for PagerDuty. |
|
||||
| Severity | Level for dynamic notifications, default is `critical` (1) |
|
||||
| Auto resolve incidents | Resolve incidents in PagerDuty once the alert goes back to ok |
|
||||
| Message in details | Removes the Alert message from the PD summary field and puts it into custom details instead (2) |
|
||||
|
||||
>**Note:** The tags `Severity`, `Class`, `Group`, `dedup_key`, and `Component` have special meaning in the [Pagerduty Common Event Format - PD-CEF](https://support.pagerduty.com/docs/pd-cef). If an alert panel defines these tag keys, then they are transposed to the root of the event sent to Pagerduty. This means they will be available within the Pagerduty UI and Filtering tools. A Severity tag set on an alert overrides the global Severity set on the notification channel if it's a valid level.
|
||||
> **Note:** The tags `Severity`, `Class`, `Group`, `dedup_key`, and `Component` have special meaning in the [Pagerduty Common Event Format - PD-CEF](https://support.pagerduty.com/docs/pd-cef). If an alert panel defines these tag keys, then they are transposed to the root of the event sent to Pagerduty. This means they will be available within the Pagerduty UI and Filtering tools. A Severity tag set on an alert overrides the global Severity set on the notification channel if it's a valid level.
|
||||
|
||||
>Using Message In Details will change the structure of the `custom_details` field in the PagerDuty Event.
|
||||
This might break custom event rules in your PagerDuty rules if you rely on the fields in `payload.custom_details`.
|
||||
Move any existing rules using `custom_details.myMetric` to `custom_details.queries.myMetric`.
|
||||
This behavior will become the default in a future version of Grafana.
|
||||
> Using Message In Details will change the structure of the `custom_details` field in the PagerDuty Event.
|
||||
> This might break custom event rules in your PagerDuty rules if you rely on the fields in `payload.custom_details`.
|
||||
> Move any existing rules using `custom_details.myMetric` to `custom_details.queries.myMetric`.
|
||||
> This behavior will become the default in a future version of Grafana.
|
||||
|
||||
> **Note:** The `dedup_key` tag overrides the Grafana-generated `dedup_key` with a custom key.
|
||||
|
||||
> **Note:** The `state` tag overrides the current alert state inside the `custom_details` payload.
|
||||
|
||||
> **Note:** Grafana uses the `Events API V2` integration. This can be configured for each service.
|
||||
|
||||
### VictorOps
|
||||
|
||||
To configure VictorOps, provide the URL from the Grafana Integration and substitute `$routing_key` with a valid key.
|
||||
|
||||
> **Note:** The tag `Severity` has special meaning in the [VictorOps Incident Fields](https://help.victorops.com/knowledge-base/incident-fields-glossary/). If an alert panel defines this key, then it replaces the `message_type` in the root of the event sent to VictorOps.
|
||||
|
||||
### Pushover
|
||||
|
||||
To set up Pushover, you must provide a user key and an API token. Refer to [What is Pushover and how do I use it](https://support.pushover.net/i7-what-is-pushover-and-how-do-i-use-it) for instructions on how to generate them.
|
||||
|
||||
|
||||
Setting | Description
|
||||
---------- | -----------
|
||||
API Token | Application token
|
||||
User key(s) | A comma-separated list of user keys
|
||||
Device(s) | A comma-separated list of devices
|
||||
Priority | The priority alerting nottifications are sent
|
||||
OK priority | The priority OK notifications are sent; if not set, then OK notifications are sent with the priority set for alerting notifications
|
||||
Retry | How often (in seconds) the Pushover servers send the same notification to the user. (minimum 30 seconds)
|
||||
Expire | How many seconds your notification will continue to be retried for (maximum 86400 seconds)
|
||||
Alerting sound | The sound for alerting notifications
|
||||
OK sound | The sound for OK notifications
|
||||
| Setting | Description |
|
||||
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| API Token | Application token |
|
||||
| User key(s) | A comma-separated list of user keys |
|
||||
| Device(s) | A comma-separated list of devices |
|
||||
| Priority | The priority alerting nottifications are sent |
|
||||
| OK priority | The priority OK notifications are sent; if not set, then OK notifications are sent with the priority set for alerting notifications |
|
||||
| Retry | How often (in seconds) the Pushover servers send the same notification to the user. (minimum 30 seconds) |
|
||||
| Expire | How many seconds your notification will continue to be retried for (maximum 86400 seconds) |
|
||||
| Alerting sound | The sound for alerting notifications |
|
||||
| OK sound | The sound for OK notifications |
|
||||
|
||||
### Webhook
|
||||
|
||||
@@ -178,26 +179,26 @@ Example json body:
|
||||
|
||||
```json
|
||||
{
|
||||
"dashboardId":1,
|
||||
"evalMatches":[
|
||||
"dashboardId": 1,
|
||||
"evalMatches": [
|
||||
{
|
||||
"value":1,
|
||||
"metric":"Count",
|
||||
"tags":{}
|
||||
"value": 1,
|
||||
"metric": "Count",
|
||||
"tags": {}
|
||||
}
|
||||
],
|
||||
"imageUrl":"https://grafana.com/assets/img/blog/mixed_styles.png",
|
||||
"message":"Notification Message",
|
||||
"orgId":1,
|
||||
"panelId":2,
|
||||
"ruleId":1,
|
||||
"ruleName":"Panel Title alert",
|
||||
"ruleUrl":"http://localhost:3000/d/hZ7BuVbWz/test-dashboard?fullscreen\u0026edit\u0026tab=alert\u0026panelId=2\u0026orgId=1",
|
||||
"state":"alerting",
|
||||
"tags":{
|
||||
"tag name":"tag value"
|
||||
"imageUrl": "https://grafana.com/assets/img/blog/mixed_styles.png",
|
||||
"message": "Notification Message",
|
||||
"orgId": 1,
|
||||
"panelId": 2,
|
||||
"ruleId": 1,
|
||||
"ruleName": "Panel Title alert",
|
||||
"ruleUrl": "http://localhost:3000/d/hZ7BuVbWz/test-dashboard?fullscreen\u0026edit\u0026tab=alert\u0026panelId=2\u0026orgId=1",
|
||||
"state": "alerting",
|
||||
"tags": {
|
||||
"tag name": "tag value"
|
||||
},
|
||||
"title":"[Alerting] Panel Title alert"
|
||||
"title": "[Alerting] Panel Title alert"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -213,7 +214,7 @@ In DingTalk PC Client:
|
||||
|
||||
2. Click "Robot Manage" item in the pop menu, there will be a new panel call "Robot Manage".
|
||||
|
||||
3. In the "Robot Manage" panel, select "customized: customized robot with Webhook".
|
||||
3. In the "Robot Manage" panel, select "customized: customized robot with Webhook".
|
||||
|
||||
4. In the next new panel named "robot detail", click "Add" button.
|
||||
|
||||
@@ -226,11 +227,11 @@ In DingTalk PC Client:
|
||||
To set up Discord, you must create a Discord channel webhook. For instructions on how to create the channel, refer to
|
||||
[Intro to Webhooks](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
|
||||
|
||||
Setting | Description
|
||||
---------- | -----------
|
||||
Webhook URL | Discord webhook URL.
|
||||
Message Content | Mention a group using @ or a user using <@ID> when notifying in a channel.
|
||||
Avatar URL | Optionally, provide a URL to an image to use as the avatar for the bot's message.
|
||||
| Setting | Description |
|
||||
| --------------- | --------------------------------------------------------------------------------- |
|
||||
| Webhook URL | Discord webhook URL. |
|
||||
| Message Content | Mention a group using @ or a user using <@ID> when notifying in a channel. |
|
||||
| Avatar URL | Optionally, provide a URL to an image to use as the avatar for the bot's message. |
|
||||
|
||||
Alternately, use the [Slack](#slack) notifier by appending `/slack` to a Discord webhook URL.
|
||||
|
||||
@@ -255,18 +256,14 @@ Alertmanager handles alerts sent by client applications such as Prometheus serve
|
||||
|
||||
> **Caution:** In case of a high-availability setup, do not load balance traffic between Grafana and Alertmanagers to keep coherence between all your Alertmanager instances. Instead, point Grafana to a list of all Alertmanagers, by listing their URLs comma-separated in the notification channel configuration.
|
||||
|
||||
### Zenduty
|
||||
|
||||
[Zenduty](https://www.zenduty.com) is an incident alerting and response orchestration platform that not alerts the right teams via SMS, Phone(Voice), Email, Slack, Microsoft Teams and Push notifications(Android/iOS) whenever a Grafana alert is triggered, but also helps you rapidly triage and remediate critical, user impacting incidents. Grafana alert are sent to Zenduty through Grafana's native webhook dispatcher. Refer the Zenduty-Grafana [integration documentation](https://docs.zenduty.com/docs/grafana) for configuring the integration.
|
||||
|
||||
### Sensu Go
|
||||
|
||||
[Sensu](https://sensu.io) is a complete solution for monitoring and observability at scale. Sensu Go is designed to give you visibility into everything you care about: traditional server closets, containers, applications, the cloud, and more. Grafana notifications can be sent to Sensu Go as events via the API. This operation requires an API Key. Refer to the [Sensu Go documentation](https://docs.sensu.io/sensu-go/latest/operations/control-access/use-apikeys/#api-key-authentication) for information on creating this key.
|
||||
Grafana alert notifications can be sent to [Sensu](<(https://sensu.io)>) Go as events via the API. This operation requires an API key. For information on creating this key, refer to [Sensu Go documentation](https://docs.sensu.io/sensu-go/latest/operations/control-access/use-apikeys/#api-key-authentication).
|
||||
|
||||
## Enable images in notifications {#external-image-store}
|
||||
|
||||
Grafana can render the panel associated with the alert rule as a PNG image and include that in the notification. Read more about the requirements and how to configure
|
||||
[image rendering]({{< relref "../../administration/image_rendering/" >}}).
|
||||
[image rendering]({{< relref "../../image-rendering/" >}}).
|
||||
|
||||
You must configure an [external image storage provider]({{< relref "../../administration/configuration/#external-image-storage" >}}) in order to receive images in alert notifications. If your notification channel requires that the image be publicly accessible (e.g. Slack, PagerDuty), configure a provider which uploads the image to a remote image store like Amazon S3, Webdav, Google Cloud Storage, or Azure Blob Storage. Otherwise, the local provider can be used to serve the image directly from Grafana.
|
||||
|
||||
|
||||
@@ -12,4 +12,4 @@ Pausing the evaluation of an alert rule can sometimes be useful. For example, du
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the Alerting (bell) icon and then click **Alert Rules**. All configured alert rules are listed, along with their current state.
|
||||
1. Find your alert in the list, and click the **Pause** icon on the right. The **Pause** icon turns into a **Play** icon.
|
||||
1. Click the **Play** icon to resume evaluation of your alert.
|
||||
1. Click the **Play** icon to resume evaluation of your alert.
|
||||
|
||||
@@ -17,4 +17,4 @@ You can do several things while viewing alerts.
|
||||
- **Filter alerts by name -** Type an alert name in the **Search alerts** field.
|
||||
- **Filter alerts by state -** In **States**, select which alert states you want to see. All others will be hidden.
|
||||
- **Pause or resume an alert -** Click the **Pause** or **Play** icon next to the alert to pause or resume evaluation. See [Pause an alert rule]({{< relref "pause-an-alert-rule.md" >}}) for more information.
|
||||
- **Access alert rule settings -** Click the alert name or the **Edit alert rule** (gear) icon. Grafana opens the Alert tab of the panel where the alert rule is defined. This is helpful when an alert is firing but you don't know which panel it is defined in.
|
||||
- **Access alert rule settings -** Click the alert name or the **Edit alert rule** (gear) icon. Grafana opens the Alert tab of the panel where the alert rule is defined. This is helpful when an alert is firing but you don't know which panel it is defined in.
|
||||
|
||||
@@ -5,11 +5,12 @@ weight = 113
|
||||
+++
|
||||
|
||||
# Overview of Grafana 8 alerts
|
||||
|
||||
Alerts allow you to know about problems in your systems moments after they occur. Robust and actionable alerts help you identify and resolve issues quickly, minimizing disruption to your services.
|
||||
|
||||
>**Note:** This information is for the new, Grafana 8 Alerts. This is an [opt-in]({{< relref"./opt-in.md" >}}) feature released in Grafana 8.0. Grafana still supports [legacy dashboard alerts]({{< relref "../old-alerting/_index.md" >}}) out of the box
|
||||
> **Note:** Grafana 8 alerts (beta) is an [opt-in]({{< relref"./opt-in.md" >}}) feature. Out of the box, Grafana still supports old [legacy dashboard alerts]({{< relref "../old-alerting/_index.md" >}}). We encourage you to create issues in the Grafana GitHub repository for bugs found while testing this new feature.
|
||||
|
||||
Alerts have four main components:
|
||||
Grafana 8 alerts have four main components:
|
||||
|
||||
- Alerting rule - One or more query and/or expression, a condition, the frequency of evaluation, and the (optional) duration that a condition must be met before creating an alert.
|
||||
- Contact point - A channel for sending notifications when the conditions of an alerting rule are met.
|
||||
@@ -20,11 +21,10 @@ Alerts have four main components:
|
||||
|
||||
You can perform the following tasks for alerts:
|
||||
|
||||
|
||||
- [Create a Grafana managed alert rule]({{< relref "alerting-rules/create-grafana-managed-rule.md" >}})
|
||||
- [Create a Cortex or Loki managed alert rule]({{< relref "alerting-rules/create-cortex-loki-managed-rule.md" >}})
|
||||
- [View existing alert rules and their current state]({{< relref "alerting-rules/rule-list.md" >}})
|
||||
- [Test alert rules and troubleshoot]({{< relref "./troubleshoot-alerts.md" >}})
|
||||
- [View state and health of alerting rules]({{< relref "alerting-rules/state-and-health.md" >}})
|
||||
- [Add or edit an alert contact point]({{< relref "./contact-points.md" >}})
|
||||
- [Add or edit notification policies]({{< relref "./notification-policies.md" >}})
|
||||
- [Create and edit silences]({{< relref "./silences.md" >}})
|
||||
@@ -38,6 +38,7 @@ The current alerting system doesn't support high availability. Alert notificatio
|
||||
Grafana managed alerts are evaluated by the Grafana backend. Rule evaluations are scheduled, according to the alert rule configuration, and queries are evaluated by an engine that is part of core Grafana.
|
||||
|
||||
Alerting rules can only query backend data sources with alerting enabled:
|
||||
|
||||
- builtin or developed and maintained by grafana: `Graphite`, `Prometheus`, `Loki`, `InfluxDB`, `Elasticsearch`,
|
||||
`Google Cloud Monitoring`, `Cloudwatch`, `Azure Monitor`, `MySQL`, `PostgreSQL`, `MSSQL`, `OpenTSDB`, `Oracle`, and `Azure Data Explorer`
|
||||
- any community backend data sources with alerting enabled (`backend` and `alerting` properties are set in the [plugin.json]({{< relref "../../developers/plugins/metadata.md" >}}))
|
||||
@@ -46,15 +47,14 @@ Alerting rules can only query backend data sources with alerting enabled:
|
||||
|
||||
The alerting engine publishes some internal metrics about itself. You can read more about how Grafana publishes [internal metrics]({{< relref "../../administration/view-server/internal-metrics.md" >}}).
|
||||
|
||||
Metric Name | Type | Description
|
||||
---------- | ----------- | ----------
|
||||
`alerting.alerts` | gauge | How many alerts by state
|
||||
`alerting.request_duration_seconds` | histogram | Histogram of requests to the Alerting API
|
||||
`alerting.active_configurations` | gauge | The number of active, non default Alertmanager configurations for grafana managed alerts
|
||||
`alerting.rule_evaluations_total` | counter | The total number of rule evaluations
|
||||
`alerting.rule_evaluation_failures_total` | counter | The total number of rule evaluation failures
|
||||
`alerting.rule_evaluation_duration_seconds` | summary | The duration for a rule to execute
|
||||
`alerting.rule_group_rules` | gauge | The number of rules
|
||||
|
||||
| Metric Name | Type | Description |
|
||||
| ------------------------------------------- | --------- | ---------------------------------------------------------------------------------------- |
|
||||
| `alerting.alerts` | gauge | How many alerts by state |
|
||||
| `alerting.request_duration_seconds` | histogram | Histogram of requests to the Alerting API |
|
||||
| `alerting.active_configurations` | gauge | The number of active, non default Alertmanager configurations for grafana managed alerts |
|
||||
| `alerting.rule_evaluations_total` | counter | The total number of rule evaluations |
|
||||
| `alerting.rule_evaluation_failures_total` | counter | The total number of rule evaluation failures |
|
||||
| `alerting.rule_evaluation_duration_seconds` | summary | The duration for a rule to execute |
|
||||
| `alerting.rule_group_rules` | gauge | The number of rules |
|
||||
|
||||
- [View alert rules and their current state]({{< relref "alerting-rules/rule-list.md" >}})
|
||||
|
||||
@@ -5,9 +5,12 @@ weight = 130
|
||||
+++
|
||||
|
||||
# Create and manage alerting Rules
|
||||
One or more queries and/or expressions, a condition, the frequency of evaluation, and the (optional) duration that a condition must be met before creating an alert. Alerting rules are how you express the criteria for creating an alert. Queries and expressions select and can operate on the data you wish to alert on. A condition sets the threshold that an alert must meet or exceed to create an alert. The interval specifies how frequently the rule should be evaluated. The duration, when configured, sets a period that a condition must be met or exceeded before an alert is created. Alerting rules also can contain settings for what to do when your query does not return any data, or there is an error attempting to execute the query.
|
||||
|
||||
One or more queries and/or expressions, a condition, the frequency of evaluation, and the (optional) duration that a condition must be met before creating an alert. Alerting rules are how you express the criteria for creating an alert. Queries and expressions select and can operate on the data you wish to alert on. A condition sets the threshold that an alert must meet or exceed to create an alert. The interval specifies how frequently the rule should be evaluated. The duration, when configured, sets a period that a condition must be met or exceeded before an alert is created. Alerting rules also can contain settings for what to do when your query does not return any data, or there is an error attempting to execute the query.
|
||||
|
||||
- [Create Cortex or Loki managed alert rule]({{< relref "./create-cortex-loki-managed-rule.md" >}})
|
||||
- [Create Cortex or Loki managed recording rule]({{< relref "./create-cortex-loki-managed-recording-rule.md" >}})
|
||||
- [Edit Cortex or Loki rule groups and namespaces]({{< relref "./edit-cortex-loki-namespace-group.md" >}})
|
||||
- [Create Grafana managed alert rule]({{< relref "./create-grafana-managed-rule.md" >}})
|
||||
- [State and Health of alerting rules]({{< relref "./state-and-health.md" >}})
|
||||
- [View existing alert rules and their current state]({{< relref "./rule-list.md" >}})
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
+++
|
||||
title = "Create Cortex or Loki managed recording rule"
|
||||
description = "Create Cortex or Loki managed recording rule"
|
||||
keywords = ["grafana", "alerting", "guide", "rules", "recording rules", "create"]
|
||||
weight = 400
|
||||
+++
|
||||
|
||||
# Create a Cortex or Loki managed recording rule
|
||||
|
||||
You can create and manage recording rules for an external Cortex or Loki instance. 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 both Cortex and Loki data sources to work with Grafana 8.0 alerting, enable the ruler API by configuring their respective services. The `local` rule storage type (default for Loki data source), only supports viewing of rules. If you want to edit rules, then configure one of the other rule storage types.
|
||||
|
||||
When configuring a Grafana Prometheus data source to point to Cortex, use the legacy /api/prom prefix, not /prometheus. Only single-binary mode is currently supported, provide a separate URL for the ruler API.
|
||||
|
||||
## Add a Cortex or Loki managed recording rule
|
||||
|
||||
1. Hover your cursor over the Alerting (bell) icon.
|
||||
1. Click **New alert rule**.
|
||||
1. Click on the **Alert type** drop down and select **Cortex / Loki managed recording rule**.
|
||||
1. Enter the recording rule details using instructions in the [Recording rule fields](#recording-rule-fields) section.
|
||||
1. Click **Save** in the upper right corner to save the rule.
|
||||
|
||||
## Edit a Cortex or Loki managed recording rule
|
||||
|
||||
1. Hover your cursor over the Alerting (bell) icon in the side menu.
|
||||
1. Expand an existing recording rule in the **Cortex / Loki** section and click **Edit**.
|
||||
1. Update the recording rule details using instructions in the [Recording rule fields](#recording-rule-fields) section.
|
||||
1. Click **Save and exit** to save and exit rule editing.
|
||||
|
||||
## Recording rule fields
|
||||
|
||||
This section describes the fields you fill out to create a recording rule.
|
||||
|
||||
### Rule type
|
||||
|
||||
- **Rule name -** Enter a descriptive name. The name will get displayed in the alert rule list. It will also get added as an `alertname` label to every alert instance that is created from this rule. Recording rules names must be valid [metric names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
|
||||
- **Rule type -** Select **Cortex / Loki managed recording rule**.
|
||||
- **Data source -** Select a Prometheus or Loki data source. Only data sources that support Cortex ruler API are available.
|
||||
- **Namespace -** Select an existing rule namespace or click **Add new** and enter a name to create a new one. Namespaces can contain one or more rule groups and have only organizational purpose.
|
||||
- **Group -** Select an existing group within the selected namespace or click **Add new** to create a new group. Newly created rules are added to the end of this group. Rules within a group are run sequentially at a regular interval, with the same evaluation time.
|
||||
|
||||

|
||||
|
||||
### Query
|
||||
|
||||
Enter a PromQL or LogQL expression. The result of this expression will get recorded as the value for the new metric.
|
||||
|
||||

|
||||
|
||||
|
||||
### Details
|
||||
|
||||
You can optionally define labels in the details section.
|
||||
|
||||

|
||||
@@ -7,30 +7,29 @@ weight = 400
|
||||
|
||||
# Create a Cortex or Loki managed alerting rule
|
||||
|
||||
Grafana allows you manage alerting rules for an external Cortex or Loki instance.
|
||||
Grafana allows you manage alerting rules for an external Cortex or Loki instance.
|
||||
|
||||
|
||||
In order for both Cortex and Loki data sources to work with Grafana 8.0 alerting, enable the ruler API by configuring their respective services. The`local` rule storage type, default for Loki, only supports viewing of rules. If you want to edit rules, then configure one of the other rule storage types. When configuring a Grafana Prometheus data source to point to Cortex, use the legacy `/api/prom` prefix, not `/prometheus`. Only single-binary mode is currently supported, and it is not possible to provide a separate URL for the ruler API.
|
||||
In order for both Cortex and Loki data sources to work with Grafana 8.0 alerting, enable the ruler API by configuring their respective services. The`local` rule storage type, default for Loki, only supports viewing of rules. If you want to edit rules, then configure one of the other rule storage types. When configuring a Grafana Prometheus data source to point to Cortex, use the legacy `/api/prom` prefix, not `/prometheus`. Only single-binary mode is currently supported, and it is not possible to provide a separate URL for the ruler API.
|
||||
|
||||
## Add or edit a Cortex or Loki managed alerting rule
|
||||
|
||||
1. In the Grafana menu hover your cursor over the Alerting (bell) icon.
|
||||
1. To create a new alert rule, click **New alert rule**. To edit an existing rule, expand one of the rules in the **Cortex / Loki** section and click **Edit**.
|
||||
1. Click on the **Alert type** drop down and select **Cortex / Loki managed alert**.
|
||||
1. Click on the **Rule type** drop down and select **Cortex / Loki managed alert**.
|
||||
1. Fill out the rest of the fields. Descriptions are listed below in [Alert rule fields](#alert-rule-fields).
|
||||
1. When you have finished writing your rule, click **Save** in the upper right corner to save the rule,, or **Save and exit** to save and exit rule editing.
|
||||
1. When you have finished writing your rule, click **Save** in the upper right corner to save the rule, or **Save and exit** to save and exit rule editing.
|
||||
|
||||
## Alert rule fields
|
||||
|
||||
This section describes the fields you fill out to create an alert.
|
||||
|
||||
### Alert type
|
||||
### Rule type
|
||||
|
||||
- **Alert name -** Enter a descriptive name. The name will be displayed in the alert rule list, as well as added as `alertname` label to every alert instance that is created from this rule.
|
||||
- **Alert type -** Select **Cortex / Loki managed alert**.
|
||||
- **Data source -** Select a Prometheus or Loki data source. Only Prometheus data sources that support Cortex ruler API will be available.
|
||||
- **Namespace -** Select an existing rule namespace or click **Add new** to create a new one.
|
||||
- **Group -** Select an existing group within the selected namespace or click **Add new** to create a new one. Newly created rules will be added to the end of the rule group.
|
||||
- **Rule name -** Enter a descriptive name. The name will be displayed in the alert rule list, as well as added as `alertname` label to every alert instance that is created from this rule.
|
||||
- **Rule type -** Select **Cortex / Loki managed alert**.
|
||||
- **Data source -** Select a Prometheus or Loki data source. Only Prometheus data sources that support Cortex ruler API will be available.
|
||||
- **Namespace -** Select an existing rule namespace or click **Add new** and enter a name to create a new one. Namespaces can contain one or more rule groups and have only organizational purpose.
|
||||
- **Group -** Select an existing group within the selected namespace or click **Add new** and enter a name to create a new one. Newly created rules will be added to the end of the rule group. Rules within a group are run sequentially at a regular interval, with the same evaluation time.
|
||||
|
||||

|
||||
|
||||
@@ -42,7 +41,7 @@ Enter a PromQL or LogQL expression. Rule will fire if evaluation result has at l
|
||||
|
||||
### Conditions
|
||||
|
||||
- **For -** For how long the selected condition should violated before an alert enters `Firing` state. When condition threshold is violated for the first time, an alert becomes `Pending`. If the **for** time elapses and the condition is still violated, it becomes `Firing`. Else it reverts back to `Normal`.
|
||||
- **For -** For how long the selected condition should violated before an alert enters `Firing` state. When condition threshold is violated for the first time, an alert becomes `Pending`. If the **for** time elapses and the condition is still violated, it becomes `Firing`. Else it reverts back to `Normal`.
|
||||
|
||||

|
||||
|
||||
@@ -52,11 +51,11 @@ Annotations and labels can be optionally added in the details section.
|
||||
|
||||
#### Annotations
|
||||
|
||||
Annotations are key and value pairs that provide additional meta information about the alert, for example description, summary, runbook URL. They are displayed in rule and alert details in the UI and can be used in contact type message templates. Annotations can also be templated, for example `Instance {{ $labels.instance }} down` will have the evaluated `instance` label value added for every alert this rule produces.
|
||||
Annotations are key and value pairs that provide additional meta information about the alert, for example description, summary, runbook URL. They are displayed in rule and alert details in the UI and can be used in contact type message templates. Annotations can also be templated, for example `Instance {{ $labels.instance }} down` will have the evaluated `instance` label value added for every alert this rule produces.
|
||||
|
||||
#### Labels
|
||||
|
||||
Labels are key value pairs that categorize or identify an alert. Labels are used to match alerts in silences or match and groups alerts in notification policies. Labels are also shown in rule or alert details in the UI and can be used in contact type message templates. For example, it is common to add a `severity` label and then configure a separate notification policy for each severity. Or one could add a `team` label and configure team specific notification policies, or silence all alerts for a particular team.
|
||||
Labels are key value pairs that categorize or identify an alert. Labels are used to match alerts in silences or match and groups alerts in notification policies. Labels are also shown in rule or alert details in the UI and can be used in contact type message templates. For example, it is common to add a `severity` label and then configure a separate notification policy for each severity. Or one could add a `team` label and configure team specific notification policies, or silence all alerts for a particular team.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ weight = 400
|
||||
|
||||
# Create a Grafana managed alerting rule
|
||||
|
||||
Grafana allows you to create alerting rules that query one or more data sources, reduce or transform the results and compare them to each other or to fix thresholds. These rules will be executed and notifications sent by Grafana itself.
|
||||
Grafana allows you to create alerting rules that query one or more data sources, reduce or transform the results and compare them to each other or to fix thresholds. These rules will be executed and notifications sent by Grafana itself.
|
||||
|
||||
## Add or edit a Grafana managed alerting rule
|
||||
|
||||
@@ -23,15 +23,15 @@ This section describes the fields you fill out to create an alert.
|
||||
|
||||
### Alert type
|
||||
|
||||
- **Alert name -** Enter a descriptive name. The name will be displayed in the alert rule list, as well as added as `alertname` label to every alert instance that is created from this rule.
|
||||
- **Alert type -** Select **Grafana managed alert**.
|
||||
- **Folder -** Select a folder this alert rule will belong to. To create a new folder, click on the drop down and type in a new folder name.
|
||||
- **Alert name -** Enter a descriptive name. The name will be displayed in the alert rule list, as well as added as `alertname` label to every alert instance that is created from this rule.
|
||||
- **Alert type -** Select **Grafana managed alert**.
|
||||
- **Folder -** Select a folder this alert rule will belong to. To create a new folder, click on the drop down and type in a new folder name.
|
||||
|
||||

|
||||
|
||||
### Query
|
||||
|
||||
Add one or more [queries]({{< relref "../../../panels/queries.md" >}}) or [expressions]({{< relref "../../../panels/expressions.md" >}}). You can use classic condition expression to create a rule that will trigger a single alert if it's threshold is met, or use reduce and math expressions to create a multi dimensional alert rule that can trigger multiple alerts, one per matching series in the query result.
|
||||
Add one or more [queries]({{< relref "../../../panels/queries.md" >}}) or [expressions]({{< relref "../../../panels/expressions.md" >}}). You can use classic condition expression to create a rule that will trigger a single alert if it's threshold is met, or use reduce and math expressions to create a multi dimensional alert rule that can trigger multiple alerts, one per matching series in the query result.
|
||||
|
||||
#### Rule with classic condition
|
||||
|
||||
@@ -41,7 +41,7 @@ You can use classic condition expression to create a rule that will trigger a si
|
||||
1. Add an expression. Click on **Operation** dropdown and select **Classic condition**.
|
||||
1. Add one or more conditions. For each condition you can specify operator (`AND` / `OR`), aggregation function, query letter and threshold value.
|
||||
|
||||
If a query returns multiple series, then the aggregation function and threshold check will be evaluated for each series.It will not track alert state **per series**. This has implications that are detailed in the scenario below.
|
||||
If a query returns multiple series, then the aggregation function and threshold check will be evaluated for each series.It will not track alert state **per series**. This has implications that are detailed in the scenario below.
|
||||
|
||||
- Alert condition with query that returns 2 series: **server1** and **server2**
|
||||
- **server1** series causes the alert rule to fire and switch to state `Firing`
|
||||
@@ -67,25 +67,24 @@ See or [expressions documentation]({{< relref "../../../panels/expressions.md" >
|
||||
|
||||
### Conditions
|
||||
|
||||
- **Condition -** Select the letter of the query or expression whose result will trigger the alert rule. You will likely want to select either a `classic condition` or a `math` expression.
|
||||
- **Evaluate every -** How often the rule should be evaluated, executing the defined queries and expressions. Must be no less than 10 seconds and a multiple of 10 seconds. Examples: `1m`, `30s`
|
||||
- **Evaluate for -** For how long the selected condition should violated before an alert enters `Alerting` state. When condition threshold is violated for the first time, an alert becomes `Pending`. If the **for** time elapses and the condition is still violated, it becomes `Alerting`. Else it reverts back to `Normal`.
|
||||
- **Condition -** Select the letter of the query or expression whose result will trigger the alert rule. You will likely want to select either a `classic condition` or a `math` expression.
|
||||
- **Evaluate every -** How often the rule should be evaluated, executing the defined queries and expressions. Must be no less than 10 seconds and a multiple of 10 seconds. Examples: `1m`, `30s`
|
||||
- **Evaluate for -** For how long the selected condition should violated before an alert enters `Alerting` state. When condition threshold is violated for the first time, an alert becomes `Pending`. If the **for** time elapses and the condition is still violated, it becomes `Alerting`. Else it reverts back to `Normal`.
|
||||
|
||||
#### No Data & Error handling
|
||||
|
||||
Toggle **Configure no data and error handling** switch to configure how the rule should handle cases where evaluation results in error or returns no data.
|
||||
|
||||
| No Data Option | Description |
|
||||
| --------------- | ------------------------------------------------------------------------------------------ |
|
||||
| No Data | Set alert state to `NoData` and rule state to `Normal` |
|
||||
| Alerting | Set alert rule state to `Alerting` |
|
||||
| Ok | Set alert rule state to `Normal` |
|
||||
Toggle **Configure no data and error handling** switch to configure how the rule should handle cases where evaluation results in error or returns no data.
|
||||
|
||||
| No Data Option | Description |
|
||||
| -------------- | ----------------------------------------------------------------------------------------------------------- |
|
||||
| No Data | Set alert state to `NoData` and rule state to `Normal` (notifications are not sent on NoData states). |
|
||||
| Alerting | Set alert rule state to `Alerting`. |
|
||||
| Ok | Set alert rule state to `Normal`. |
|
||||
|
||||
| Error or timeout option | Description |
|
||||
| ----------------------- | --------------------------------------------------- |
|
||||
| Alerting | Set alert rule state to `Alerting` |
|
||||
| OK | Set alert rule state to `Normal` |
|
||||
| Error or timeout option | Description |
|
||||
| ----------------------- | ---------------------------------- |
|
||||
| Alerting | Set alert rule state to `Alerting` |
|
||||
| OK | Set alert rule state to `Normal` |
|
||||
|
||||

|
||||
|
||||
@@ -95,11 +94,11 @@ Annotations and labels can be optionally added in the details section.
|
||||
|
||||
#### Annotations
|
||||
|
||||
Annotations are key and value pairs that provide additional meta information about the alert, for example description, summary, runbook URL. They are displayed in rule and alert details in the UI and can be used in contact type message templates. Annotations can also be templated, for example `Instance {{ $labels.instance }} down` will have the evaluated `instance` label value added for every alert this rule produces.
|
||||
Annotations are key and value pairs that provide additional meta information about the alert, for example description, summary, runbook URL. They are displayed in rule and alert details in the UI and can be used in contact type message templates. Annotations can also be templated, for example `Instance {{ $labels.instance }} down` will have the evaluated `instance` label value added for every alert this rule produces.
|
||||
|
||||
#### Labels
|
||||
|
||||
Labels are key value pairs that categorize or identify an alert. Labels are used to match alerts in silences or match and groups alerts in notification policies. Labels are also shown in rule or alert details in the UI and can be used in contact type message templates. For example, it is common to add a `severity` label and then configure a separate notification policy for each severity. Or one could add a `team` label and configure team specific notification policies, or silence all alerts for a particular team. Labels can also be templated like annotations, for example `{{ $labels.namespace }}/{{ $labels.job }}` will produce a new rule label that will have the evaluated `namespace` and `job` label value added for every alert this rule produces. The rule labels take precedence over the labels produced by the query/condition.
|
||||
Labels are key value pairs that categorize or identify an alert. Labels are used to match alerts in silences or match and groups alerts in notification policies. Labels are also shown in rule or alert details in the UI and can be used in contact type message templates. For example, it is common to add a `severity` label and then configure a separate notification policy for each severity. Or one could add a `team` label and configure team specific notification policies, or silence all alerts for a particular team. Labels can also be templated like annotations, for example `{{ $labels.namespace }}/{{ $labels.job }}` will produce a new rule label that will have the evaluated `namespace` and `job` label value added for every alert this rule produces. The rule labels take precedence over the labels produced by the query/condition.
|
||||
|
||||

|
||||
|
||||
@@ -107,10 +106,11 @@ Labels are key value pairs that categorize or identify an alert. Labels are use
|
||||
|
||||
The following template variables are available when expanding annotations and labels.
|
||||
|
||||
| Name | Description |
|
||||
| ------- | --------------- |
|
||||
| $labels | Labels contains the labels from the query or condition. For example, `{{ $labels.instance }}` and `{{ $labels.job }}`. |
|
||||
| $values | Values contains the values of all reduce and math expressions that were evaluated for this alert rule. For example, `{{ $values.A }}`, `{{ $values.A.Labels }}` and `{{ $values.A.Value }}` where `A` is the `refID` of the expression. |
|
||||
| Name | Description |
|
||||
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| $labels | The labels from the query or condition. For example, `{{ $labels.instance }}` and `{{ $labels.job }}`. This is unavailable when the rule uses a classic condition. |
|
||||
| $values | The values of all reduce and math expressions that were evaluated for this alert rule. For example, `{{ $values.A }}`, `{{ $values.A.Labels }}` and `{{ $values.A.Value }}` where `A` is the `refID` of the expression. This is unavailable when the rule uses a classic condition. |
|
||||
| $value | The value string of the alert instance. For example, `[ var='A' labels={instance=foo} value=10 ]`. |
|
||||
|
||||
## Preview alerts
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
+++
|
||||
title = "Edit Cortex or Loki rule groups and namespaces"
|
||||
description = "Edit Cortex or Loki rule groups and namespaces"
|
||||
keywords = ["grafana", "alerting", "guide", "group", "namespace", "cortex", "loki"]
|
||||
weight = 400
|
||||
+++
|
||||
|
||||
# Edit Cortex or Loki rule groups and namespaces
|
||||
|
||||
You can rename Cortex or Loki rule namespaces and groups and edit group evaluation intervals.
|
||||
|
||||
## Rename a namespace
|
||||
|
||||
A namespace contains one or more groups. To rename a namespace, find a group that belongs to the namespace, then update the namespace.
|
||||
|
||||
1. Hover your cursor over the Alerting (bell) icon in the side menu.
|
||||
1. Locate a group that belongs to the namespace you want to edit and click the edit (pen) icon.
|
||||
1. Enter a new name in the **Namespace** field, then click **Save changes**.
|
||||
|
||||
A new namespace is created and all groups are copied into this namespace from the old one. The old namespace is deleted.
|
||||
|
||||
## Rename rule group or change rule group evaluation interval
|
||||
|
||||
The rules within a group are run sequentially at a regular interval, the default interval is one (1) minute. You can modify this interval using the following instructions.
|
||||
|
||||
1. Hover your cursor over the Alerting (bell) icon in the side menu.
|
||||
1. Find the group you want to edit and click the edit (pen) icon.
|
||||
1. Modify the **Rule group** and **Rule group evaluation interval** information as necessary.
|
||||
1. Click **Save changes**.
|
||||
|
||||
If you remaned the group, a new group is created that has all the rules from the old group, and the old group deleted.
|
||||
|
||||

|
||||

|
||||
@@ -8,9 +8,10 @@ weight = 400
|
||||
# View alert rules
|
||||
|
||||
To view alerts:
|
||||
|
||||
1. In the Grafana menu hover your cursor over the Alerting (bell) icon.
|
||||
1. Click **Alert Rules**. You can see all configured Grafana alert rules as well as any rules from Loki or Prometheus data sources.
|
||||
By default, the group view is shown. You can toggle between group or state views by clicking the relevant **View as** buttons in the options area at the top of the page.
|
||||
1. Click **Alert Rules**. You can see all configured Grafana alert rules as well as any rules from Loki or Prometheus data sources.
|
||||
By default, the group view is shown. You can toggle between group or state views by clicking the relevant **View as** buttons in the options area at the top of the page.
|
||||
|
||||
### Group view
|
||||
|
||||
@@ -25,9 +26,10 @@ State view shows alert rules grouped by state. Use this view to get an overview
|
||||

|
||||
|
||||
## Filter alert rules
|
||||
|
||||
You can use the following filters to view only alert rules that match specific criteria:
|
||||
|
||||
- **Filter alerts by name or label -** Type an alert name, label name or value in the **Search** input.
|
||||
- **Filter alerts by label -** Search by alert labels using label selectors in the **Search** input. eg: `environment=production,region=~US|EU,severity!=warning`
|
||||
- **Filter alerts by state -** In **States** Select which alert states you want to see. All others are hidden.
|
||||
- **Filter alerts by data source -** Click the **Select data source** and select an alerting data source. Only alert rules that query selected data source will be visible.
|
||||
|
||||
@@ -39,13 +41,13 @@ A rule row shows the rule state, health, and summary annotation if the rule has
|
||||
|
||||
### Edit or delete rule
|
||||
|
||||
Grafana rules can only be edited or deleted by users with Edit permissions for the folder which contains the rule. Prometheus or Loki rules can be edited or deleted by users with Editor or Admin roles.
|
||||
Grafana rules can only be edited or deleted by users with Edit permissions for the folder which contains the rule. Prometheus or Loki rules can be edited or deleted by users with Editor or Admin roles.
|
||||
|
||||
To edit or delete a rule:
|
||||
|
||||
1. Expand this rule to reveal rule controls.
|
||||
1. Expand this rule to reveal rule controls.
|
||||
1. Click **Edit** to go to the rule editing form. Make changes following [instructions listed here]({{< relref "./create-grafana-managed-rule.md" >}}).
|
||||
1. Click **Delete"** to delete a rule.
|
||||
1. Click **Delete"** to delete a rule.
|
||||
|
||||
## Opt-out a Loki or Prometheus data source
|
||||
|
||||
|
||||
@@ -4,16 +4,22 @@ description = "State and Health of alerting rules"
|
||||
keywords = ["grafana", "alerting", "guide", "state"]
|
||||
+++
|
||||
|
||||
# State and Health of alerting rule
|
||||
|
||||
The concepts of state and health for alerting rules help you understand, at a glance, several key status indicators about your alerts. Alert state, alerting rule state, and alerting rule health are related, but they each convey subtly different information.
|
||||
|
||||
## Alerting rule state
|
||||
|
||||
Indicates whether any of the timeseries resulting from evaluation of the alerting rule are in an alerting state. Alerting rule state only requires a single alerting instance to be in a pending or firing state for the alerting rule state to not be normal.
|
||||
|
||||
- Normal: none of the timeseries returned are in an alerting state.
|
||||
- Pending: at least one of the timeseries returned are in a pending state.
|
||||
- Firing: at least one of the timeseries returned are in an alerting state.
|
||||
|
||||
## Alert state
|
||||
|
||||
Alert state is an indication of the output of the alerting evaluation engine.
|
||||
|
||||
- Normal: the condition for the alerting rule has evaluated to **false** for every timeseries returned by the evaluation engine.
|
||||
- Alerting: the condition for the alerting rule has evaluated to **true** for at least one timeseries returned by the evaluation engine and the duration, if set, **has** been met or exceeded.
|
||||
- Pending: the condition for the alerting rule has evaluated to **true** for at least one timeseries returned by the evaluation engine and the duration, if set, **has not** been met or exceeded.
|
||||
@@ -21,7 +27,9 @@ Alert state is an indication of the output of the alerting evaluation engine.
|
||||
- Error: There was an error encountered when attempting to evaluate the alerting rule.
|
||||
|
||||
## Alerting rule health
|
||||
|
||||
Indicates the status of alerting rule evaluation.
|
||||
|
||||
- Ok: the rule is being evaluated, data is being returned, and no errors have been encountered.
|
||||
- Error: an error was encountered when evaluating the alerting rule.
|
||||
- NoData: at least one of the timeseries returned during evaluation is in a NoData state.
|
||||
|
||||
@@ -17,17 +17,19 @@ Grafana alerting UI allows you to configure contact points for the Grafana manag
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. Click **Add contact point**.
|
||||
1. Enter a **Name** for the contact point
|
||||
1. Enter a **Name** for the contact point
|
||||
1. Select contact point type and fill out mandatory fields. **Optional settings** can be expanded for more options.
|
||||
1. If you'd like this contact point to notify via multiple channels, for example both email and slack, click **New contact point type** and fill out additional contact point type details.
|
||||
1. Click **Save contact point** button at the bottom of the page.
|
||||
|
||||
## Editing a contact point
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. Find the contact point you want to edit in the contact points table and click the **pen icon** on the right side.
|
||||
1. Make any changes and click **Save contact point** button at the bottom of the page.
|
||||
|
||||
## Deleting a contact point
|
||||
## Deleting a contact point
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. Find the contact point you want to edit in the contact points table and click the **trash can icon** on the right side.
|
||||
1. A confirmation dialog will open. Click **Yes, delete**.
|
||||
@@ -36,31 +38,31 @@ Grafana alerting UI allows you to configure contact points for the Grafana manag
|
||||
|
||||
## List of notifiers supported by Grafana
|
||||
|
||||
Name | Type
|
||||
-----|-----
|
||||
[DingDing](#dingdingdingtalk) | `dingding`
|
||||
[Discord](#discord) | `discord`
|
||||
[Email](#email) | `email`
|
||||
[Google Hangouts Chat](#google-hangouts-chat) | `googlechat`
|
||||
[Kafka](#kafka) | `kafka`
|
||||
Line | `line`
|
||||
Microsoft Teams | `teams`
|
||||
[Opsgenie](#opsgenie) | `opsgenie`
|
||||
[Pagerduty](#pagerduty) | `pagerduty`
|
||||
Prometheus Alertmanager | `prometheus-alertmanager`
|
||||
[Pushover](#pushover) | `pushover`
|
||||
Sensu | `sensu`
|
||||
[Sensu Go](#sensu-go) | `sensugo`
|
||||
[Slack](#slack) | `slack`
|
||||
Telegram | `telegram`
|
||||
Threema | `threema`
|
||||
VictorOps | `victorops`
|
||||
[Webhook](#webhook) | `webhook`
|
||||
[Zenduty](#zenduty) | `webhook`
|
||||
| Name | Type |
|
||||
| --------------------------------------------- | ------------------------- |
|
||||
| [DingDing](#dingdingdingtalk) | `dingding` |
|
||||
| [Discord](#discord) | `discord` |
|
||||
| [Email](#email) | `email` |
|
||||
| [Google Hangouts Chat](#google-hangouts-chat) | `googlechat` |
|
||||
| [Kafka](#kafka) | `kafka` |
|
||||
| Line | `line` |
|
||||
| Microsoft Teams | `teams` |
|
||||
| [Opsgenie](#opsgenie) | `opsgenie` |
|
||||
| [Pagerduty](#pagerduty) | `pagerduty` |
|
||||
| Prometheus Alertmanager | `prometheus-alertmanager` |
|
||||
| [Pushover](#pushover) | `pushover` |
|
||||
| Sensu | `sensu` |
|
||||
| [Sensu Go](#sensu-go) | `sensugo` |
|
||||
| [Slack](#slack) | `slack` |
|
||||
| Telegram | `telegram` |
|
||||
| Threema | `threema` |
|
||||
| VictorOps | `victorops` |
|
||||
| [Webhook](#webhook) | `webhook` |
|
||||
| [Zenduty](#zenduty) | `webhook` |
|
||||
|
||||
## Manage contact points for an external Alertmanager
|
||||
|
||||
Grafana alerting UI supports managing external Alertmanager configuration. Once you add an [Alertmanager data source]({{< relref "../../datasources/alertmanager.md" >}}), a dropdown displays at the top of the page where you can select either `Grafana` or an external Alertmanager as your data source.
|
||||
Grafana alerting UI supports managing external Alertmanager configuration. Once you add an [Alertmanager data source]({{< relref "../../datasources/alertmanager.md" >}}), a dropdown displays at the top of the page where you can select either `Grafana` or an external Alertmanager as your data source.
|
||||
|
||||
{{< figure max-width="40%" src="/static/img/docs/alerting/unified/contact-points-select-am-8-0.gif" caption="Select Alertmanager" >}}
|
||||
|
||||
@@ -68,7 +70,6 @@ Grafana alerting UI supports managing external Alertmanager configuration. Once
|
||||
|
||||
To edit global configuration options for an alertmanager, like SMTP server that is used by default for all email contact types:
|
||||
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. In the dropdown at the top of the page, select an Alertmanager data source.
|
||||
1. Click **Edit global config** button at the bottom of the page.
|
||||
|
||||
@@ -28,40 +28,40 @@ If there are string columns then those columns become labels. The name of column
|
||||
|
||||
For a MySQL table called "DiskSpace":
|
||||
|
||||
| Time | Host | Disk | PercentFree
|
||||
| ----------- | --- | -----| --------
|
||||
| 2021-June-7 | web1 | /etc | 3
|
||||
| 2021-June-7 | web2 | /var | 4
|
||||
| 2021-June-7 | web3 | /var | 8
|
||||
| ... | ... | ... | ...
|
||||
| Time | Host | Disk | PercentFree |
|
||||
| ----------- | ---- | ---- | ----------- |
|
||||
| 2021-June-7 | web1 | /etc | 3 |
|
||||
| 2021-June-7 | web2 | /var | 4 |
|
||||
| 2021-June-7 | web3 | /var | 8 |
|
||||
| ... | ... | ... | ... |
|
||||
|
||||
You can query the data filtering on time, but without returning the time series to Grafana. For example, an alert that would trigger per Host, Disk when there is less than 5% free space:
|
||||
|
||||
```sql
|
||||
SELECT Host, Disk, CASE WHEN PercentFree < 5.0 THEN PercentFree ELSE 0 END FROM (
|
||||
SELECT
|
||||
Host,
|
||||
Disk,
|
||||
Avg(PercentFree)
|
||||
SELECT
|
||||
Host,
|
||||
Disk,
|
||||
Avg(PercentFree)
|
||||
FROM DiskSpace
|
||||
Group By
|
||||
Host,
|
||||
Group By
|
||||
Host,
|
||||
Disk
|
||||
Where __timeFilter(Time)
|
||||
```
|
||||
|
||||
This query returns the following Table response to Grafana:
|
||||
|
||||
| Host | Disk | PercentFree
|
||||
| --- | -----| --------
|
||||
| web1 | /etc | 3
|
||||
| web2 | /var | 4
|
||||
| web3 | /var | 0
|
||||
| Host | Disk | PercentFree |
|
||||
| ---- | ---- | ----------- |
|
||||
| web1 | /etc | 3 |
|
||||
| web2 | /var | 4 |
|
||||
| web3 | /var | 0 |
|
||||
|
||||
When this query is used as the **condition** in an alert rule, then the non-zero will be alerting. As a result, three alert instances are produced:
|
||||
|
||||
| Labels | Status
|
||||
| ----------------------| ------
|
||||
| {Host=web1,disk=/etc} | Alerting
|
||||
| {Host=web2,disk=/var} | Alerting
|
||||
| {Host=web3,disk=/var} | Normal
|
||||
| Labels | Status |
|
||||
| --------------------- | -------- |
|
||||
| {Host=web1,disk=/etc} | Alerting |
|
||||
| {Host=web2,disk=/var} | Alerting |
|
||||
| {Host=web3,disk=/var} | Normal |
|
||||
|
||||
@@ -8,7 +8,7 @@ weight = 400
|
||||
|
||||
# Message templating
|
||||
|
||||
Notifications sent via [contact points]({{< relref "../contact-points.md" >}}) are built using templates. Grafana comes with default templates which you can customize. Grafana's notification templates are based on the [Go templating system](https://golang.org/pkg/text/template) where some fields are evaluated as text, while others are evaluated as HTML which can affect escaping. Since most of the contact point fields can be templated, you can create reusable templates and them in multiple contact points. See [template data reference]({{< relref "./template-data.md" >}}) to check what variables are available in the templates.
|
||||
Notifications sent via [contact points]({{< relref "../contact-points.md" >}}) are built using templates. Grafana comes with default templates which you can customize. Grafana's notification templates are based on the [Go templating system](https://golang.org/pkg/text/template) where some fields are evaluated as text, while others are evaluated as HTML which can affect escaping. Since most of the contact point fields can be templated, you can create reusable templates and them in multiple contact points. See [template data reference]({{< relref "./template-data.md" >}}) to check what variables are available in the templates. The default template is defined in [default_template.go](https://github.com/grafana/grafana/blob/main/pkg/services/ngalert/notifier/channels/default_template.go) which can serve as a useful reference or starting point for custom templates.
|
||||
|
||||
## Using templating in contact point fields
|
||||
|
||||
@@ -25,6 +25,7 @@ Grafana alerting UI allows you to configure templates for the Grafana managed al
|
||||
> **Note:** Currently the configuration of the embedded Alertmanager is shared across organisations. Therefore users are advised to use the new Grafana 8 Alerts only if they have one organisation otherwise templates for the Grafana managed alerts will be visible by all organizations
|
||||
|
||||
### Create a template
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. Click **Add template**.
|
||||
1. Fill in **Name** and **Content** fields.
|
||||
@@ -32,18 +33,19 @@ Grafana alerting UI allows you to configure templates for the Grafana managed al
|
||||
|
||||
**Note** The template name used to reference this template in templating is not the value of the **Name** field, but the parameter to `define` tag in the content. When creating a template you can omit `define` entirely and it will be added automatically with same value as **Name** field. It's recommended to use the same name for `define` and **Name** field to avoid confusion.
|
||||
|
||||
|
||||
<img src="/static/img/docs/alerting/unified/templates-create-8-0.png" width="600px">
|
||||
|
||||
### Edit a template
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. Find the template you want to edit in the templates table and click the **pen icon** on the right side.
|
||||
1. Make any changes and click **Save template** button at the bottom of the page.
|
||||
|
||||
### Delete a template
|
||||
|
||||
1. In the Grafana side bar, hover your cursor over the **Alerting** (bell) icon and then click **Contact points**.
|
||||
1. Find the template you want to edit in the templates table and click the **trash can icon** on the right side.
|
||||
1. A confirmation dialog will open. Click **Yes, delete**.
|
||||
1. A confirmation dialog will open. Click **Yes, delete**.
|
||||
|
||||
**Note** You are not prevented from deleting templates that are in use somewhere in contact points or other templates. Be careful!
|
||||
|
||||
@@ -51,23 +53,23 @@ Grafana alerting UI allows you to configure templates for the Grafana managed al
|
||||
|
||||
To use a template:
|
||||
|
||||
Enter `{{ template "templatename" . }}` into a contact point field, where `templatename` is the `define` parameter of a template.
|
||||
Enter `{{ template "templatename" . }}` into a contact point field, where `templatename` is the `define` parameter of a template.
|
||||
|
||||
<img src="/static/img/docs/alerting/unified/contact-points-use-template-8-0.png" width="600px">
|
||||
|
||||
|
||||
### Template examples
|
||||
|
||||
Here is an example of a template to render a single alert:
|
||||
|
||||
```
|
||||
{{ define "alert" }}
|
||||
[{{.Status}}] {{ .Labels.alertname }}
|
||||
|
||||
|
||||
Labels:
|
||||
{{ range .Labels.SortedPairs }}
|
||||
{{ .Name }}: {{ .Value }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ if gt (len .Annotations) 0 }}
|
||||
Annotations:
|
||||
{{ range .Annotations.SortedPairs }}
|
||||
@@ -85,6 +87,7 @@ Here is an example of a template to render a single alert:
|
||||
```
|
||||
|
||||
Template to render entire notification message:
|
||||
|
||||
```
|
||||
{{ define "message" }}
|
||||
{{ if gt (len .Alerts.Firing) 0 }}
|
||||
@@ -100,6 +103,6 @@ Template to render entire notification message:
|
||||
|
||||
## Manage templates for an external Alertmanager
|
||||
|
||||
Grafana alerting UI supports managing external Alertmanager configuration. Once you add an [Alertmanager data source]({{< relref "../../../datasources/alertmanager.md" >}}), a dropdown displays at the top of the page, allowing you to select either `Grafana` or an external Alertmanager data source.
|
||||
Grafana alerting UI supports managing external Alertmanager configuration. Once you add an [Alertmanager data source]({{< relref "../../../datasources/alertmanager.md" >}}), a dropdown displays at the top of the page, allowing you to select either `Grafana` or an external Alertmanager data source.
|
||||
|
||||
{{< figure max-width="40%" src="/static/img/docs/alerting/unified/contact-points-select-am-8-0.gif" caption="Select Alertmanager" >}}
|
||||
|
||||
@@ -3,41 +3,40 @@ title = "Template data"
|
||||
keywords = ["grafana", "alerting", "guide", "contact point", "templating"]
|
||||
+++
|
||||
|
||||
|
||||
# Template data
|
||||
|
||||
Template data is passed on to [message templates]({{< relref "./_index.md" >}}) as well as sent as payload to webhook pushes.
|
||||
|
||||
Name | Type | Notes
|
||||
------------------|----------|-----------------------------------------------------------------
|
||||
Receiver | string | Name of the contact point that the notification is being sent to.
|
||||
Status | string | `firing` if at least one alert is firing, otherwise `resolved`.
|
||||
Alerts | Alert | List of alert objects that are included in this notification (see below).
|
||||
GroupLabels | KeyValue | Labels these alerts were grouped by.
|
||||
CommonLabels | KeyValue | Labels common to all the alerts included in this notification.
|
||||
CommonAnnotations | KeyValue | Annotations common to all the alerts included in this notification.
|
||||
ExternalURL | string | Back link to the Grafana that sent the notification. If using external Alertmanager, back link to this Alertmanager.
|
||||
| Name | Type | Notes |
|
||||
| ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
|
||||
| Receiver | string | Name of the contact point that the notification is being sent to. |
|
||||
| Status | string | `firing` if at least one alert is firing, otherwise `resolved`. |
|
||||
| Alerts | Alert | List of alert objects that are included in this notification (see below). |
|
||||
| GroupLabels | KeyValue | Labels these alerts were grouped by. |
|
||||
| CommonLabels | KeyValue | Labels common to all the alerts included in this notification. |
|
||||
| CommonAnnotations | KeyValue | Annotations common to all the alerts included in this notification. |
|
||||
| ExternalURL | string | Back link to the Grafana that sent the notification. If using external Alertmanager, back link to this Alertmanager. |
|
||||
|
||||
The `Alerts` type exposes functions for filtering alerts:
|
||||
|
||||
* `Alerts.Firing` returns a list of firing alerts.
|
||||
* `Alerts.Resolved` returns a list of resolved alerts.
|
||||
- `Alerts.Firing` returns a list of firing alerts.
|
||||
- `Alerts.Resolved` returns a list of resolved alerts.
|
||||
|
||||
## Alert
|
||||
|
||||
Name | Type | Notes
|
||||
-------------|-----------|---------------------------------------------------------------------
|
||||
Status | string | `firing` or `resolved`.
|
||||
Labels | KeyValue | A set of labels attached to the alert.
|
||||
Annotations | KeyValue | A set of annotations attached to the alert.
|
||||
StartsAt | time.Time | Time the alert started firing.
|
||||
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 back link to Grafana or external Alertmanager.
|
||||
SilenceURL | string | Link to grafana silence for with labels for this alert pre-filled. Only for Grafana managed alerts.
|
||||
DashboardURL | string | Link to grafana dashboard, if alert rule belongs to one. Only for Grafana managed alerts.
|
||||
PanelURL | string | Link to grafana dashboard panel, if alert rule belongs to one. Only for Grafana managed alerts.
|
||||
Fingerprint | string | Fingerprint that can be used to identify the alert.
|
||||
ValueString | string | A string that contains the labels and value of each reduced expression in the alert.
|
||||
| Name | Type | Notes |
|
||||
| ------------ | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Status | string | `firing` or `resolved`. |
|
||||
| Labels | KeyValue | A set of labels attached to the alert. |
|
||||
| Annotations | KeyValue | A set of annotations attached to the alert. |
|
||||
| StartsAt | time.Time | Time the alert started firing. |
|
||||
| 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 back link to Grafana or external Alertmanager. |
|
||||
| SilenceURL | string | Link to grafana silence for with labels for this alert pre-filled. Only for Grafana managed alerts. |
|
||||
| DashboardURL | string | Link to grafana dashboard, if alert rule belongs to one. Only for Grafana managed alerts. |
|
||||
| PanelURL | string | Link to grafana dashboard panel, if alert rule belongs to one. Only for Grafana managed alerts. |
|
||||
| Fingerprint | string | Fingerprint that can be used to identify the alert. |
|
||||
| ValueString | string | A string that contains the labels and value of each reduced expression in the alert. |
|
||||
|
||||
## KeyValue
|
||||
|
||||
@@ -54,23 +53,23 @@ Here is an example containing two annotations:
|
||||
|
||||
In addition to direct access of data (labels and annotations) stored as KeyValue, there are also methods for sorting, removing and transforming.
|
||||
|
||||
Name | Arguments | Returns | Notes
|
||||
------------|-----------|-----------------------------------------|----------------
|
||||
SortedPairs | | Sorted list of key & value string pairs |
|
||||
Remove | []string | KeyValue | Returns a copy of the Key/Value map without the given keys.
|
||||
Names | | []string | List of label names
|
||||
Values | | []string | List of label values
|
||||
| Name | Arguments | Returns | Notes |
|
||||
| ----------- | --------- | --------------------------------------- | ----------------------------------------------------------- |
|
||||
| SortedPairs | | Sorted list of key & value string pairs |
|
||||
| Remove | []string | KeyValue | Returns a copy of the Key/Value map without the given keys. |
|
||||
| Names | | []string | List of label names |
|
||||
| Values | | []string | List of label values |
|
||||
|
||||
## Functions
|
||||
|
||||
Some functions to transform values are also available, along with [default functions provided by Go templating](https://golang.org/pkg/text/template/#hdr-Functions).
|
||||
|
||||
Name | Arguments | Returns
|
||||
-------------|------------------------------|----------------------------------------------
|
||||
title | string | Capitalizes first character of each word.
|
||||
toUpper | string | Converts all characters to upper case.
|
||||
match | pattern, string | Match a string using RegExp.
|
||||
reReplaceAll | pattern, replacement, string | RegExp substitution, unanchored.
|
||||
join | string, []string | Concatenates the elements of the second argument to create a single string. First argument is the separator.
|
||||
safeHtml | string | Marks string as HTML, not requiring auto-escaping.
|
||||
stringSlice | ...string | Returns passed strings as slice of strings.
|
||||
| Name | Arguments | Returns |
|
||||
| ------------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| title | string | Capitalizes first character of each word. |
|
||||
| toUpper | string | Converts all characters to upper case. |
|
||||
| match | pattern, string | Match a string using RegExp. |
|
||||
| reReplaceAll | pattern, replacement, string | RegExp substitution, unanchored. |
|
||||
| join | string, []string | Concatenates the elements of the second argument to create a single string. First argument is the separator. |
|
||||
| safeHtml | string | Marks string as HTML, not requiring auto-escaping. |
|
||||
| stringSlice | ...string | Returns passed strings as slice of strings. |
|
||||
|
||||
@@ -20,7 +20,7 @@ To access notification policy editing page, In the Grafana side bar, hover your
|
||||
### Edit root notification policy
|
||||
|
||||
1. Click **edit** button on the top right of the root policy box.
|
||||
1. Make changes and click **save** button.
|
||||
1. Make changes and click **save** button.
|
||||
|
||||
### Add new specific policy
|
||||
|
||||
@@ -32,7 +32,6 @@ To add a nested policy to an existing specific policy, expand the parent policy
|
||||
|
||||
To edit a specific policy, find it in the specific routing table and click **Edit** button. Make your changes and click **Save policy**.
|
||||
|
||||
|
||||
### Root policy fields
|
||||
|
||||
- **Default contact point -** The [contact point]({{< relref "./contact-points.md" >}}) to send notifications to that did not match any specific policy.
|
||||
@@ -44,16 +43,14 @@ Group timing options
|
||||
- **Group interval -** - How long to wait before sending an notification when an alert has been added to a group for which there has already been a notification. Default is 5 minutes.
|
||||
- **Repeat interval -** - How long to wait before re-sending a notification after one has already been sent and no new alerts were added to the group. Default is 4 hours.
|
||||
|
||||
|
||||
### Specific policy fields
|
||||
|
||||
- **Contact point -** The [contact point]({{< relref "./contact-points.md" >}}) to send notification to if alert matched this specific policy but did not match any of it's nested policies, or there were no nested specific policies.
|
||||
- **Matching labels -** Rules for matching alert labels. See ["How label matching works"](#how-label-matching-works) below for details.
|
||||
- **Continue matching subsequent sibling nodes -** If not enabled and an alert matches this policy but not any of it's nested policies, matching will stop and a notification will be sent to the contact point defined on this policy. If enabled, notification will be sent but alert will continue matching subsequent siblings of this policy, thus sending more than one notification. Use this if for example you want to send notification to a catch-all contact point as well as to one of more specific contact points handled by subsequent policies.
|
||||
- **Override grouping** - Toggle if you want to override grouping for this policy. If toggled, you will be able to specify grouping same as for root policy described above. If not toggled, root policy grouping will be used.
|
||||
- **Continue matching subsequent sibling nodes -** If not enabled and an alert matches this policy but not any of it's nested policies, matching will stop and a notification will be sent to the contact point defined on this policy. If enabled, notification will be sent but alert will continue matching subsequent siblings of this policy, thus sending more than one notification. Use this if for example you want to send notification to a catch-all contact point as well as to one of more specific contact points handled by subsequent policies.
|
||||
- **Override grouping** - Toggle if you want to override grouping for this policy. If toggled, you will be able to specify grouping same as for root policy described above. If not toggled, root policy grouping will be used.
|
||||
- **Override group timings** Toggle if you want to override group timings for this policy. If toggled, you will be able to specify group timings same as for root policy described above. If not toggled, root policy group timings will be used.
|
||||
|
||||
|
||||
### How label matching works
|
||||
|
||||
A policy will match an alert if alert's labels match all of the "Matching Labels" specified on the policy.
|
||||
@@ -63,15 +60,14 @@ A policy will match an alert if alert's labels match all of the "Matching Labels
|
||||
- The **Regex** checkbox specifies if the inputted **Value** should be matched against labels as a regular expression. The regular expression is always anchored. If not selected it is an exact string match.
|
||||
- The **Equal** checkbox specifies if the match should include alert instances that match or do not match. If not checked, the silence includes alert instances _do not_ match.
|
||||
|
||||
|
||||
## Example setup
|
||||
|
||||
One usage example would be:
|
||||
* Create a "default" contact point for most alerts with a non invasive contact point type, like a slack message, and set it on root policy
|
||||
* Edit root policy grouping to group alerts by `cluster`, `namespace` and `alertname` so you get a notification per alert rule and specific k8s cluster & namespace.
|
||||
* Create specific route for alerts coming from development cluster with an appropriate contact point
|
||||
* Create a specific route for alerts with "critical" severity with a more invasive contact point type, like pager duty notification
|
||||
* Create specific routes for particular teams that handle their own onduty rotations
|
||||
|
||||
- Create a "default" contact point for most alerts with a non invasive contact point type, like a slack message, and set it on root policy
|
||||
- Edit root policy grouping to group alerts by `cluster`, `namespace` and `alertname` so you get a notification per alert rule and specific k8s cluster & namespace.
|
||||
- Create specific route for alerts coming from development cluster with an appropriate contact point
|
||||
- Create a specific route for alerts with "critical" severity with a more invasive contact point type, like pager duty notification
|
||||
- Create specific routes for particular teams that handle their own onduty rotations
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ weight = 128
|
||||
|
||||
Setting the `ngalert` feature toggle enables the new Grafana 8 alerting system.
|
||||
|
||||
>**Note:** We recommend that you backup Grafana's database before enabling this feature. If you are using PostgreSQL as the backend data source, then the minimum required version is 9.5.
|
||||
> **Note:** We recommend that you backup Grafana's database before enabling this feature. If you are using PostgreSQL as the backend data source, then the minimum required version is 9.5.
|
||||
|
||||
At startup, when [the feature toggle is enabled]({{< relref "../../administration/configuration.md">}}#feature_toggles), the legacy Grafana dashboard alerting is disabled and existing dashboard alerts are migrated into a format that is compatible with the Grafana 8 alerting system. You can view these migrated rules, alongside any new alerts you create after the migration, from the Alerting page of your Grafana instance.
|
||||
|
||||
>**Note:** Since the new system stores the notification log and silences on disk, we require the use of persistent disks for using Grafana 8 alerts. Otherwise, the silences and notification log will get lost on a restart, and you might get unwanted or duplicate notifications.
|
||||
> **Note:** Since the new system stores the notification log and silences on disk, we require the use of persistent disks for using Grafana 8 alerts. Otherwise, the silences and notification log will get lost on a restart, and you might get unwanted or duplicate notifications.
|
||||
|
||||
Read and write access to dashboard alerts in Grafana versions 7 and earlier were governed by the dashboard and folder permissions under which the alerts were stored. In Grafana 8, alerts are stored in folders and inherit the permissions of those folders. During the migration, dashboard alert permissions are matched to the new rules permissions as follows:
|
||||
|
||||
@@ -20,7 +20,7 @@ Read and write access to dashboard alerts in Grafana versions 7 and earlier were
|
||||
- If there are no dashboard permissions and the dashboard is under a folder, then the rule is linked to this folder and inherits its permissions.
|
||||
- If there are no dashboard permissions and the dashboard is under the General folder, then the rule is linked to the `General Alerting` folder and the rule inherits the default permissions.
|
||||
|
||||
During beta, Grafana 8 alerting system can retrieve rules from all available Prometheus, Loki, and Alertmanager data sources. It might not be able to fetch rules from all other supported data sources at this time.
|
||||
During beta, Grafana 8 alerting system can retrieve rules from all available Prometheus, Loki, and Alertmanager data sources. It might not be able to fetch rules from all other supported data sources at this time.
|
||||
|
||||
Also notification channels are migrated to an Alertmanager configuration with the appropriate routes and receivers. Default notification channels are added as contact points to the default route. Notification channels not associated with any Dashboard alert go to the `autogen-unlinked-channel-recv` route.
|
||||
|
||||
@@ -28,6 +28,7 @@ Since `Hipchat` and `Sensu` are discontinued, they are not migrated to the new a
|
||||
Finally, silences (expiring after one year) are created for all paused dashboard alerts.
|
||||
|
||||
## Disabling Grafana 8 Alerting after migration
|
||||
|
||||
To disable Grafana 8 Alerting, remove or disable the `ngalert` feature toggle. Dashboard alerts will be re-enabled and any alerts created during or after the migration are deleted.
|
||||
|
||||
>**Note:** Any alerting rules created in the Grafana 8 Alerting system will be lost when migrating back to dashboard alerts
|
||||
> **Note:** Any alerting rules created in the Grafana 8 Alerting system will be lost when migrating back to dashboard alerts
|
||||
|
||||
@@ -23,7 +23,7 @@ To add a silence:
|
||||
1. Click the **New Silence** button.
|
||||
1. Select the start and end date in **Silence start and end** to indicate when the silence should go into effect and expire.
|
||||
1. Optionally, update the **Duration** to alter the time for the end of silence in the previous step to correspond to the start plus the duration.
|
||||
1. Enter one or more *Matching Labels* by filling out the **Name** and **Value** fields. Matchers determine which rules the silence will apply to.
|
||||
1. Enter one or more _Matching Labels_ by filling out the **Name** and **Value** fields. Matchers determine which rules the silence will apply to.
|
||||
1. Enter a **Comment**.
|
||||
1. Enter the name of the owner in **Creator**.
|
||||
1. Click **Create**.
|
||||
@@ -46,12 +46,12 @@ Alert instances that have labels that match all of the "Matching Labels" specifi
|
||||
|
||||
## Manage silences for an external Alertmanager
|
||||
|
||||
Grafana alerting UI supports managing external Alertmanager silences. Once you add an [Alertmanager data source]({{< relref "../../datasources/alertmanager.md" >}}), a dropdown displays at the top of the page where you can select either `Grafana` or an external Alertmanager as your data source.
|
||||
Grafana alerting UI supports managing external Alertmanager silences. Once you add an [Alertmanager data source]({{< relref "../../datasources/alertmanager.md" >}}), a dropdown displays at the top of the page where you can select either `Grafana` or an external Alertmanager as your data source.
|
||||
|
||||
## Create a URL to silence form with defaults filled in
|
||||
|
||||
When linking to silence form, you can provide default matching labels and comment via `matchers` and `comment` query parameters. `matchers` expects one more matching labels of type `[label][operator][value]` joined by a comma. `operator` can be one of `=` (equals, not regex), `!=` (not equals, not regex), `=~` (equals, regex), `!~` (not equals, not regex).
|
||||
When linking to a silence form, provide the default matching labels and comment via `matchers` and `comment` query parameters. The `matchers` parameter requires one more matching labels of the type `[label][operator][value]` joined by a comma while the `operator` parameter can be one of the following: `=` (equals, not regex), `!=` (not equals, not regex), `=~` (equals, regex), `!~` (not equals, regex).
|
||||
|
||||
For example, to link to silence form with matching labels `severity=critical` & `cluster!~europe-.*` and comment `Silence critical EU alerts`, create a URL `https://mygrafana/aleting/silence/new?matchers=severity%3Dcritical%2Ccluster!~europe-*&comment=Silence%20critical%20EU%20alert`.
|
||||
For example, to link to silence form with matching labels `severity=critical` & `cluster!~europe-.*` and comment `Silence critical EU alerts`, create a URL `https://mygrafana/aleting/silence/new?matchers=severity%3Dcritical%2Ccluster!~europe-*&comment=Silence%20critical%20EU%20alert`.
|
||||
|
||||
To link to a new silence page for an [external Alertmanager]({{< relref "../../datasources/alertmanager.md" >}}), add a `alertmanager` query parameter with the Alertmanager data source name.
|
||||
|
||||
@@ -12,14 +12,14 @@ Here is a table showing all supported authentication providers and the features
|
||||
|
||||
See also, [Grafana Authentication]({{< relref "grafana.md" >}}).
|
||||
|
||||
Provider | Support | Role mapping | Team sync<br> *(Enterprise only)* | Active sync<br> *(Enterprise only)*
|
||||
-------- | :-----: | :----------: | :-------: | :---------:
|
||||
[Auth Proxy]({{< relref "auth-proxy.md" >}}) | v2.1+ | - | v6.3+ | -
|
||||
[Azure AD OAuth]({{< relref "azuread.md" >}}) | v6.7+ | v6.7+ | v6.7+ | -
|
||||
[Generic OAuth]({{< relref "generic-oauth.md" >}}) | v4.0+ | v6.5+ | - | -
|
||||
[GitHub OAuth]({{< relref "github.md" >}}) | v2.0+ | - | v6.3+ | -
|
||||
[GitLab OAuth]({{< relref "gitlab.md" >}}) | v5.3+ | - | v6.4+ | -
|
||||
[Google OAuth]({{< relref "google.md" >}}) | v2.0+ | - | - | -
|
||||
[LDAP]({{< relref "ldap.md" >}}) | v2.1+ | v2.1+ | v5.3+ | v6.3+
|
||||
[Okta OAuth]({{< relref "okta.md" >}}) | v7.0+ | v7.0+ | v7.0+ | -
|
||||
[SAML]({{< relref "../enterprise/saml.md" >}}) (Enterprise only) | v6.3+ | v7.0+ | v7.0+ | -
|
||||
| Provider | Support | Role mapping | Team sync<br> _(Enterprise only)_ | Active sync<br> _(Enterprise only)_ |
|
||||
| ---------------------------------------------------------------- | :-----: | :----------: | :-------------------------------: | :---------------------------------: |
|
||||
| [Auth Proxy]({{< relref "auth-proxy.md" >}}) | v2.1+ | - | v6.3+ | - |
|
||||
| [Azure AD OAuth]({{< relref "azuread.md" >}}) | v6.7+ | v6.7+ | v6.7+ | - |
|
||||
| [Generic OAuth]({{< relref "generic-oauth.md" >}}) | v4.0+ | v6.5+ | - | - |
|
||||
| [GitHub OAuth]({{< relref "github.md" >}}) | v2.0+ | - | v6.3+ | - |
|
||||
| [GitLab OAuth]({{< relref "gitlab.md" >}}) | v5.3+ | - | v6.4+ | - |
|
||||
| [Google OAuth]({{< relref "google.md" >}}) | v2.0+ | - | - | - |
|
||||
| [LDAP]({{< relref "ldap.md" >}}) | v2.1+ | v2.1+ | v5.3+ | v6.3+ |
|
||||
| [Okta OAuth]({{< relref "okta.md" >}}) | v7.0+ | v7.0+ | v7.0+ | - |
|
||||
| [SAML]({{< relref "../enterprise/saml.md" >}}) (Enterprise only) | v6.3+ | v7.0+ | v7.0+ | - |
|
||||
|
||||
@@ -30,7 +30,7 @@ sync_ttl = 60
|
||||
# Example `whitelist = 192.168.1.1, 192.168.1.0/24, 2001::23, 2001::0/120`
|
||||
whitelist =
|
||||
# Optionally define more headers to sync other user attributes
|
||||
# Example `headers = Name:X-WEBAUTH-NAME Email:X-WEBAUTH-EMAIL Groups:X-WEBAUTH-GROUPS`
|
||||
# Example `headers = Name:X-WEBAUTH-NAME Role:X-WEBAUTH-ROLE Email:X-WEBAUTH-EMAIL Groups:X-WEBAUTH-GROUPS`
|
||||
headers =
|
||||
# Check out docs on this for more details on the below setting
|
||||
enable_login_token = false
|
||||
@@ -73,7 +73,6 @@ I’ll demonstrate how to use Apache for authenticating users. In this example w
|
||||
|
||||
In this example we use Apache as a reverse proxy in front of Grafana. Apache handles the Authentication of users before forwarding requests to the Grafana backend service.
|
||||
|
||||
|
||||
#### Apache configuration
|
||||
|
||||
```bash
|
||||
@@ -107,11 +106,11 @@ In this example we use Apache as a reverse proxy in front of Grafana. Apache han
|
||||
|
||||
- We use a **\<proxy>** configuration block for applying our authentication rules to every proxied request. These rules include requiring basic authentication where user:password credentials are stored in the **/etc/apache2/grafana_htpasswd** file. This file can be created with the `htpasswd` command.
|
||||
|
||||
- The next part of the configuration is the tricky part. We use Apache’s rewrite engine to create our **X-WEBAUTH-USER header**, populated with the authenticated user.
|
||||
- The next part of the configuration is the tricky part. We use Apache’s rewrite engine to create our **X-WEBAUTH-USER header**, populated with the authenticated user.
|
||||
|
||||
- **RewriteRule .* - [E=PROXY_USER:%{LA-U:REMOTE_USER}, NS]**: This line is a little bit of magic. What it does, is for every request use the rewriteEngines look-ahead (LA-U) feature to determine what the REMOTE_USER variable would be set to after processing the request. Then assign the result to the variable PROXY_USER. This is necessary as the REMOTE_USER variable is not available to the RequestHeader function.
|
||||
- **RewriteRule .\* - [E=PROXY_USER:%{LA-U:REMOTE_USER}, NS]**: This line is a little bit of magic. What it does, is for every request use the rewriteEngines look-ahead (LA-U) feature to determine what the REMOTE_USER variable would be set to after processing the request. Then assign the result to the variable PROXY_USER. This is necessary as the REMOTE_USER variable is not available to the RequestHeader function.
|
||||
|
||||
- **RequestHeader set X-WEBAUTH-USER “%{PROXY_USER}e”**: With the authenticated username now stored in the PROXY_USER variable, we create a new HTTP request header that will be sent to our backend Grafana containing the username.
|
||||
- **RequestHeader set X-WEBAUTH-USER “%{PROXY_USER}e”**: With the authenticated username now stored in the PROXY_USER variable, we create a new HTTP request header that will be sent to our backend Grafana containing the username.
|
||||
|
||||
- The **RequestHeader unset Authorization** removes the Authorization header from the HTTP request before it is forwarded to Grafana. This ensures that Grafana does not try to authenticate the user using these credentials (BasicAuth is a supported authentication handler in Grafana).
|
||||
|
||||
@@ -204,15 +203,15 @@ ProxyPassReverse / http://grafana:3000/
|
||||
|
||||
- Create a htpasswd file. We create a new user **anthony** with the password **password**
|
||||
|
||||
```bash
|
||||
htpasswd -bc htpasswd anthony password
|
||||
```
|
||||
```bash
|
||||
htpasswd -bc htpasswd anthony password
|
||||
```
|
||||
|
||||
- Launch the httpd container using our custom httpd.conf and our htpasswd file. The container will listen on port 80, and we create a link to the **grafana** container so that this container can resolve the hostname **grafana** to the Grafana container’s IP address.
|
||||
|
||||
```bash
|
||||
docker run -i -p 80:80 --link grafana:grafana -v $(pwd)/httpd.conf:/usr/local/apache2/conf/httpd.conf -v $(pwd)/htpasswd:/tmp/htpasswd httpd:2.4
|
||||
```
|
||||
```bash
|
||||
docker run -i -p 80:80 --link grafana:grafana -v $(pwd)/httpd.conf:/usr/local/apache2/conf/httpd.conf -v $(pwd)/htpasswd:/tmp/htpasswd httpd:2.4
|
||||
```
|
||||
|
||||
### Use grafana.
|
||||
|
||||
@@ -224,7 +223,7 @@ With our Grafana and Apache containers running, you can now connect to http://lo
|
||||
|
||||
With Team Sync, it's possible to set up synchronization between teams in your authentication provider and Grafana. You can send Grafana values as part of an HTTP header and have Grafana map them to your team structure. This allows you to put users into specific teams automatically.
|
||||
|
||||
To support the feature, auth proxy allows optional headers to map additional user attributes. The specific attribute to support team sync is `Groups`.
|
||||
To support the feature, auth proxy allows optional headers to map additional user attributes. The specific attribute to support team sync is `Groups`.
|
||||
|
||||
```bash
|
||||
# Optionally define more headers to sync other user attributes
|
||||
@@ -293,7 +292,6 @@ With this, the user `leonard` will be automatically placed into the Loki team as
|
||||
|
||||
[Learn more about Team Sync]({{< relref "team-sync.md" >}})
|
||||
|
||||
|
||||
## Login token and session cookie
|
||||
|
||||
With `enable_login_token` set to `true` Grafana will, after successful auth proxy header validation, assign the user
|
||||
|
||||
@@ -7,84 +7,83 @@ weight = 700
|
||||
|
||||
# Azure AD OAuth2 authentication
|
||||
|
||||
> Only available in Grafana v6.7+
|
||||
The Azure AD authentication allows you to use an Azure Active Directory tenant as an identity provider for Grafana. You can use Azure AD Application Roles to assign users and groups to Grafana roles from the Azure Portal. This topic has the following sections:
|
||||
|
||||
The Azure AD authentication allows you to use an Azure Active Directory tenant as an identity provider for Grafana. You can use Azure AD Application Roles to assign users and groups to Grafana roles from the Azure Portal.
|
||||
- [Create the Azure AD application](#create-the-azure-ad-application)
|
||||
- [Enable Azure AD OAuth in Grafana](#enable-azure-ad-oauth-in-grafana)
|
||||
|
||||
## Create the Azure AD application
|
||||
|
||||
To enable the Azure AD OAuth2 you must register your application with Azure AD.
|
||||
To enable the Azure AD OAuth2, register your application with Azure AD.
|
||||
|
||||
1. Log in to [Azure Portal](https://portal.azure.com) and click **Azure Active Directory** in the side menu. If you have access to more than one tenant, select your account in the upper right. Set your session to the Azure AD tenant you wish to use.
|
||||
1. Log in to [Azure Portal](https://portal.azure.com), then click **Azure Active Directory** in the side menu.
|
||||
|
||||
1. Under **Manage** in the side menu, click **App Registrations** and then **New Registration**. Provide a fitting name.
|
||||
1. If you have access to more than one tenant, select your account in the upper right. Set your session to the Azure AD tenant you wish to use.
|
||||
|
||||
1. Under **Redirect URI**, select **Web** as the app type.
|
||||
1. Under **Manage** in the side menu, click **App Registrations** > **New Registration**. Enter a descriptive name.
|
||||
|
||||
1. Add the redirect URL `https://<grafana domain>/login/azuread`, then click **Register**.
|
||||
1. Under **Redirect URI**, select the app type **Web**.
|
||||
|
||||
1. The app's **Overview** page is displayed. Note the **Application ID**. This is the OAuth client ID.
|
||||
1. Add the following redirect URLs `https://<grafana domain>/login/azuread` and `https://<grafana domain>` then click **Register**. The app's **Overview** page opens.
|
||||
|
||||
1. Note the **Application ID**. This is the OAuth client ID.
|
||||
|
||||
1. Click **Endpoints** from the top menu.
|
||||
|
||||
- Note the **OAuth 2.0 authorization endpoint (v2)**. This is the auth URL.
|
||||
- Note the **OAuth 2.0 authorization endpoint (v2)** URL. This is the authorization URL.
|
||||
- Note the **OAuth 2.0 token endpoint (v2)**. This is the token URL.
|
||||
|
||||
1. Click **Certificates & secrets** and then add a new entry under **Client secrets**.
|
||||
1. Click **Certificates & secrets**, then add a new entry under **Client secrets** with the following configuration.
|
||||
|
||||
- Description: Grafana OAuth
|
||||
- Expires: Never
|
||||
|
||||
1. Click **Add**, and then copy the key value. This is the OAuth client secret.
|
||||
1. Click **Add** then copy the key value. This is the OAuth client secret.
|
||||
|
||||
1. Click **Manifest**.
|
||||
1. Click **Manifest**, then define the required Application Role values for Grafana: Viewer, Editor, or Admin. If not defined, all users will have the Viewer role. Every role requires a unique ID which you can generate on Linux with `uuidgen`, and on Windows through Microsoft PowerShell with `New-Guid`.
|
||||
|
||||
- Define the required Application Role values for Grafana: Viewer, Editor, Admin. Otherwise, all users will have the Viewer role.
|
||||
- Every role requires a unique ID.
|
||||
- Generate the unique ID on Linux with `uuidgen`, and on Windows through Microsoft
|
||||
PowerShell with `New-Guid`.
|
||||
- Include the unique ID in the configuration file:
|
||||
1. Include the unique ID in the configuration file:
|
||||
|
||||
```json
|
||||
"appRoles": [
|
||||
{
|
||||
"allowedMemberTypes": [
|
||||
"User"
|
||||
],
|
||||
"description": "Grafana admin Users",
|
||||
"displayName": "Grafana Admin",
|
||||
"id": "SOME_UNIQUE_ID",
|
||||
"isEnabled": true,
|
||||
"lang": null,
|
||||
"origin": "Application",
|
||||
"value": "Admin"
|
||||
},
|
||||
{
|
||||
"allowedMemberTypes": [
|
||||
"User"
|
||||
],
|
||||
"description": "Grafana read only Users",
|
||||
"displayName": "Grafana Viewer",
|
||||
"id": "SOME_UNIQUE_ID",
|
||||
"isEnabled": true,
|
||||
"lang": null,
|
||||
"origin": "Application",
|
||||
"value": "Viewer"
|
||||
},
|
||||
{
|
||||
"allowedMemberTypes": [
|
||||
"User"
|
||||
],
|
||||
"description": "Grafana Editor Users",
|
||||
"displayName": "Grafana Editor",
|
||||
"id": "SOME_UNIQUE_ID",
|
||||
"isEnabled": true,
|
||||
"lang": null,
|
||||
"origin": "Application",
|
||||
"value": "Editor"
|
||||
}
|
||||
],
|
||||
```
|
||||
```json
|
||||
"appRoles": [
|
||||
{
|
||||
"allowedMemberTypes": [
|
||||
"User"
|
||||
],
|
||||
"description": "Grafana admin Users",
|
||||
"displayName": "Grafana Admin",
|
||||
"id": "SOME_UNIQUE_ID",
|
||||
"isEnabled": true,
|
||||
"lang": null,
|
||||
"origin": "Application",
|
||||
"value": "Admin"
|
||||
},
|
||||
{
|
||||
"allowedMemberTypes": [
|
||||
"User"
|
||||
],
|
||||
"description": "Grafana read only Users",
|
||||
"displayName": "Grafana Viewer",
|
||||
"id": "SOME_UNIQUE_ID",
|
||||
"isEnabled": true,
|
||||
"lang": null,
|
||||
"origin": "Application",
|
||||
"value": "Viewer"
|
||||
},
|
||||
{
|
||||
"allowedMemberTypes": [
|
||||
"User"
|
||||
],
|
||||
"description": "Grafana Editor Users",
|
||||
"displayName": "Grafana Editor",
|
||||
"id": "SOME_UNIQUE_ID",
|
||||
"isEnabled": true,
|
||||
"lang": null,
|
||||
"origin": "Application",
|
||||
"value": "Editor"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
1. Go to **Azure Active Directory** and then to **Enterprise Applications**. Search for your application and click on it.
|
||||
|
||||
@@ -94,7 +93,7 @@ To enable the Azure AD OAuth2 you must register your application with Azure AD.
|
||||
|
||||
1. Add the following to the [Grafana configuration file]({{< relref "../administration/configuration.md#config-file-locations" >}}):
|
||||
|
||||
```ini
|
||||
```
|
||||
[auth.azuread]
|
||||
name = Azure AD
|
||||
enabled = true
|
||||
@@ -108,42 +107,45 @@ allowed_domains =
|
||||
allowed_groups =
|
||||
```
|
||||
|
||||
**Note:** Ensure that the [root_url]({{< relref "../administration/configuration/#root-url" >}}) in Grafana is set in your Azure Application Reply URLs (**App** -> **Settings** -> **Reply URLs**)
|
||||
You can also use these environment variables to configure **client_id** and **client_secret**:
|
||||
|
||||
```
|
||||
GF_AUTH_AZUREAD_CLIENT_ID
|
||||
GF_AUTH_AZUREAD_CLIENT_SECRET
|
||||
```
|
||||
|
||||
**Note:** Verify that the Grafana [root_url]({{< relref "../administration/configuration/#root-url" >}}) is set in your Azure Application Redirect URLs.
|
||||
|
||||
### Configure allowed groups
|
||||
|
||||
To limit access to authenticated users who are members of one or more groups, set `allowed_groups`
|
||||
to a comma- or space-separated list of group object IDs. You can find object IDs for a specific group on the Azure portal:
|
||||
|
||||
1. Go to **Azure Active Directory -> Groups**.
|
||||
1. Go to **Azure Active Directory -> Groups**. If you want to only give access to members of the group `example` with an ID of `8bab1c86-8fba-33e5-2089-1d1c80ec267d`, then set the following:
|
||||
|
||||
For example, if you want to only give access to members of the group `example` with an ID of `8bab1c86-8fba-33e5-2089-1d1c80ec267d`, set the following:
|
||||
```
|
||||
allowed_groups = 8bab1c86-8fba-33e5-2089-1d1c80ec267d
|
||||
```
|
||||
|
||||
```ini
|
||||
allowed_groups = 8bab1c86-8fba-33e5-2089-1d1c80ec267d
|
||||
```
|
||||
1. Verify that [group attributes](https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-fed-group-claims#configure-the-azure-ad-application-registration-for-group-attributes) is enabled in your Azure AD Application Registration manifest file by navigating to **Azure Portal** > **Azure Active Directory** > **Application Registrations** > **Select Application** -> **Manifest**, and set the following:
|
||||
|
||||
You'll need to ensure that you've [enabled group attributes](https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-fed-group-claims#configure-the-azure-ad-application-registration-for-group-attributes) in your Azure AD Application Registration manifest file. Navigate to **Azure Portal** -> **Azure Active Directory** -> **Application Registrations** -> **Select Application** -> **Manifest**, and set the following:
|
||||
|
||||
```json
|
||||
"groupMembershipClaims": "ApplicationGroup, SecurityGroup"
|
||||
```
|
||||
```
|
||||
"groupMembershipClaims": "ApplicationGroup, SecurityGroup"
|
||||
```
|
||||
|
||||
### Configure allowed domains
|
||||
|
||||
The `allowed_domains` option limits access to users who belong to specific domains. Separate domains with space or comma.
|
||||
The `allowed_domains` option limits access to users who belong to specific domains. Separate domains with space or comma. For example,
|
||||
|
||||
```ini
|
||||
```
|
||||
allowed_domains = mycompany.com mycompany.org
|
||||
```
|
||||
|
||||
### Team Sync (Enterprise only)
|
||||
|
||||
> Only available in Grafana Enterprise v6.7+
|
||||
|
||||
With Team Sync you can map your Azure AD groups to teams in Grafana so that your users will automatically be added to
|
||||
the correct teams.
|
||||
|
||||
You can reference Azure AD groups by group object ID, like `8bab1c86-8fba-33e5-2089-1d1c80ec267d`.
|
||||
|
||||
[Learn more about Team Sync]({{< relref "team-sync.md" >}})
|
||||
To learn more, refer to the [Team Sync]({{< relref "team-sync.md" >}}) documentation.
|
||||
|
||||
@@ -8,6 +8,7 @@ weight = 500
|
||||
# Generic OAuth authentication
|
||||
|
||||
You can configure many different OAuth2 authentication services with Grafana using the generic OAuth2 feature. Examples:
|
||||
|
||||
- [Generic OAuth authentication](#generic-oauth-authentication)
|
||||
- [Set up OAuth2 with Auth0](#set-up-oauth2-with-auth0)
|
||||
- [Set up OAuth2 with Bitbucket](#set-up-oauth2-with-bitbucket)
|
||||
@@ -45,6 +46,7 @@ tls_client_ca =
|
||||
Set `api_url` to the resource that returns [OpenID UserInfo](https://connect2id.com/products/server/docs/api/userinfo) compatible information.
|
||||
|
||||
You can also specify the SSL/TLS configuration used by the client.
|
||||
|
||||
- Set `tls_client_cert` to the path of the certificate.
|
||||
- Set `tls_client_key` to the path containing the key.
|
||||
- Set `tls_client_ca` to the path containing a trusted certificate authority list.
|
||||
@@ -57,7 +59,7 @@ Grafana will attempt to determine the user's e-mail address by querying the OAut
|
||||
|
||||
1. Check for the presence of an e-mail address via the `email` field encoded in the OAuth `id_token` parameter.
|
||||
1. Check for the presence of an e-mail address using the [JMESPath](http://jmespath.org/examples.html) specified via the `email_attribute_path` configuration option. The JSON used for the path lookup is the HTTP response obtained from querying the UserInfo endpoint specified via the `api_url` configuration option.
|
||||
**Note**: Only available in Grafana v6.4+.
|
||||
**Note**: Only available in Grafana v6.4+.
|
||||
1. Check for the presence of an e-mail address in the `attributes` map encoded in the OAuth `id_token` parameter. By default Grafana will perform a lookup into the attributes map using the `email:primary` key, however, this is configurable and can be adjusted by using the `email_attribute_name` configuration option.
|
||||
1. Query the `/emails` endpoint of the OAuth provider's API (configured with `api_url`) and check for the presence of an e-mail address marked as a primary address.
|
||||
1. If no e-mail address is found in steps (1-4), then the e-mail address of the user is set to the empty string.
|
||||
@@ -86,28 +88,30 @@ You can set the user's display name with JMESPath using the `name_attribute_path
|
||||
## Set up OAuth2 with Auth0
|
||||
|
||||
1. Create a new Client in Auth0
|
||||
- Name: Grafana
|
||||
- Type: Regular Web Application
|
||||
|
||||
- Name: Grafana
|
||||
- Type: Regular Web Application
|
||||
|
||||
1. Go to the Settings tab and set:
|
||||
- Allowed Callback URLs: `https://<grafana domain>/login/generic_oauth`
|
||||
|
||||
- Allowed Callback URLs: `https://<grafana domain>/login/generic_oauth`
|
||||
|
||||
1. Click Save Changes, then use the values at the top of the page to configure Grafana:
|
||||
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
team_ids =
|
||||
allowed_organizations =
|
||||
name = Auth0
|
||||
client_id = <client id>
|
||||
client_secret = <client secret>
|
||||
scopes = openid profile email
|
||||
auth_url = https://<domain>/authorize
|
||||
token_url = https://<domain>/oauth/token
|
||||
api_url = https://<domain>/userinfo
|
||||
```
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
team_ids =
|
||||
allowed_organizations =
|
||||
name = Auth0
|
||||
client_id = <client id>
|
||||
client_secret = <client secret>
|
||||
scopes = openid profile email
|
||||
auth_url = https://<domain>/authorize
|
||||
token_url = https://<domain>/oauth/token
|
||||
api_url = https://<domain>/userinfo
|
||||
```
|
||||
|
||||
## Set up OAuth2 with Bitbucket
|
||||
|
||||
@@ -144,53 +148,57 @@ allowed_organizations =
|
||||
|
||||
1. Configure Grafana as follows:
|
||||
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
name = Centrify
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
client_id = <OpenID Connect Client ID from Centrify>
|
||||
client_secret = <your generated OpenID Connect Client Secret"
|
||||
scopes = openid profile email
|
||||
auth_url = https://<your domain>.my.centrify.com/OAuth2/Authorize/<Application ID>
|
||||
token_url = https://<your domain>.my.centrify.com/OAuth2/Token/<Application ID>
|
||||
api_url = https://<your domain>.my.centrify.com/OAuth2/UserInfo/<Application ID>
|
||||
```
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
name = Centrify
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
client_id = <OpenID Connect Client ID from Centrify>
|
||||
client_secret = <your generated OpenID Connect Client Secret"
|
||||
scopes = openid profile email
|
||||
auth_url = https://<your domain>.my.centrify.com/OAuth2/Authorize/<Application ID>
|
||||
token_url = https://<your domain>.my.centrify.com/OAuth2/Token/<Application ID>
|
||||
api_url = https://<your domain>.my.centrify.com/OAuth2/UserInfo/<Application ID>
|
||||
```
|
||||
|
||||
## Set up OAuth2 with OneLogin
|
||||
|
||||
1. Create a new Custom Connector with the following settings:
|
||||
- Name: Grafana
|
||||
- Sign On Method: OpenID Connect
|
||||
- Redirect URI: `https://<grafana domain>/login/generic_oauth`
|
||||
- Signing Algorithm: RS256
|
||||
- Login URL: `https://<grafana domain>/login/generic_oauth`
|
||||
|
||||
then:
|
||||
- Name: Grafana
|
||||
- Sign On Method: OpenID Connect
|
||||
- Redirect URI: `https://<grafana domain>/login/generic_oauth`
|
||||
- Signing Algorithm: RS256
|
||||
- Login URL: `https://<grafana domain>/login/generic_oauth`
|
||||
|
||||
then:
|
||||
|
||||
1. Add an App to the Grafana Connector:
|
||||
- Display Name: Grafana
|
||||
|
||||
then:
|
||||
- Display Name: Grafana
|
||||
|
||||
then:
|
||||
|
||||
1. Under the SSO tab on the Grafana App details page you'll find the Client ID and Client Secret.
|
||||
|
||||
Your OneLogin Domain will match the URL you use to access OneLogin.
|
||||
Your OneLogin Domain will match the URL you use to access OneLogin.
|
||||
|
||||
Configure Grafana as follows:
|
||||
Configure Grafana as follows:
|
||||
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
name = OneLogin
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
client_id = <client id>
|
||||
client_secret = <client secret>
|
||||
scopes = openid email name
|
||||
auth_url = https://<onelogin domain>.onelogin.com/oidc/2/auth
|
||||
token_url = https://<onelogin domain>.onelogin.com/oidc/2/token
|
||||
api_url = https://<onelogin domain>.onelogin.com/oidc/2/me
|
||||
team_ids =
|
||||
allowed_organizations =
|
||||
```
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
name = OneLogin
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
client_id = <client id>
|
||||
client_secret = <client secret>
|
||||
scopes = openid email name
|
||||
auth_url = https://<onelogin domain>.onelogin.com/oidc/2/auth
|
||||
token_url = https://<onelogin domain>.onelogin.com/oidc/2/token
|
||||
api_url = https://<onelogin domain>.onelogin.com/oidc/2/me
|
||||
team_ids =
|
||||
allowed_organizations =
|
||||
```
|
||||
|
||||
## JMESPath examples
|
||||
|
||||
@@ -205,6 +213,7 @@ If the`role_attribute_path` property does not return a role, then the user is
|
||||
In the following example user will get `Editor` as role when authenticating. The value of the property `role` will be the resulting role if the role is a proper Grafana role, i.e. `Viewer`, `Editor` or `Admin`.
|
||||
|
||||
Payload:
|
||||
|
||||
```json
|
||||
{
|
||||
...
|
||||
@@ -214,6 +223,7 @@ Payload:
|
||||
```
|
||||
|
||||
Config:
|
||||
|
||||
```bash
|
||||
role_attribute_path = role
|
||||
```
|
||||
@@ -223,6 +233,7 @@ role_attribute_path = role
|
||||
In the following example user will get `Admin` as role when authenticating since it has a role `admin`. If a user has a role `editor` it will get `Editor` as role, otherwise `Viewer`.
|
||||
|
||||
Payload:
|
||||
|
||||
```json
|
||||
{
|
||||
...
|
||||
@@ -239,14 +250,14 @@ Payload:
|
||||
```
|
||||
|
||||
Config:
|
||||
|
||||
```bash
|
||||
role_attribute_path = contains(info.roles[*], 'admin') && 'Admin' || contains(info.roles[*], 'editor') && 'Editor' || 'Viewer'
|
||||
```
|
||||
|
||||
|
||||
### Groups mapping
|
||||
|
||||
> Available in Grafana Enterprise v8.1 and later versions.
|
||||
> Available in Grafana Enterprise v8.1 and later versions.
|
||||
|
||||
With Team Sync you can map your Generic OAuth groups to teams in Grafana so that the users are automatically added to the correct teams.
|
||||
|
||||
@@ -261,6 +272,7 @@ groups_attribute_path = info.groups
|
||||
```
|
||||
|
||||
Payload:
|
||||
|
||||
```json
|
||||
{
|
||||
...
|
||||
@@ -274,4 +286,4 @@ Payload:
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
@@ -11,7 +11,7 @@ To enable the GitHub OAuth2 you must register your application with GitHub. GitH
|
||||
|
||||
## Configure GitHub OAuth application
|
||||
|
||||
You need to create a GitHub OAuth application (you will find this under the GitHub
|
||||
You need to create a GitHub OAuth application (you will find this under the GitHub
|
||||
settings page). When you create the application you will need to specify
|
||||
a callback URL. Specify this as callback:
|
||||
|
||||
@@ -96,7 +96,7 @@ allowed_organizations = github google
|
||||
|
||||
### Team Sync (Enterprise only)
|
||||
|
||||
> Only available in Grafana Enterprise v6.3+
|
||||
> Only available in Grafana Enterprise v6.3+
|
||||
|
||||
With Team Sync you can map your GitHub org teams to teams in Grafana so that your users will automatically be added to
|
||||
the correct teams.
|
||||
|
||||
@@ -12,7 +12,7 @@ To enable GitLab OAuth2 you must register the application in GitLab. GitLab will
|
||||
## Create GitLab OAuth keys
|
||||
|
||||
You need to [create a GitLab OAuth application](https://docs.gitlab.com/ce/integration/oauth_provider.html).
|
||||
Choose a descriptive *Name*, and use the following *Redirect URI*:
|
||||
Choose a descriptive _Name_, and use the following _Redirect URI_:
|
||||
|
||||
```
|
||||
https://grafana.example.com/login/gitlab
|
||||
@@ -26,12 +26,12 @@ instance, if you access Grafana at `http://203.0.113.31:3000`, you should use
|
||||
http://203.0.113.31:3000/login/gitlab
|
||||
```
|
||||
|
||||
Finally, select *read_api* as the *Scope* and submit the form. Note that if you're
|
||||
Finally, select _read_api_ as the _Scope_ and submit the form. Note that if you're
|
||||
not going to use GitLab groups for authorization (i.e. not setting
|
||||
`allowed_groups`, see below), you can select *read_user* instead of *read_api* as
|
||||
the *Scope*, thus giving a more restricted access to your GitLab API.
|
||||
`allowed_groups`, see below), you can select _read_user_ instead of _read_api_ as
|
||||
the _Scope_, thus giving a more restricted access to your GitLab API.
|
||||
|
||||
You'll get an *Application Id* and a *Secret* in return; we'll call them
|
||||
You'll get an _Application Id_ and a _Secret_ in return; we'll call them
|
||||
`GITLAB_APPLICATION_ID` and `GITLAB_SECRET` respectively for the rest of this
|
||||
section.
|
||||
|
||||
@@ -63,7 +63,7 @@ If you use your own instance of GitLab instead of `gitlab.com`, adjust
|
||||
hostname with your own.
|
||||
|
||||
With `allow_sign_up` set to `false`, only existing users will be able to login
|
||||
using their GitLab account, but with `allow_sign_up` set to `true`, *any* user
|
||||
using their GitLab account, but with `allow_sign_up` set to `true`, _any_ user
|
||||
who can authenticate on GitLab will be able to login on your Grafana instance;
|
||||
if you use the public `gitlab.com`, it means anyone in the world would be able
|
||||
to login on your Grafana instance.
|
||||
@@ -78,7 +78,6 @@ groups](https://docs.gitlab.com/ce/user/group/index.html), set `allowed_groups`
|
||||
to a comma- or space-separated list of groups. For instance, if you want to
|
||||
only give access to members of the `example` group, set
|
||||
|
||||
|
||||
```ini
|
||||
allowed_groups = example
|
||||
```
|
||||
|
||||
@@ -18,9 +18,9 @@ provider (listed above). There is also options for allowing self sign up.
|
||||
Grafana are using short-lived tokens as a mechanism for verifying authenticated users.
|
||||
These short-lived tokens are rotated each `token_rotation_interval_minutes` for an active authenticated user.
|
||||
|
||||
An active authenticated user that gets it token rotated will extend the `login_maximum_inactive_lifetime_days` time from "now" that Grafana will remember the user.
|
||||
This means that a user can close its browser and come back before `now + login_maximum_inactive_lifetime_days` and still being authenticated.
|
||||
This is true as long as the time since user login is less than `login_maximum_lifetime_days`.
|
||||
An active authenticated user that gets it token rotated will extend the `login_maximum_inactive_lifetime_duration` time from "now" that Grafana will remember the user.
|
||||
This means that a user can close its browser and come back before `now + login_maximum_inactive_lifetime_duration` and still being authenticated.
|
||||
This is true as long as the time since user login is less than `login_maximum_lifetime_duration`.
|
||||
|
||||
#### Remote logout
|
||||
|
||||
@@ -38,10 +38,10 @@ Example:
|
||||
login_cookie_name = grafana_session
|
||||
|
||||
# The lifetime (days) an authenticated user can be inactive before being required to login at next visit. Default is 7 days.
|
||||
login_maximum_inactive_lifetime_days = 7
|
||||
login_maximum_inactive_lifetime_duration = 7d
|
||||
|
||||
# The maximum lifetime (days) an authenticated user can be logged in since login time before being required to login. Default is 30 days.
|
||||
login_maximum_lifetime_days = 30
|
||||
login_maximum_lifetime_duration = 30d
|
||||
|
||||
# How often should auth tokens be rotated for authenticated users when being active. The default is each 10 minutes.
|
||||
token_rotation_interval_minutes = 10
|
||||
|
||||
@@ -8,13 +8,15 @@ weight = 250
|
||||
# JWT authentication
|
||||
|
||||
You can configure Grafana to accept a JWT token provided in the HTTP header. The token is verified using any of the following:
|
||||
|
||||
- PEM-encoded key file
|
||||
- JSON Web Key Set (JWKS) in a local file
|
||||
- JSON Web Key Set (JWKS) in a local file
|
||||
- JWKS provided by the configured JWKS endpoint
|
||||
|
||||
## Enable JWT
|
||||
|
||||
To use JWT authentication:
|
||||
|
||||
1. Enable JWT in the [main config file]({{< relref "../administration/configuration.md" >}}).
|
||||
1. Specify the header name that contains a token.
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ group memberships and Grafana Organization user roles.
|
||||
|
||||
> [Enhanced LDAP authentication]({{< relref "../enterprise/enhanced_ldap.md" >}}) is available in [Grafana Cloud Pro and Advanced](https://grafana.com/docs/grafana-cloud/) and in [Grafana Enterprise]({{< relref "../enterprise" >}}).
|
||||
|
||||
> Refer to [Fine-grained access control]({{< relref "../enterprise/access-control/_index.md" >}}) in Grafana Enterprise to understand how you can control access with fine-grained permissions.
|
||||
|
||||
## Supported LDAP Servers
|
||||
|
||||
Grafana uses a [third-party LDAP library](https://github.com/go-ldap/ldap) under the hood that supports basic LDAP v3 functionality.
|
||||
@@ -43,6 +45,7 @@ Depending on which LDAP server you're using and how that's configured your Grafa
|
||||
See [configuration examples](#configuration-examples) for more information.
|
||||
|
||||
**LDAP specific configuration file (ldap.toml) example:**
|
||||
|
||||
```bash
|
||||
[[servers]]
|
||||
# Ldap server host (specify multiple hosts space separated)
|
||||
@@ -102,12 +105,11 @@ Within this view, you'll be able to see which LDAP servers are currently reachab
|
||||
|
||||
{{< figure src="/static/img/docs/ldap_debug.png" class="docs-image--no-shadow" max-width="600px" >}}
|
||||
|
||||
|
||||
To use the debug view:
|
||||
|
||||
1. Type the username of a user that exists within any of your LDAP server(s)
|
||||
1. Then, press "Run"
|
||||
1. If the user is found within any of your LDAP instances, the mapping information is displayed
|
||||
1. Type the username of a user that exists within any of your LDAP server(s)
|
||||
1. Then, press "Run"
|
||||
1. If the user is found within any of your LDAP instances, the mapping information is displayed
|
||||
|
||||
{{< figure src="/static/img/docs/ldap_debug_mapping_testing.png" class="docs-image--no-shadow" max-width="600px" >}}
|
||||
|
||||
@@ -136,6 +138,7 @@ In this case you skip providing a `bind_password` and instead provide a `bind_dn
|
||||
The search filter and search bases settings are still needed to perform the LDAP search to retrieve the other LDAP information (like LDAP groups and email).
|
||||
|
||||
### POSIX schema
|
||||
|
||||
If your LDAP server does not support the memberOf attribute add these options:
|
||||
|
||||
```bash
|
||||
@@ -149,13 +152,14 @@ group_search_filter_user_attribute = "uid"
|
||||
|
||||
### Group Mappings
|
||||
|
||||
In `[[servers.group_mappings]]` you can map an LDAP group to a Grafana organization and role. These will be synced every time the user logs in, with LDAP being
|
||||
In `[[servers.group_mappings]]` you can map an LDAP group to a Grafana organization and role. These will be synced every time the user logs in, with LDAP being
|
||||
the authoritative source. So, if you change a user's role in the Grafana Org. Users page, this change will be reset the next time the user logs in. If you
|
||||
change the LDAP groups of a user, the change will take effect the next time the user logs in.
|
||||
|
||||
The first group mapping that an LDAP user is matched to will be used for the sync. If you have LDAP users that fit multiple mappings, the topmost mapping in the TOML configuration will be used.
|
||||
|
||||
**LDAP specific configuration file (ldap.toml) example:**
|
||||
|
||||
```bash
|
||||
[[servers]]
|
||||
# other settings omitted for clarity
|
||||
@@ -178,12 +182,12 @@ group_dn = "*"
|
||||
org_role = "Viewer"
|
||||
```
|
||||
|
||||
Setting | Required | Description | Default
|
||||
------------ | ------------ | ------------- | -------------
|
||||
`group_dn` | Yes | LDAP distinguished name (DN) of LDAP group. If you want to match all (or no LDAP groups) then you can use wildcard (`"*"`) |
|
||||
`org_role` | Yes | Assign users of `group_dn` the organization role `"Admin"`, `"Editor"` or `"Viewer"` |
|
||||
`org_id` | No | The Grafana organization database id. Setting this allows for multiple group_dn's to be assigned to the same `org_role` provided the `org_id` differs | `1` (default org id)
|
||||
`grafana_admin` | No | When `true` makes user of `group_dn` Grafana server admin. A Grafana server admin has admin access over all organizations and users. Available in Grafana v5.3 and above | `false`
|
||||
| Setting | Required | Description | Default |
|
||||
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- |
|
||||
| `group_dn` | Yes | LDAP distinguished name (DN) of LDAP group. If you want to match all (or no LDAP groups) then you can use wildcard (`"*"`) |
|
||||
| `org_role` | Yes | Assign users of `group_dn` the organization role `"Admin"`, `"Editor"` or `"Viewer"` |
|
||||
| `org_id` | No | The Grafana organization database id. Setting this allows for multiple group_dn's to be assigned to the same `org_role` provided the `org_id` differs | `1` (default org id) |
|
||||
| `grafana_admin` | No | When `true` makes user of `group_dn` Grafana server admin. A Grafana server admin has admin access over all organizations and users. Available in Grafana v5.3 and above | `false` |
|
||||
|
||||
### Nested/recursive group membership
|
||||
|
||||
@@ -191,6 +195,7 @@ Users with nested/recursive group membership must have an LDAP server that suppo
|
||||
and configure `group_search_filter` in a way that it returns the groups the submitted username is a member of.
|
||||
|
||||
To configure `group_search_filter`:
|
||||
|
||||
- You can set `group_search_base_dns` to specify where the matching groups are defined.
|
||||
- If you do not use `group_search_base_dns`, then the previously defined `search_base_dns` is used.
|
||||
|
||||
@@ -222,6 +227,7 @@ For troubleshooting, by changing `member_of` in `[servers.attributes]` to "dn" i
|
||||
[OpenLDAP](http://www.openldap.org/) is an open source directory service.
|
||||
|
||||
**LDAP specific configuration file (ldap.toml):**
|
||||
|
||||
```bash
|
||||
[[servers]]
|
||||
host = "127.0.0.1"
|
||||
@@ -246,6 +252,7 @@ email = "email"
|
||||
Grafana does support receiving information from multiple LDAP servers.
|
||||
|
||||
**LDAP specific configuration file (ldap.toml):**
|
||||
|
||||
```bash
|
||||
# --- First LDAP Server ---
|
||||
|
||||
@@ -298,7 +305,7 @@ org_role = "Viewer"
|
||||
|
||||
### Active Directory
|
||||
|
||||
[Active Directory](https://technet.microsoft.com/en-us/library/hh831484(v=ws.11).aspx) is a directory service which is commonly used in Windows environments.
|
||||
[Active Directory](<https://technet.microsoft.com/en-us/library/hh831484(v=ws.11).aspx>) is a directory service which is commonly used in Windows environments.
|
||||
|
||||
Assuming the following Active Directory server setup:
|
||||
|
||||
@@ -307,6 +314,7 @@ Assuming the following Active Directory server setup:
|
||||
- DNS name: `corp.local`
|
||||
|
||||
**LDAP specific configuration file (ldap.toml):**
|
||||
|
||||
```bash
|
||||
[[servers]]
|
||||
host = "10.0.0.1"
|
||||
@@ -325,12 +333,10 @@ email = "mail"
|
||||
# [[servers.group_mappings]] omitted for clarity
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Port requirements
|
||||
|
||||
In above example SSL is enabled and an encrypted port have been configured. If your Active Directory don't support SSL please change `enable_ssl = false` and `port = 389`.
|
||||
Please inspect your Active Directory configuration and documentation to find the correct settings. For more information about Active Directory and port requirements see [link](https://technet.microsoft.com/en-us/library/dd772723(v=ws.10)).
|
||||
Please inspect your Active Directory configuration and documentation to find the correct settings. For more information about Active Directory and port requirements see [link](<https://technet.microsoft.com/en-us/library/dd772723(v=ws.10)>).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
||||
@@ -10,18 +10,18 @@ Grafana provides many ways to authenticate users. Some authentication integratio
|
||||
|
||||
Here is a table showing all supported authentication providers and the features available for them. [Team sync]({{< relref "../enterprise/team-sync.md" >}}) and [active sync]({{< relref "../enterprise/enhanced_ldap.md#active-ldap-synchronization" >}}) are only available in Grafana Enterprise.
|
||||
|
||||
Provider | Support | Role mapping | Team sync<br> *(Enterprise only)* | Active sync<br> *(Enterprise only)*
|
||||
-------- | :-----: | :----------: | :-------: | :---------:
|
||||
[Auth Proxy]({{< relref "auth-proxy.md" >}}) | v2.1+ | - | v6.3+ | -
|
||||
[Azure AD OAuth]({{< relref "azuread.md" >}}) | v6.7+ | v6.7+ | v6.7+ | -
|
||||
[Generic OAuth]({{< relref "generic-oauth.md" >}}) | v4.0+ | v6.5+ | - | -
|
||||
[GitHub OAuth]({{< relref "github.md" >}}) | v2.0+ | - | v6.3+ | -
|
||||
[GitLab OAuth]({{< relref "gitlab.md" >}}) | v5.3+ | - | v6.4+ | -
|
||||
[Google OAuth]({{< relref "google.md" >}}) | v2.0+ | - | - | -
|
||||
[JWT]({{< relref "jwt.md" >}}) | v8.0+ | - | - | -
|
||||
[LDAP]({{< relref "ldap.md" >}}) | v2.1+ | v2.1+ | v5.3+ | v6.3+
|
||||
[Okta OAuth]({{< relref "okta.md" >}}) | v7.0+ | v7.0+ | v7.0+ | -
|
||||
[SAML]({{< relref "../enterprise/saml.md" >}}) (Enterprise only) | v6.3+ | v7.0+ | v7.0+ | -
|
||||
| Provider | Support | Role mapping | Team sync<br> _(Enterprise only)_ | Active sync<br> _(Enterprise only)_ |
|
||||
| ---------------------------------------------------------------- | :-----: | :----------: | :-------------------------------: | :---------------------------------: |
|
||||
| [Auth Proxy]({{< relref "auth-proxy.md" >}}) | v2.1+ | - | v6.3+ | - |
|
||||
| [Azure AD OAuth]({{< relref "azuread.md" >}}) | v6.7+ | v6.7+ | v6.7+ | - |
|
||||
| [Generic OAuth]({{< relref "generic-oauth.md" >}}) | v4.0+ | v6.5+ | - | - |
|
||||
| [GitHub OAuth]({{< relref "github.md" >}}) | v2.0+ | - | v6.3+ | - |
|
||||
| [GitLab OAuth]({{< relref "gitlab.md" >}}) | v5.3+ | - | v6.4+ | - |
|
||||
| [Google OAuth]({{< relref "google.md" >}}) | v2.0+ | - | - | - |
|
||||
| [JWT]({{< relref "jwt.md" >}}) | v8.0+ | - | - | - |
|
||||
| [LDAP]({{< relref "ldap.md" >}}) | v2.1+ | v2.1+ | v5.3+ | v6.3+ |
|
||||
| [Okta OAuth]({{< relref "okta.md" >}}) | v7.0+ | v7.0+ | v7.0+ | - |
|
||||
| [SAML]({{< relref "../enterprise/saml.md" >}}) (Enterprise only) | v6.3+ | v7.0+ | v7.0+ | - |
|
||||
|
||||
## Grafana Auth
|
||||
|
||||
@@ -36,9 +36,9 @@ provider (listed above). There are also options for allowing self sign up.
|
||||
Grafana are using short-lived tokens as a mechanism for verifying authenticated users.
|
||||
These short-lived tokens are rotated each `token_rotation_interval_minutes` for an active authenticated user.
|
||||
|
||||
An active authenticated user that gets it token rotated will extend the `login_maximum_inactive_lifetime_days` time from "now" that Grafana will remember the user.
|
||||
This means that a user can close its browser and come back before `now + login_maximum_inactive_lifetime_days` and still being authenticated.
|
||||
This is true as long as the time since user login is less than `login_maximum_lifetime_days`.
|
||||
An active authenticated user that gets it token rotated will extend the `login_maximum_inactive_lifetime_duration` time from "now" that Grafana will remember the user.
|
||||
This means that a user can close its browser and come back before `now + login_maximum_inactive_lifetime_duration` and still being authenticated.
|
||||
This is true as long as the time since user login is less than `login_maximum_lifetime_duration`.
|
||||
|
||||
#### Remote logout
|
||||
|
||||
@@ -121,6 +121,11 @@ Defaults to `false`.
|
||||
oauth_auto_login = true
|
||||
```
|
||||
|
||||
### Avoid automatic OAuth login
|
||||
|
||||
To sign in with a username and password and avoid automatic OAuth login, add the `disableAutoLogin` parameter to your login URL.
|
||||
For example: `grafana.example.com/login?disableAutoLogin` or `grafana.example.com/login?disableAutoLogin=true`
|
||||
|
||||
### Hide sign-out menu
|
||||
|
||||
Set the option detailed below to true to hide sign-out menu link. Useful if you use an auth proxy or JWT authentication.
|
||||
@@ -138,4 +143,3 @@ URL to redirect the user to after signing out from Grafana. This can for example
|
||||
[auth]
|
||||
signout_redirect_url =
|
||||
```
|
||||
|
||||
|
||||
@@ -19,4 +19,4 @@ This mechanism allows Grafana to remove an existing synchronized user from a tea
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
> Team Sync is available in Grafana Enterprise Cloud Pro and Advanced and in Grafana Enterprise. For more information, refer to [Team sync]({{< relref "../enterprise/team-sync.md" >}}) in [Grafana Enterprise]({{< relref "../enterprise" >}}).
|
||||
> Team Sync is available in Grafana Enterprise Cloud Pro and Advanced and in Grafana Enterprise. For more information, refer to [Team sync]({{< relref "../enterprise/team-sync.md" >}}) in [Grafana Enterprise]({{< relref "../enterprise" >}}).
|
||||
|
||||
@@ -9,7 +9,7 @@ weight = 400
|
||||
|
||||
An exemplar is a specific trace representative of a repeated pattern of data in a given time interval. It helps you identify higher cardinality metadata from specific events within time series data.
|
||||
|
||||
Suppose your company website is experiencing a surge in traffic volumes. While more than eighty percent of the users are able to access the website in under two seconds, some users are experiencing a higher than normal response time resulting in bad user experience
|
||||
Suppose your company website is experiencing a surge in traffic volumes. While more than eighty percent of the users are able to access the website in under two seconds, some users are experiencing a higher than normal response time resulting in bad user experience.
|
||||
|
||||
To identify the factors that are contributing to the latency, you must compare a trace for a fast response against a trace for a slow response. Given the vast amount of data in a typical production environment, it will be extremely laborious and time-consuming effort.
|
||||
|
||||
|
||||
@@ -17,15 +17,14 @@ To examine the details of an exemplar trace:
|
||||
|
||||
1. Place your cursor over an exemplar (highlighted star). Depending on your backend trace data source, you will see a blue button with the label `Query with <data source name>`. In the following example, the tracing data source is Tempo.
|
||||
|
||||
{{< figure src="/static/img/docs/basics/exemplar-details.png" class="docs-image--no-shadow" max-width= "275px" caption="Screenshot showing Exemplar details" >}}
|
||||
{{< figure src="/static/img/docs/basics/exemplar-details.png" class="docs-image--no-shadow" max-width= "275px" caption="Screenshot showing Exemplar details" >}}
|
||||
|
||||
1. Click the **Query with Tempo** option next to the `traceID` property. The trace details, including the spans within the trace are listed in a separate panel on the right.
|
||||
|
||||
{{< figure src="/static/img/docs/basics/exemplar-explore-view.png" class="docs-image--no-shadow" max-width= "750px" caption="Explorer view with panel showing trace details" >}}
|
||||
{{< figure src="/static/img/docs/basics/exemplar-explore-view.png" class="docs-image--no-shadow" max-width= "750px" caption="Explorer view with panel showing trace details" >}}
|
||||
|
||||
For more information on how to drill down and analyze the trace and span details, refer to the [Analyze trace and span details](#analyze-trace-and-spans) section.
|
||||
|
||||
|
||||
## In logs
|
||||
|
||||
You can also view exemplar trace details from the Loki logs in Explore. Use regex within the Derived fields links for Loki to extract the `traceID` information. Now when you expand Loki logs, you can see a `traceID` property under the **Detected fields** section. To learn more about how to extract a part of a log message into an internal or external link, refer to [using derived fields in Loki]({{< relref "../../explore/logs-integration.md" >}}).
|
||||
@@ -40,24 +39,24 @@ To view the details of an exemplar trace:
|
||||
|
||||
For more information on how to drill down and analyze the trace and span details, refer to the [Analyze trace and span details](#analyze-trace-and-spans) section.
|
||||
|
||||
## Analyze trace and spans
|
||||
## Analyze trace and spans
|
||||
|
||||
This panel shows the details of the trace in different segments.
|
||||
This panel shows the details of the trace in different segments.
|
||||
|
||||
- The top segment shows the Trace ID to indicate that the query results correspond to the specific trace.
|
||||
- The top segment shows the Trace ID to indicate that the query results correspond to the specific trace.
|
||||
|
||||
You can add more traces to the results using the `Add query` button.
|
||||
You can add more traces to the results using the `Add query` button.
|
||||
|
||||
- The next segment shows the entire span for the specific trace as a narrow strip. All levels of the trace from the client all the way down to database query is displayed, which provides a bird's eye view of the time distribution across all layers over which the HTTP request was processed.
|
||||
|
||||
1. You can click within this strip view to display a magnified view of a smaller time segment within the span. This magnified view shows up in the bottom segment of the panel.
|
||||
1. You can click within this strip view to display a magnified view of a smaller time segment within the span. This magnified view shows up in the bottom segment of the panel.
|
||||
|
||||
1. In the magnified view, you can expand or collapse the various levels of the trace to drill down to the specific span of interest.
|
||||
1. In the magnified view, you can expand or collapse the various levels of the trace to drill down to the specific span of interest.
|
||||
|
||||
For example, if the strip view shows that most of the latency was within the app layer, you can expand the trace down the app layer to investigate the problem further. To expand a particular layer of span, click the icon on the left. The same button can collapse an expanded span.
|
||||
For example, if the strip view shows that most of the latency was within the app layer, you can expand the trace down the app layer to investigate the problem further. To expand a particular layer of span, click the icon on the left. The same button can collapse an expanded span.
|
||||
|
||||
- To see the details of the span at any level, click the span itself.
|
||||
|
||||
This displays additional metadata associated with the span. The metadata itself is initially shown in a narrow strip but you can see more details by clicking the metadata strip.
|
||||
This displays additional metadata associated with the span. The metadata itself is initially shown in a narrow strip but you can see more details by clicking the metadata strip.
|
||||
|
||||
{{< figure src="/static/img/docs/basics/exemplar-span-details.png" class="docs-image--no-shadow" max-width= "750px" caption="Span details" >}}
|
||||
{{< figure src="/static/img/docs/basics/exemplar-span-details.png" class="docs-image--no-shadow" max-width= "750px" caption="Span details" >}}
|
||||
|
||||
@@ -25,38 +25,39 @@ Here is an example showing height distribution of people.
|
||||
|
||||
{{< figure src="/static/img/docs/histogram-panel/histogram-example-v8-0.png" max-width="625px" caption="Bar chart example" >}}
|
||||
|
||||
For more information about histogram visualization options, refer to [Histogram]({{< relref "../panels/visualizations/histogram.md" >}}).
|
||||
For more information about histogram visualization options, refer to [Histogram]({{< relref "../visualizations/histogram.md" >}}).
|
||||
|
||||
Histograms only look at _value distributions_ over a specific time range. The problem with histograms is you cannot see any trends or changes in the distribution over time. This is where heatmaps become useful.
|
||||
Histograms only look at _value distributions_ over a specific time range. The problem with histograms is that you cannot see any trends or changes in the distribution over time. This is where heatmaps become useful.
|
||||
|
||||
## Heatmaps
|
||||
|
||||
A _heatmap_ is like a histogram, but over time where each time slice represents its own histogram. Instead of using bar height as a representation of frequency, it uses cells and colors the cell proportional to the number of values in the bucket.
|
||||
A _heatmap_ is like a histogram, but over time, where each time slice represents its own histogram. Instead of using bar height as a representation of frequency, it uses cells, and colors the cell proportional to the number of values in the bucket.
|
||||
|
||||
In this example, you can clearly see what values are more common and how they trend over time.
|
||||
|
||||

|
||||
|
||||
For more information about heatmap visualization options, refer to [Heatmap]({{< relref "../panels/visualizations/heatmap.md" >}}).
|
||||
For more information about heatmap visualization options, refer to [Heatmap]({{< relref "../visualizations/heatmap.md" >}}).
|
||||
|
||||
## Pre-bucketed data
|
||||
|
||||
There are a number of data sources supporting histogram over time like Elasticsearch (by using a Histogram bucket
|
||||
There are a number of data sources supporting histogram over time, like Elasticsearch (by using a Histogram bucket
|
||||
aggregation) or Prometheus (with [histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) metric type
|
||||
and *Format as* option set to Heatmap). But generally, any data source could be used if it meets the requirements:
|
||||
returns series with names representing bucket bound or returns series sorted by the bound in ascending order.
|
||||
and _Format as_ option set to Heatmap). But generally, any data source could be used as long as it meets the requirement
|
||||
that it either returns series with names representing bucket bounds, or that it returns series sorted by the bounds
|
||||
in ascending order.
|
||||
|
||||
## Raw data vs aggregated
|
||||
|
||||
If you use the heatmap with regular time series data (not pre-bucketed), then it's important to keep in mind that your data
|
||||
is often already aggregated by your time series backend. Most time series queries do not return raw sample data
|
||||
but include a group by time interval or maxDataPoints limit coupled with an aggregation function (usually average).
|
||||
is often already aggregated by your time series backend. Most time series queries do not return raw sample data,
|
||||
but instead include a group by time interval or maxDataPoints limit coupled with an aggregation function (usually average).
|
||||
|
||||
This all depends on the time range of your query of course. But the important point is to know that the histogram bucketing
|
||||
that Grafana performs might be done on already aggregated and averaged data. To get more accurate heatmaps it is better
|
||||
to do the bucketing during metric collection or store the data in Elasticsearch, or in the other data source which
|
||||
that Grafana performs might be done on already aggregated and averaged data. To get more accurate heatmaps, it is better
|
||||
to do the bucketing during metric collection, or to store the data in Elasticsearch or any other data source which
|
||||
supports doing histogram bucketing on the raw data.
|
||||
|
||||
If you remove or lower the group by time (or raise maxDataPoints) in your query to return more data points your heatmap will be
|
||||
more accurate but this can also be very CPU and memory taxing for your browser and could cause hangs and crashes if the number of
|
||||
If you remove or lower the group by time (or raise maxDataPoints) in your query to return more data points, your heatmap will be
|
||||
more accurate, but this can also be very CPU and memory taxing for your browser, possibly causing hangs or crashes if the number of
|
||||
data points becomes unreasonably large.
|
||||
|
||||
@@ -22,7 +22,7 @@ To identify unique series within a set of time series, Grafana stores dimensions
|
||||
|
||||
## Labels
|
||||
|
||||
Each time series in Grafana optionally has labels. labels are set a of key/value pairs for identifying dimensions. Example labels could are `{location=us}` or `{country=us,state=ma,city=boston}`. Within a set of time series, the combination of its name and labels identifies each series. For example, `temperature {country=us,state=ma,city=boston}`.
|
||||
Each time series in Grafana optionally has labels. Labels are set a of key/value pairs for identifying dimensions. Example labels could be `{location=us}` or `{country=us,state=ma,city=boston}`. Within a set of time series, the combination of its name and labels identifies each series. For example, `temperature {country=us,state=ma,city=boston}` could identify the series of temperature values for the city of Boston in the US.
|
||||
|
||||
Different sources of time series data have dimensions stored natively, or common storage patterns that allow the data to be extracted into dimensions.
|
||||
|
||||
@@ -32,7 +32,7 @@ In table databases such SQL, these dimensions are generally the `GROUP BY` param
|
||||
|
||||
## Multiple dimensions in table format
|
||||
|
||||
In SQL or SQL-like databases that return table responses, additional dimensions usually columns in the query response table.
|
||||
In SQL or SQL-like databases that return table responses, additional dimensions are usually represented as columns in the query response table.
|
||||
|
||||
### Single dimension
|
||||
|
||||
@@ -44,7 +44,7 @@ SELECT BUCKET(StartTime, 1h), AVG(Temperature) AS Temp, Location FROM T
|
||||
ORDER BY time asc
|
||||
```
|
||||
|
||||
Might return a table with three columns that each respectively have data types time, number, and string.
|
||||
This query would return a table with three columns with data types time, number, and string respectively:
|
||||
|
||||
| StartTime | Temp | Location |
|
||||
| --------- | ---- | -------- |
|
||||
@@ -53,7 +53,7 @@ Might return a table with three columns that each respectively have data types t
|
||||
| 10:00 | 26 | LGA |
|
||||
| 10:00 | 22 | BOS |
|
||||
|
||||
The table format is _long_ formatted time series, also called _tall_. It has repeated time stamps, and repeated values in Location. In this case, we have two time series in the set that would be identified as `Temp {Location=LGA}` and `Temp {Location=BOS}`.
|
||||
The table format is a _long_ formatted time series, also called _tall_. It has repeated time stamps, and repeated values in Location. In this case, we have two time series in the set that would be identified as `Temp {Location=LGA}` and `Temp {Location=BOS}`.
|
||||
|
||||
Individual time series from the set are extracted by using the time typed column `StartTime` as the time index of the time series, the numeric typed column `Temp` as the series name, and the name and values of the string typed `Location` column to build the labels, such as Location=LGA.
|
||||
|
||||
@@ -80,6 +80,6 @@ In this case the labels that represent the dimensions will have two keys based o
|
||||
|
||||
### Multiple values
|
||||
|
||||
In the case SQL-like data sources, more than one numeric column can be selected, with or without additional string columns to be used as dimensions. For example, `AVG(Temperature) AS AvgTemp, MAX(Temperature) AS MaxTemp`. This, if combined with multiple dimensions can result in a lot of series. Selecting multiple values is currently only designed to be used with visualization.
|
||||
In the case of SQL-like data sources, more than one numeric column can be selected, with or without additional string columns to be used as dimensions. For example, `AVG(Temperature) AS AvgTemp, MAX(Temperature) AS MaxTemp`. This, if combined with multiple dimensions, can result in a lot of series. Selecting multiple values is currently only designed to be used with visualization.
|
||||
|
||||
Additional technical information on tabular time series formats and how dimensions are extracted can be found in [the developer documentation on data frames as time series]({{< relref "../developers/plugins/data-frames.md#data-frames-as-time-series" >}}).
|
||||
|
||||
@@ -15,9 +15,9 @@ Imagine you wanted to know how the temperature outside changes throughout the da
|
||||
| 10:00 | 26°C |
|
||||
| 11:00 | 27°C |
|
||||
|
||||
Temperature data like this is one example of what we call a *time series*—a sequence of measurements, ordered in time. Every row in the table represents one individual measurement at a specific time.
|
||||
Temperature data like this is one example of what we call a _time series_ — a sequence of measurements, ordered in time. Every row in the table represents one individual measurement at a specific time.
|
||||
|
||||
Tables are useful when you want to identify individual measurements but make it difficult to see the big picture. A more common visualization for time series is the _graph_, which instead places each measurement along a time axis. Visual representations like the graph make it easier to discover patterns and features of the data that otherwise would be difficult to see.
|
||||
Tables are useful when you want to identify individual measurements, but they make it difficult to see the big picture. A more common visualization for time series is the _graph_, which instead places each measurement along a time axis. Visual representations like the graph make it easier to discover patterns and features of the data that otherwise would be difficult to see.
|
||||
|
||||
{{< figure src="/static/img/docs/example_graph.png" class="docs-image--no-shadow" max-width="850px" >}}
|
||||
|
||||
@@ -29,14 +29,14 @@ Temperature data like the one in the example, is far from the only example of a
|
||||
|
||||
While each of these examples are sequences of chronologically ordered measurements, they also share other attributes:
|
||||
|
||||
- New data is appended at the end, at regular intervals—for example, hourly at 09:00, 10:00, 11:00, and so on.
|
||||
- Measurements are seldom updated after they were added—for example, yesterday's temperature doesn't change.
|
||||
- New data is appended at the end, at regular intervals — for example, hourly at 09:00, 10:00, 11:00, and so on.
|
||||
- Measurements are seldom updated after they were added — for example, yesterday's temperature doesn't change.
|
||||
|
||||
Time series are powerful. They help you understand the past by letting you analyze the state of the system at any point in time. Time series could tell you that the server crashed moments after the free disk space went down to zero.
|
||||
|
||||
Time series can also help you predict the future, by uncovering trends in your data. If the number of registered users has been increasing monthly by 4% for the past few months, you can predict how big your user base is going to be at the end of the year.
|
||||
|
||||
Some time series have patterns that repeat themselves over a known period. For example, the temperature is typically higher during the day, before it dips down at night. By identifying these periodic, or _seasonal_, time series, you can make confident predictions about the next period. If we know that the system load peaks every day around 18:00, we can add more machines right before.
|
||||
Some time series have patterns that repeat themselves over a known period. For example, the temperature is typically higher during the day, before it dips down at night. By identifying these periodic, or _seasonal_, time series, you can make confident predictions about the next period. If you know that the system load peaks every day around 18:00, you can add more machines right before.
|
||||
|
||||
## Aggregating time series
|
||||
|
||||
@@ -45,7 +45,7 @@ Depending on what you're measuring, the data can vary greatly. What if you wante
|
||||
Combining a collection of measurements is called _aggregation_. There are several ways to aggregate time series data. Here are some common ones:
|
||||
|
||||
- **Average** returns the sum of all values divided by the total number of values.
|
||||
- **Min** and **Max** return the smallest, and largest value in the collection.
|
||||
- **Min** and **Max** return the smallest and largest value in the collection.
|
||||
- **Sum** returns the sum of all values in the collection.
|
||||
- **Count** returns the number of values in the collection.
|
||||
|
||||
@@ -81,26 +81,26 @@ We could even take it a step further, by calculating the deltas of these deltas:
|
||||
1572524345, +30, -1, +1, +0
|
||||
```
|
||||
|
||||
If measurements are taken at regular intervals, most of these delta-of-deltas will be 0. Because of optimizations like these, TSDBs uses drastically less space than other databases.
|
||||
If measurements are taken at regular intervals, most of these delta-of-deltas will be 0. Because of optimizations like these, TSDBs use drastically less space than other databases.
|
||||
|
||||
Another feature of a TSDB is the ability to filter measurements using _tags_. Each data point is labeled with a tag that adds context information, such as where the measurement was taken. Here's an example of the [InfluxDB data format](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#syntax) that demonstrates how each measurement is stored.
|
||||
|
||||
```
|
||||
weather,location=us-midwest temperature=82 1465839830100400200
|
||||
| -------------------- -------------- |
|
||||
| | | |
|
||||
| | | |
|
||||
+-----------+--------+-+---------+-+---------+
|
||||
|measurement|,tag_set| |field_set| |timestamp|
|
||||
+-----------+--------+-+---------+-+---------+
|
||||
```
|
||||
|
||||
Here are some of the TSDBs supported by Grafana:
|
||||
|
||||
- [Graphite](https://graphiteapp.org/)
|
||||
- [InfluxDB](https://www.influxdata.com/products/influxdb-overview/)
|
||||
- [Prometheus](https://prometheus.io/)
|
||||
|
||||
```
|
||||
weather,location=us-midwest temperature=82 1465839830100400200
|
||||
| -------------------- -------------- |
|
||||
| | | |
|
||||
| | | |
|
||||
+-----------+--------+-+---------+-+---------+
|
||||
|measurement|,tag_set| |field_set| |timestamp|
|
||||
+-----------+--------+-+---------+-+---------+
|
||||
```
|
||||
|
||||
### Collecting time series data
|
||||
|
||||
Now that we have a place to store our time series, how do we actually gather the measurements? To collect time series data, you'd typically install a _collector_ on the device, machine, or instance you want to monitor. Some collectors are made with a specific database in mind, and some support different output destinations.
|
||||
@@ -114,10 +114,9 @@ Here are some examples of collectors:
|
||||
|
||||
A collector either _pushes_ data to a database or lets the database _pull_ the data from it. Both methods come with their own set of pros and cons:
|
||||
|
||||
| | Pros | Cons |
|
||||
| ---- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| Push | Easier to replicate data to multiple destinations. | The TSDB has no control over how much data gets sent. |
|
||||
| | Pros | Cons |
|
||||
| ---- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
||||
| Push | Easier to replicate data to multiple destinations. | The TSDB has no control over how much data gets sent. |
|
||||
| Pull | Better control of how much data that gets ingested, and its authenticity. | Firewalls, VPNs or load balancers can make it hard to access the agents. |
|
||||
|
||||
Since it would be inefficient to write every measurement to the database, collectors pre-aggregate the data and write to the time series database at regular intervals.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ Keep your graphs simple and focused on answering the question that you are askin
|
||||
_Cognitive load_ is basically how hard you need to think about something in order to figure it out. Make your dashboard easy to interpret. Other users and future you (when you're trying to figure out what broke at 2AM) will appreciate it.
|
||||
|
||||
Ask yourself:
|
||||
|
||||
- Can I tell what exactly each graph represents? Is it obvious, or do I have to think about it?
|
||||
- If I show this to someone else, how long will it take them to figure it out? Will they get lost?
|
||||
|
||||
@@ -46,8 +47,8 @@ Once you have a strategy or design guidelines, write them down to help maintain
|
||||
- Grafana retrieves data from a data source. A basic understanding of [data sources]({{< relref "../datasources/_index.md" >}}) in general and your specific is important.
|
||||
- Avoid unnecessary dashboard refreshing to reduce the load on the network or backend. For example, if your data changes every hour, then you don't need to set the dashboard refresh rate to 30 seconds.
|
||||
- Use the left and right Y-axes when displaying time series with different units or ranges.
|
||||
- Add documentation to dashboards and panels.
|
||||
- To add documentation to a dashboard, add a [Text panel visualization]({{< relref "../panels/visualizations/text-panel.md" >}}) to the dashboard. Record things like the purpose of the dashboard, useful resource links, and any instructions users might need to interact with the dashboard. Check out this [Wikimedia example](https://grafana.wikimedia.org/d/000000066/resourceloader?orgId=1).
|
||||
- To add documentation to a panel, [edit the panel settings]({{< relref "../panels/add-a-panel.md#edit-panel-settings" >}}) and add a description. Any text you add will appear if you hover your cursor over the small `i` in the top left corner of the panel.
|
||||
- Reuse your dashboards and enforce consistency by using [templates and variables]({{< relref "../variables/_index.md" >}}).
|
||||
- Be careful with stacking graph data. The visualizations can be misleading, and hide important data. We recommend turning it off in most cases.
|
||||
- Add documentation to dashboards and panels.
|
||||
- To add documentation to a dashboard, add a [Text panel visualization]({{< relref "../visualizations/text-panel.md" >}}) to the dashboard. Record things like the purpose of the dashboard, useful resource links, and any instructions users might need to interact with the dashboard. Check out this [Wikimedia example](https://grafana.wikimedia.org/d/000000066/resourceloader?orgId=1).
|
||||
- To add documentation to a panel, [edit the panel settings]({{< relref "../panels/add-a-panel.md#edit-panel-settings" >}}) and add a description. Any text you add will appear if you hover your cursor over the small `i` in the top left corner of the panel.
|
||||
- Reuse your dashboards and enforce consistency by using [templates and variables]({{< relref "../variables/_index.md" >}}).
|
||||
- Be careful with stacking graph data. The visualizations can be misleading, and hide important data. We recommend turning it off in most cases.
|
||||
|
||||
@@ -32,6 +32,6 @@ What is your dashboard maturity level? Analyze your current dashboard setup and
|
||||
- In many cases copies are being made to simply customize the view by setting template parameters. This should instead be done by maintaining a link to the master dashboard and customizing the view with [URL parameters]({{< relref "../linking/data-link-variables.md" >}}).
|
||||
- When you must copy a dashboard, clearly rename it and _do not_ copy the dashboard tags. Tags are important metadata for dashboards that are used during search. Copying tags can result in false matches.
|
||||
- Maintain a dashboard of dashboards or cross-reference dashboards. This can be done in several ways:
|
||||
- Create dashboard links, panel, or data links. Links can go to other dashboards or to external systems. For more information, refer to [Linking]({{< relref "../linking/_index.md" >}}).
|
||||
- Add a [Dashboard list panel]({{< relref "../panels/visualizations/dashboard-list-panel.md" >}}). You can then customize what you see by doing tag or folder searches.
|
||||
- Add a [Text panel]({{< relref "../panels/visualizations/text-panel.md" >}}) and use markdown to customize the display.
|
||||
- Create dashboard links, panel, or data links. Links can go to other dashboards or to external systems. For more information, refer to [Linking]({{< relref "../linking/_index.md" >}}).
|
||||
- Add a [Dashboard list panel]({{< relref "../visualizations/dashboard-list-panel.md" >}}). You can then customize what you see by doing tag or folder searches.
|
||||
- Add a [Text panel]({{< relref "../visualizations/text-panel.md" >}}) and use markdown to customize the display.
|
||||
|
||||
@@ -48,13 +48,13 @@ Dashboards can be tagged, and the dashboard picker provides quick, searchable ac
|
||||
|
||||
## Rows
|
||||
|
||||
A *row* is a logical divider within a dashboard. It is used to group panels together.
|
||||
A _row_ is a logical divider within a dashboard. It is used to group panels together.
|
||||
|
||||
Rows are always 12 “units” wide. These units are automatically scaled dependent on the horizontal resolution of your browser. You can control the relative width of panels within a row by setting their specific width.
|
||||
|
||||
We use a unit abstraction so that Grafana looks great on all screen sizes.
|
||||
|
||||
> **Note:** With MaxDataPoint functionality, Grafana can show you the perfect number of data points, regardless of resolution or time range.
|
||||
> **Note:** With MaxDataPoint functionality, Grafana can show you the perfect number of data points, regardless of resolution or time range.
|
||||
|
||||
Collapse a row by clicking on the row title. If you save a dashboard with a row collapsed, then it saves in that state and does not load those graphs until you expand the row.
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@ can still show them if you add a new **Annotation Query** and filter by tags. Bu
|
||||
|
||||
### Query by tag
|
||||
|
||||
|
||||
You can create new queries to fetch annotations from the native annotation store via the `-- Grafana --` data source by setting *Filter by* to `Tags`.
|
||||
You can create new queries to fetch annotations from the native annotation store via the `-- Grafana --` data source by setting _Filter by_ to `Tags`.
|
||||
|
||||
Grafana v8.1 and later versions also support typeahead of existing tags, provide at least one tag.
|
||||
|
||||
@@ -61,6 +60,7 @@ open the dashboard settings menu, then select `Annotations`. This will open the
|
||||
settings view. To create a new annotation query hit the `New` button.
|
||||
|
||||
<!---->
|
||||
|
||||
{{< figure src="/static/img/docs/v50/annotation_new_query.png" max-width="600px" >}}
|
||||
|
||||
Specify a name for the annotation query. This name is given to the toggle (checkbox) that will allow
|
||||
|
||||
@@ -46,6 +46,5 @@ The Dashboard Folder Page is similar to the Manage Dashboards page and is where
|
||||
|
||||
Permissions can be assigned to a folder and inherited by the containing dashboards. An Access Control List (ACL) is used where
|
||||
**Organization Role**, **Team** and Individual **User** can be assigned permissions. Read the
|
||||
[Dashboard and Folder Permissions]({{< relref "../permissions/dashboard-folder-permissions.md" >}}) docs for more detail
|
||||
on the permission system.
|
||||
|
||||
[Dashboard and Folder Permissions]({{< relref "../permissions/dashboard-folder-permissions.md" >}}) docs for more detail
|
||||
on the permission system.
|
||||
|
||||
@@ -5,7 +5,6 @@ aliases = ["/docs/grafana/latest/reference/dashboard_history/"]
|
||||
weight = 100
|
||||
+++
|
||||
|
||||
|
||||
# Dashboard Version History
|
||||
|
||||
Whenever you save a version of your dashboard, a copy of that version is saved so that previous versions of your dashboard are never lost. A list of these versions is available by entering the dashboard settings and then selecting "Versions" in the left side menu.
|
||||
|
||||
@@ -56,6 +56,7 @@ Dashboards exported from Grafana 3.1+ have a new json section `__inputs`
|
||||
that define what data sources and metric prefixes the dashboard uses.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"__inputs": [
|
||||
@@ -76,7 +77,6 @@ Example:
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
These are then referenced in the dashboard panels like this:
|
||||
@@ -84,14 +84,14 @@ These are then referenced in the dashboard panels like this:
|
||||
```json
|
||||
{
|
||||
"rows": [
|
||||
{
|
||||
"panels": [
|
||||
{
|
||||
"type": "graph",
|
||||
"datasource": "${DS_GRAPHITE}"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"panels": [
|
||||
{
|
||||
"type": "graph",
|
||||
"datasource": "${DS_GRAPHITE}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -106,4 +106,5 @@ data source. Another alternative is to open the json file in a text editor and u
|
||||
to value that matches a name of your data source.
|
||||
|
||||
## Note
|
||||
|
||||
In Grafana v5.3.4+ the export modal has new checkbox for sharing for external use (other instances). If the checkbox is not checked then the `__inputs` section will not be included in the exported JSON file.
|
||||
|
||||
@@ -11,9 +11,9 @@ A dashboard in Grafana is represented by a JSON object, which stores metadata of
|
||||
|
||||
To view the JSON of a dashboard:
|
||||
|
||||
1. Navigate to a dashboard.
|
||||
1. In the top navigation menu, click the **Dashboard settings** (gear) icon.
|
||||
1. Click **JSON Model**.
|
||||
1. Navigate to a dashboard.
|
||||
1. In the top navigation menu, click the **Dashboard settings** (gear) icon.
|
||||
1. Click **JSON Model**.
|
||||
|
||||
## JSON fields
|
||||
|
||||
@@ -53,6 +53,7 @@ When a user creates a new dashboard, a new dashboard JSON object is initialized
|
||||
"links": []
|
||||
}
|
||||
```
|
||||
|
||||
Each field in the dashboard JSON is explained below with its usage:
|
||||
|
||||
| Name | Usage |
|
||||
@@ -99,7 +100,7 @@ Panels are the building blocks of a dashboard. It consists of data source querie
|
||||
|
||||
The gridPos property describes the panel size and position in grid coordinates.
|
||||
|
||||
- `w` 1-24 (the width of the dashboard is divided into 24 columns)
|
||||
- `w` 1-24 (the width of the dashboard is divided into 24 columns)
|
||||
- `h` In grid height units, each represents 30 pixels.
|
||||
- `x` The x position, in same unit as `w`.
|
||||
- `y` The y position, in same unit as `h`.
|
||||
|
||||
@@ -5,145 +5,97 @@ aliases = ["/docs/grafana/latest/reference/playlist/"]
|
||||
weight = 4
|
||||
+++
|
||||
|
||||
|
||||
# Playlist
|
||||
|
||||
A playlist is a list of dashboards that are displayed in a sequence. You might use a playlist to build situational awareness or to present your metrics to your team or visitors.
|
||||
A playlist displays a list of dashboards that are in a sequence. Use a playlist to build situational awareness or to present your metrics to your team or visitors. Grafana automatically scales dashboards to any resolution, which makes them perfect for big screens. This topic has the following sections:
|
||||
|
||||
Grafana automatically scales dashboards to any resolution, which makes them perfect for big screens.
|
||||
- [Access, share, and control a playlist](#access-share-and-control-a-playlist)
|
||||
- [Create a playlist](#create-a-playlist)
|
||||
- [Edit or delete a playlist](#edit-or-delete-a-playlist)
|
||||
- [Share a playlist](#share-a-playlist-in-a-view-mode)
|
||||
|
||||
You can access the Playlist feature from Grafana's side menu, in the Dashboards submenu.
|
||||
## Access, share, and control a playlist
|
||||
|
||||
{{< figure src="/static/img/docs/v50/playlist.png" max-width="25rem">}}
|
||||
Use the information in this section to access existing playlists. Start and control the display of a playlist using one of the five available modes.
|
||||
|
||||
### Access playlist
|
||||
|
||||
1. Hover your cursor over Grafana’s side menu.
|
||||
1. Click **Playlists**. You will see a list of existing playlists.
|
||||
|
||||
### Start a playlist
|
||||
|
||||
1. [Access](#access-playlist) the playlist page to see a list of existing playlists.
|
||||
1. Find the playlist you want to start, then click **Start playlist**. The start playlist dialog opens.
|
||||
1. Select one of the five playlist modes available based on the information in the following table.
|
||||
1. Click **Start <playlist name>**.
|
||||
|
||||
The playlist displays each dashboard for the time specified in the `Interval` field, set when creating or editing a playlist. Once a playlist starts, you can [control](#control-a-playlist) it using the navbar at the top of your screen.
|
||||
|
||||
| Mode | Description |
|
||||
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Normal mode | <ul><li>The side menu remains visible.</li></ul><ul><li>The navbar, row, and panel controls appear at the top of the screen.</li></ul> |
|
||||
| TV mode | <ul><li>The side menu and dashboard submenu (including variable drop-downs and dashboard links) are hidden or removed.</li></ul><ul><li>The navbar, row, and panel controls appear at the top of the screen.</li></ul><ul><li>Enabled automatically after one minute of user inactivity.</li></ul><ul><li>Enable it manually using the `d v` sequence shortcut, or by appending the parameter `?inactive` to the dashboard URL.</li></ul><ul><li>Disable it with any mouse movement or keyboard action.</li></ul> |
|
||||
| TV mode (with auto fit panels) | <ul><li>The side menu and dashboard submenu (including variable drop-downs and dashboard links) are hidden or removed.</li></ul><ul><li>The navbar, row and panel controls appear at the top of the screen.</li></ul><ul><li>Dashboard panels automatically adjust to optimize space on screen.</li></ul><ul> |
|
||||
| Kiosk mode | <ul><li>The side menu, navbar, ro and panel controls are completely hidden/removed from view.</li></ul><ul><li>You can enable it manually using the `d v` sequence shortcut after the playlist has started.</li></ul><ul><li>You can disable it manually with the same shortcut.</li></ul> |
|
||||
| Kiosk mode (with auto fit panels) | <ul><li>The side menu, navbar, row, and panel controls are completely hidden/removed from view.</li></ul><ul><li>Dashboard panels automatically adjust to optimize space on screen.</li></ul> |
|
||||
|
||||
### Control a playlist
|
||||
|
||||
You can control a playlist in **Normal** or **TV** mode after it's started, using the navigation bar at the top of your screen. Press the Esc key in your keyboard to stop the playlist.
|
||||
|
||||
| Button | Result |
|
||||
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Next (double-right arrow) | Advances to the next dashboard. |
|
||||
| Back (left arrow) | Returns to the previous dashboard. |
|
||||
| Stop (square) | Ends the playlist, and exits to the current dashboard. |
|
||||
| Cycle view mode (monitor icon) | Rotates the display of the dashboards in different view modes. |
|
||||
| Time range | Displays data within a time range. It can be set to display the last 5 minutes up to 5 years ago, or a custom time range, using the down arrow. |
|
||||
| Refresh (circle arrow) | Reloads the dashboard, to display the current data. It can be set to reload automatically every 5 seconds to 1 day, using the drop down arrow. |
|
||||
|
||||
## Create a playlist
|
||||
|
||||
You create a playlist to present dashboards in a sequence, with a set order and time interval between dashboards.
|
||||
You can create a playlist to present dashboards in a sequence, with a set order and time interval between dashboards.
|
||||
|
||||
1. To access the Playlist feature, hover your cursor over Grafana's side menu.
|
||||
1. Click **Playlists**.
|
||||
1. Click **New playlist**.
|
||||
1. In the **Name** text box, enter a name for your playlist.
|
||||
1. In the **Interval** text box, enter a time interval.
|
||||
1. In the playlist page, click **New playlist**. The New playlist page opens.
|
||||
1. In the **Name** text box, enter a descriptive name.
|
||||
1. In the **Interval** text bos, enter a time interval. Grafana displays a particular dashboard for the interval of time specified here before moving on to the next dashboard.
|
||||
1. In Dashboards, add existing dashboards to the playlist using **Add by title** and **Add by tag** drop-down options. The dashboards you add are listed in a sequential order.
|
||||
1. If needed:
|
||||
- Search for a dashboard by its name, a regular expression, or a tag.
|
||||
- Filter your results by starred status or tags.
|
||||
1. If needed, rearrange the order of the dashboard you have added using the up and down arrow icon.
|
||||
1. Optionally, remove a dashboard from the playlist by clicking the x icon beside dashboard.
|
||||
1. Click **Save**.
|
||||
|
||||
The time interval is the amount of time for Grafana to stay on a particular dashboard before advancing to the next one on the playlist.
|
||||
{{< figure src="/static/img/docs/dashboards/create-playlist-8-2.png" max-width="25rem">}}
|
||||
|
||||
1. Next to the dashboard(s) you want to add to your playlist, click **Add to playlist**.
|
||||
1. Click **Create**.
|
||||
## Edit or delete a playlist
|
||||
|
||||
## Edit a playlist
|
||||
You can edit a playlist by updating its name, interval time, and by adding, removing, and rearranging the order of dashboards. On the rare occasion when you no longer need a playlist, you can delete it.
|
||||
|
||||
You can edit playlists while creating them or after saving them.
|
||||
### Edit a playlist
|
||||
|
||||
1. To access the Playlist feature, hover your cursor over Grafana's side menu.
|
||||
1. Click **Playlists**.
|
||||
1. Click on the Playlist that you want to edit.
|
||||
|
||||
### Edit the Name of a playlist
|
||||
|
||||
1. Double-click within the **Name** text box.
|
||||
1. Enter a name.
|
||||
1. Click **Save** to save your changes.
|
||||
|
||||
### Edit the Interval of a playlist
|
||||
|
||||
1. Double-click within the **Interval** text box.
|
||||
1. Enter a time interval.
|
||||
1. Click **Save** to save your changes.
|
||||
|
||||
### Add a dashboard to a playlist
|
||||
|
||||
1. Next to the dashboard you want to add, click **Add to playlist**.
|
||||
1. Click **Save** to save your changes.
|
||||
|
||||
### Search for a dashboard to add
|
||||
|
||||
1. Click the **Search dashboards by name** text box.
|
||||
1. Search for the playlist by name or regular expression.
|
||||
1. If needed, filter your results by starred status or tags.
|
||||
By default, your starred dashboards will appear as options to add to the Playlist.
|
||||
1. Click **Save** to save your changes.
|
||||
|
||||
### Rearrange dashboard order
|
||||
|
||||
1. Next to the dashboard you want to move, click the up or down arrow.
|
||||
1. Click **Save** to save your changes.
|
||||
|
||||
### Remove a dashboard
|
||||
|
||||
1. Click **Remove[x]** to remove a dashboard from the playlist.
|
||||
1. In the playlist page, click **Edit playlist**. The Edit playlist page opens.
|
||||
1. Update the name and time interval, then add or remove dashboards from the playlist using instructions in [Create a playlist](#create-a-playlist).
|
||||
1. Click **Save** to save your changes.
|
||||
|
||||
### Delete a playlist
|
||||
|
||||
1. Click **Playlists**.
|
||||
1. Next to the Playlist you want to delete, click **Remove[x]**.
|
||||
|
||||
## Save a playlist
|
||||
|
||||
You can save a playlist to add it to your **Playlists** page, where you can start it. Be sure that all the dashboards you want to appear in your playlist are added when creating or editing the playlist before saving it.
|
||||
|
||||
1. To access the Playlist feature, hover your cursor over Grafana's side menu.
|
||||
1. Click **Playlists**.
|
||||
1. Click on the playlist.
|
||||
1. Edit the playlist.
|
||||
* Ensure that your playlist has a **Name**, **Interval**, and at least one **Dashboard** added to it.
|
||||
1. Click **Save**.
|
||||
|
||||
## Start a playlist
|
||||
|
||||
You can start a playlist in five different view modes, which determine how the menus and navigation bar are displayed on the dashboards.
|
||||
|
||||
By default, each dashboard is displayed for the amount of time entered in the Interval field, which can be set while creating or editing a playlist. Once a playlist is started, it can be controlled using the navbar at the top of your screen.
|
||||
|
||||
1. From the Dashboards submenu, click **Playlists**.
|
||||
1. Next to the playlist you want to start, click **Start playlist**.
|
||||
1. In the dropdown, select the mode you want the playlist to display in.
|
||||
- **Normal mode:**
|
||||
- The side menu remains visible.
|
||||
- The navbar, row and panel controls appear at the top of the screen.
|
||||
- **TV mode:**
|
||||
- The side menu is hidden/removed.
|
||||
- The navbar, row and panel controls appear at the top of the screen.
|
||||
- Enabled automatically after one minute of user inactivity.
|
||||
- You can enable it manually using the `d v` sequence shortcut, or by appending the parameter `?inactive` to the dashboard URL.
|
||||
- You can disable it with any mouse movement or keyboard action.
|
||||
- **TV mode (with auto fit panels):**
|
||||
- The side menu is hidden/removed.
|
||||
- The navbar, row and panel controls appear at the top of the screen.
|
||||
- Dashboard panels automatically adjust to optimize space on screen.
|
||||
- **Kiosk mode:**
|
||||
- The side menu, navbar, row and panel controls are completely hidden/removed from view.
|
||||
- You can enable it manually using the `d v` sequence shortcut after the playlist has started.
|
||||
- You can disable it manually with the same shortcut.
|
||||
- **Kiosk mode (with auto fit panels):**
|
||||
- The side menu, navbar, row and panel controls are completely hidden/removed from view.
|
||||
- Dashboard panels automatically adjust to optimize space on screen.
|
||||
|
||||
## Control a playlist
|
||||
|
||||
You can control a playlist in **Normal** or **TV** mode after it's started, using the navigation bar at the top of your screen.
|
||||
|
||||
| Button | Result |
|
||||
| --- | --- |
|
||||
| Next (double-right arrow) | Advances to the next dashboard. |
|
||||
| Back (left arrow) | Returns to the previous dashboard. |
|
||||
| Stop (square) | Ends the playlist, and exits to the current dashboard. |
|
||||
| Cycle view mode (monitor icon) | Rotates the display of the dashboards in different view modes. |
|
||||
| Time range | Displays data within a time range. It can be set to display the last 5 minutes up to 5 years ago, or a custom time range, using the down arrow. |
|
||||
| Refresh (circle arrow) | Reloads the dashboard, to display the current data. It can be set to reload automatically every 5 seconds to 1 day, using the drop down arrow. |
|
||||
|
||||
> Shortcut: Press the Esc key to stop the playlist from your keyboard.
|
||||
1. In the playlist page, click **Edit playlist**. A prompts opens asking you to confirm the action.
|
||||
1. Click **delete**.
|
||||
|
||||
## Share a playlist in a view mode
|
||||
|
||||
You can share a playlist by copying the link address on the view mode you prefer, and pasting the URL to your destination.
|
||||
|
||||
1. From the Dashboards submenu, click **Playlists**.
|
||||
1. Next to the playlist you want to share, click **Start playlist**.
|
||||
1. In the dropdown, right click the view mode you prefer.
|
||||
1. Click **Copy Link Address** to copy the URL to your clipboard.
|
||||
1. From the Dashboards submenu, click **Playlists**.
|
||||
1. Next to the playlist you want to share, click **Start playlist**.
|
||||
1. In the dropdown, right click the view mode you prefer.
|
||||
1. Click **Copy Link Address** to copy the URL to your clipboard.
|
||||
|
||||
Example: The URL for the first playlist on the Grafana Play site in Kiosk mode will look like this:
|
||||
[https://play.grafana.org/playlists/play/1?kiosk](https://play.grafana.org/playlists/play/1?kiosk).
|
||||
1. Paste the URL to your destination.
|
||||
Example: The URL for the first playlist on the Grafana Play site in Kiosk mode will look like this:
|
||||
|
||||
[https://play.grafana.org/playlists/play/1?kiosk](https://play.grafana.org/playlists/play/1?kiosk).
|
||||
|
||||
1. Paste the URL to your destination.
|
||||
|
||||
@@ -5,7 +5,6 @@ aliases =["/docs/grafana/latest/reference/search/"]
|
||||
weight = 5
|
||||
+++
|
||||
|
||||
|
||||
# Dashboard Search
|
||||
|
||||
Dashboards can be searched by the dashboard name, filtered by one (or many) tags or filtered by starred status. The dashboard search is accessed through the dashboard picker, available in the dashboard top nav area. The dashboard search can also be opened by using the shortcut `F`.
|
||||
@@ -26,9 +25,10 @@ When using only a keyboard, you can use your keyboard arrow keys to navigate the
|
||||
Begin typing any part of the desired dashboard names in the search bar. Search will return results for any partial string match in real-time, as you type.
|
||||
|
||||
Dashboard search is:
|
||||
|
||||
- Real-time
|
||||
- *Not* case sensitive
|
||||
- Functional across stored *and* file based dashboards.
|
||||
- _Not_ case sensitive
|
||||
- Functional across stored _and_ file based dashboards.
|
||||
|
||||
## Filter by Tag(s)
|
||||
|
||||
@@ -38,6 +38,6 @@ To filter the dashboard list by tag, click on any tag appearing in the right col
|
||||
|
||||
Alternately, to see a list of all available tags, click the tags dropdown menu. All tags will be shown, and when a tag is selected, the dashboard search will be instantly filtered:
|
||||
|
||||
When using only a keyboard: `tab` to focus on the *tags* link, `▼` down arrow key to find a tag and select with the `Enter` key.
|
||||
When using only a keyboard: `tab` to focus on the _tags_ link, `▼` down arrow key to find a tag and select with the `Enter` key.
|
||||
|
||||
> **Note:** When multiple tags are selected, Grafana will show dashboards that include **all**.
|
||||
|
||||
@@ -31,7 +31,7 @@ Here are some examples:
|
||||
| This month so far | `now/M` | `now` |
|
||||
| Previous Month | `now-1M/M` | `now-1M/M` |
|
||||
| This year so far | `now/Y` | `now` |
|
||||
| This Year | `now/Y` | `now/Y |
|
||||
| This Year | `now/Y` | `now/Y` |
|
||||
|
||||
## Common time range controls
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Each data source has a specific Query Editor that is customized for the features
|
||||
The following data sources are officially supported:
|
||||
|
||||
- [Alertmanager]({{< relref "alertmanager.md" >}})
|
||||
- [AWS CloudWatch]({{< relref "cloudwatch.md" >}})
|
||||
- [AWS CloudWatch]({{< relref "aws-cloudwatch/_index.md" >}})
|
||||
- [Azure Monitor]({{< relref "azuremonitor/_index.md" >}})
|
||||
- [Elasticsearch]({{< relref "elasticsearch.md" >}})
|
||||
- [Google Cloud Monitoring]({{< relref "google-cloud-monitoring/_index.md" >}})
|
||||
|
||||
@@ -14,19 +14,19 @@ To add a data source:
|
||||
|
||||
1. Move your cursor to the cog icon on the side menu which will show the configuration options.
|
||||
|
||||
{{< figure src="/static/img/docs/v75/sidemenu-datasource-7-5.png" max-width="150px" class="docs-image--no-shadow">}}
|
||||
{{< figure src="/static/img/docs/v75/sidemenu-datasource-7-5.png" max-width="150px" class="docs-image--no-shadow">}}
|
||||
|
||||
1. Click on **Data sources**. The data sources page opens showing a list of previously configured data sources for the Grafana instance.
|
||||
|
||||
1. Click **Add data source** to see a list of all supported data sources.
|
||||
|
||||
{{< figure src="/static/img/docs/v75/add-data-source-7-5.png" max-width="600px" class="docs-image--no-shadow">}}
|
||||
{{< figure src="/static/img/docs/v75/add-data-source-7-5.png" max-width="600px" class="docs-image--no-shadow">}}
|
||||
|
||||
1. Search for a specific data source by entering the name in the search dialog. Or you can scroll through supported data sources grouped into time series, logging, tracing and other categories.
|
||||
|
||||
1. Move the cursor over the data source you want to add.
|
||||
|
||||
{{< figure src="/static/img/docs/v75/select-data-source-7-5.png" max-width="700px" class="docs-image--no-shadow">}}
|
||||
{{< figure src="/static/img/docs/v75/select-data-source-7-5.png" max-width="700px" class="docs-image--no-shadow">}}
|
||||
|
||||
1. Click **Select**. The data source configuration page opens.
|
||||
|
||||
|
||||
@@ -3,16 +3,14 @@ title = "Alertmanager"
|
||||
description = "Guide for using Alertmanager in Grafana"
|
||||
keywords = ["grafana", "prometheus", "guide"]
|
||||
aliases = ["/docs/grafana/latest/features/datasources/alertmanager"]
|
||||
weight = 1300
|
||||
weight = 150
|
||||
+++
|
||||
|
||||
# Alertmanager data source
|
||||
|
||||
Grafana includes built-in support for Prometheus Alertmanager. It is presently in alpha and not accessible unless [alpha plugins are enabled in Grafana settings](https://grafana.com/docs/grafana/latest/administration/configuration/#enable_alpha). Once you add it as a data source, you can use the [Grafana alerting UI](https://grafana.com/docs/grafana/latest/alerting/) to manage silences, contact points as well as notification policies. A drop down option in these pages allows you to switch between Grafana and any configured Alertmanager data sources .
|
||||
|
||||
>**Note:** New in Grafana 8.0.
|
||||
|
||||
>**Note:** Currently only the [Cortex implementation of Prometheus alertmanager](https://cortexmetrics.io/docs/proposals/scalable-alertmanager/) is supported.
|
||||
> **Note:** Currently, the [Cortex implementation of Prometheus Alertmanager](https://cortexmetrics.io/docs/proposals/scalable-alertmanager/) is required to edit rules.
|
||||
|
||||
## Provision the Alertmanager data source
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ weight = 200
|
||||
|
||||
Grafana ships with built-in support for CloudWatch. Add it as a data source, then you are ready to build dashboards or use Explore with CloudWatch metrics and CloudWatch Logs.
|
||||
|
||||
This topic explains options, variables, querying, and other options specific to this data source. Refer to [Add a data source]({{< relref "add-a-data-source.md" >}}) for instructions on how to add a data source to Grafana. Only users with the organization admin role can add data sources.
|
||||
This topic describes queries, templates, variables, and other configuration specific to the CloudWatch data source. For instructions on how to add a data source to Grafana, refer to [Add a data source]({{< relref "../add-a-data-source.md" >}}). Only users with the organization admin role can add data sources.
|
||||
|
||||
> **Note:** If you have issues with getting this data source to work and Grafana is giving you undescriptive errors, then check your log file (try looking in /var/log/grafana/grafana.log).
|
||||
> **Note:** If you are having issues setting up the data source and Grafana is returning undescriptive errors, then check the log file located in /var/log/grafana/grafana.log).
|
||||
|
||||
## Cloudwatch settings
|
||||
|
||||
@@ -31,21 +31,9 @@ To access data source settings, hover your mouse over the **Configuration** (gea
|
||||
|
||||
## Authentication
|
||||
|
||||
### AWS credentials
|
||||
For authentication options and configuration details, see [AWS authentication]({{< relref "aws-authentication.md" >}}) topic.
|
||||
|
||||
There are three different authentication methods available. `AWS SDK Default` performs no custom configuration at all and instead uses the [default provider](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html) as specified by the AWS SDK for Go. This requires you to configure your AWS credentials separately, such as if you've [configured the CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html), if you're [running on an EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html), [in an ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html) or for a [Service Account in a Kubernetes cluster](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html).
|
||||
|
||||
`Credentials file` corresponds directly to the [SharedCredentialsProvider](https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#SharedCredentialsProvider) provider in the Go SDK. In short, it will read the AWS shared credentials file and find the given profile. While `AWS SDK Default` will also find the shared credentials file, this option allows you to specify which profile to use without using environment variables. It doesn't have any implicit fallbacks to other credential providers, and will fail if using credentials from the credentials file doesn't work.
|
||||
|
||||
`Access & secret key` corresponds to the [StaticProvider](https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#StaticProvider) and uses the given access key ID and secret key to authenticate. This method doesn't have any fallbacks, and will fail if the provided key pair doesn't work.
|
||||
|
||||
### IAM roles
|
||||
|
||||
Currently all access to CloudWatch is done server side by the Grafana backend using the official AWS SDK. Providing you have chosen the _AWS SDK Default_ authentication method, and your Grafana server is running on AWS, you can use IAM Roles to handle authentication automically.
|
||||
|
||||
See the AWS documentation on [IAM Roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html)
|
||||
|
||||
### IAM policies
|
||||
## IAM policies
|
||||
|
||||
Grafana needs permissions granted via IAM to be able to read CloudWatch metrics
|
||||
and EC2 tags/instances/regions. You can attach these permissions to IAM roles and
|
||||
@@ -99,40 +87,6 @@ Here is a minimal policy example:
|
||||
}
|
||||
```
|
||||
|
||||
### Assuming a role
|
||||
|
||||
The `Assume Role ARN` field allows you to specify which IAM role to assume, if any. When left blank, the provided credentials are used directly and the associated role or user should have the required permissions. If this field is non-blank, on the other hand, the provided credentials are used to perform an [sts:AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) call.
|
||||
|
||||
### Endpoint
|
||||
|
||||
The `Endpoint` field allows you to specify a custom endpoint URL that overrides the default generated endpoint for the CloudWatch API. Leave this field blank if you want to use the default generated endpoint. For more information on why and how to use Service endpoints, refer to the [AWS service endpoints documentation](https://docs.aws.amazon.com/general/latest/gr/rande.html).
|
||||
|
||||
### EKS IAM roles for service accounts
|
||||
|
||||
The Grafana process in the container runs as user 472 (called "grafana"). When Kubernetes mounts your projected credentials, they will by default only be available to the root user. In order to allow user 472 to access the credentials (and avoid it falling back to the IAM role attached to the EC2 instance), you will need to provide a [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for your pod.
|
||||
|
||||
```yaml
|
||||
securityContext:
|
||||
fsGroup: 472
|
||||
runAsUser: 472
|
||||
runAsGroup: 472
|
||||
```
|
||||
|
||||
### AWS credentials file
|
||||
|
||||
Create a file at `~/.aws/credentials`. That is the `HOME` path for user running grafana-server.
|
||||
|
||||
> **Note:** If you think you have the credentials file in the right place and it is still not working, you might try moving your .aws file to '/usr/share/grafana/' and make sure your credentials file has at most 0644 permissions.
|
||||
|
||||
Example content:
|
||||
|
||||
```bash
|
||||
[default]
|
||||
aws_access_key_id = asdsadasdasdasd
|
||||
aws_secret_access_key = dasdasdsadasdasdasdsa
|
||||
region = us-west-2
|
||||
```
|
||||
|
||||
## Using the Query Editor
|
||||
|
||||
The CloudWatch data source can query data from both CloudWatch metrics and CloudWatch Logs APIs, each with its own specialized query editor. You select which API you want to query with using the query mode switch on top of the editor.
|
||||
@@ -146,22 +100,18 @@ To create a valid query, you need to specify the namespace, metric name and at l
|
||||
|
||||
### Dynamic queries using dimension wildcards
|
||||
|
||||
> Only available in Grafana v6.5+.
|
||||
|
||||
In Grafana 6.5 or higher, you’re able to monitor a dynamic list of metrics by using the asterisk (\*) wildcard for one or more dimension values.
|
||||
You can monitor a dynamic list of metrics by using the asterisk (\*) wildcard for one or more dimension values.
|
||||
|
||||
{{< figure src="/static/img/docs/v65/cloudwatch-dimension-wildcard.png" max-width="800px" class="docs-image--right" caption="CloudWatch dimension wildcard" >}}
|
||||
|
||||
In the example, all metrics in the namespace `AWS/EC2` with a metric name of `CPUUtilization` and ANY value for the `InstanceId` dimension are queried. This can help you monitor metrics for AWS resources, like EC2 instances or containers. For example, when new instances get created as part of an auto scaling event, they will automatically appear in the graph without you having to track the new instance IDs. This capability is currently limited to retrieving up to 100 metrics. You can click on `Show Query Preview` to see the search expression that is automatically built to support wildcards. To learn more about search expressions, visit the [CloudWatch documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-syntax.html).
|
||||
In this example, the query returns all metrics in the namespace `AWS/EC2` with a metric name of `CPUUtilization` and ANY value for the `InstanceId` dimension are queried. This can help you monitor metrics for AWS resources, like EC2 instances or containers. For example, when new instances are created as part of an auto scaling event, they will automatically appear in the graph without needing to track the new instance IDs. This capability is currently limited to retrieving up to 100 metrics.
|
||||
|
||||
By default, the search expression is defined in such a way that the queried metrics must match the defined dimension names exactly. This means that in the example only metrics with exactly one dimension with name ‘InstanceId’ will be returned.
|
||||
Click on `Show Query Preview` to see the search expression that is automatically built to support wildcards. To learn more about search expressions, visit the [CloudWatch documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/search-expression-syntax.html). By default, the search expression is defined in such a way that the queried metrics must match the defined dimension names exactly. This means that in the example only metrics with exactly one dimension with name ‘InstanceId’ will be returned.
|
||||
|
||||
You can untoggle `Match Exact` to include metrics that have other dimensions defined. Disabling `Match Exact` also creates a search expression even if you don’t use wildcards. We simply search for any metric that matches at least the namespace, metric name, and all defined dimensions.
|
||||
|
||||
### Multi-value template variables
|
||||
|
||||
> Only available in Grafana v6.5+.
|
||||
|
||||
When defining dimension values based on multi-valued template variables, a search expression is used to query for the matching metrics. This enables the use of multiple template variables in one query and also allows you to use template variables for queries that have the `Match Exact` option disabled.
|
||||
|
||||
Search expressions are currently limited to 1024 characters, so your query may fail if you have a long list of values. We recommend using the asterisk (`*`) wildcard instead of the `All` option if you want to query all metrics that have any value for a certain dimension name.
|
||||
@@ -192,8 +142,6 @@ This feature is not available for metrics that are based on metric math expressi
|
||||
|
||||
## Using the Logs Query Editor
|
||||
|
||||
> **Note:** Available in Grafana v7.0+.
|
||||
|
||||
To query CloudWatch Logs, select the region and up to 20 log groups which you want to query. Use the main input area to write your query in [CloudWatch Logs Query Language](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)
|
||||
|
||||
You can also write queries returning time series data by using the [`stats` command](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_Insights-Visualizing-Log-Data.html). When making `stats` queries in Explore, you have to make sure you are in Metrics Explore mode.
|
||||
@@ -206,8 +154,8 @@ To the right of the query input field is a CloudWatch Logs Insights link that op
|
||||
|
||||
### Using template variables
|
||||
|
||||
As with several other data sources, the CloudWatch data source supports the use of template variables in queries.
|
||||
See the [Templating]({{< relref "../variables/_index.md" >}}) documentation for an introduction to the templating feature and the different types of template variables.
|
||||
The CloudWatch data source supports use of template variables in queries.
|
||||
For an introduction to templating and template variables, refer to the [Templating]({{< relref "../../variables/_index.md" >}}) documentation.
|
||||
|
||||
### Deep linking from Grafana panels to the CloudWatch console
|
||||
|
||||
@@ -218,7 +166,7 @@ If you're not currently logged in to the CloudWatch console, the link will forwa
|
||||
### Alerting
|
||||
|
||||
Since CloudWatch Logs queries can return numeric data, for example through the use of the `stats` command, alerts are supported.
|
||||
See the [Alerting]({{< relref "../alerting/_index.md" >}}) documentation for more on Grafana alerts.
|
||||
For more information on Grafana alerts, refer to [Alerting]({{< relref "../../alerting/_index.md" >}}) documentation.
|
||||
|
||||
## Curated dashboards
|
||||
|
||||
@@ -236,9 +184,9 @@ To import the pre-configured dashboards, go to the configuration page of your Cl
|
||||
|
||||
## Templated queries
|
||||
|
||||
Instead of hard-coding things like server, application and sensor name in your metric queries you can use variables in their place. Variables are shown as dropdown select boxes at the top of the dashboard. These dropdowns make it easy to change the data being displayed in your dashboard.
|
||||
Instead of hard-coding server, application, and sensor names in your metric queries, you can use variables. The variables are listed as dropdown select boxes at the top of the dashboard. These dropdowns make it easy to change the display of data in your dashboard.
|
||||
|
||||
See the [Templating]({{< relref "../variables/_index.md" >}}) documentation for an introduction to the templating feature and the different types of template variables.
|
||||
For an introduction to templating and template variables, refer to the [Templating]({{< relref "../../variables/_index.md" >}}) documentation.
|
||||
|
||||
### Query variable
|
||||
|
||||
@@ -371,7 +319,7 @@ Please see the AWS documentation for [Service Quotas](https://docs.aws.amazon.co
|
||||
|
||||
## Configure the data source with grafana.ini
|
||||
|
||||
In the Grafana [configuration]({{< relref "../administration/configuration.md#aws" >}}) file, there's an `AWS` section that allows you to customize the data source.
|
||||
The Grafana [configuration]({{< relref "../../administration/configuration.md#aws" >}}) file includes an `AWS` section where you can customize the data source.
|
||||
|
||||
### allowed_auth_providers
|
||||
|
||||
@@ -387,7 +335,7 @@ When a custom namespace is specified in the query editor, the [List Metrics API]
|
||||
|
||||
## Configure the data source with provisioning
|
||||
|
||||
It's now possible to configure data sources using config files with Grafana's provisioning system. You can read more about how it works and all the settings you can set for data sources on the [provisioning docs page]({{< relref "../administration/provisioning/#datasources" >}})
|
||||
You can configure the CloudWatch data source by customizing configuration files in Grafana's provisioning system. To know more about provisioning and learn about available configuration options, refer to the [Provisioning Grafana]({{< relref "../../administration/provisioning/#datasources" >}}) topic.
|
||||
|
||||
Here are some provisioning examples for this data source.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
+++
|
||||
title = "Authentication"
|
||||
description = "AWS authentication"
|
||||
keywords = ["grafana", "aws", "authentication"]
|
||||
aliases = ["/docs/grafana/latest/datasources/cloudwatch"]
|
||||
weight = 205
|
||||
+++
|
||||
|
||||
# AWS authentication
|
||||
|
||||
You can use one of the following authentication methods. All of these methods are enabled by default. You can disable them if necessary if you have server configuration access. For more information, refer to [allowed_auth_providers]({{< relref "../../administration/configuration.md#allowed_auth_providers" >}}) documentation.
|
||||
|
||||
- `AWS SDK Default` performs no custom configuration and instead uses the [default provider](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html) as specified by the AWS SDK for Go. It requires you to configure your AWS credentials separately, such as if you've [configured the CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html), if you're [running on an EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html), [in an ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html), or for a [Service Account in a Kubernetes cluster](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html).
|
||||
|
||||
- `Credentials file` corresponds directly to the [SharedCredentialsProvider](https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#SharedCredentialsProvider) provider in the Go SDK. It reads the AWS shared credentials file to find a given profile. While `AWS SDK Default` will also find the shared credentials file, this option allows you to specify which profile to use without using environment variables. This option doesn't have any implicit fallbacks to other credential providers, and it fails if the credentials provided from the file aren't correct.
|
||||
|
||||
- `Access and secret key` corresponds to the [StaticProvider](https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials/#StaticProvider) and uses the given access key ID and secret key to authenticate. This method doesn't have any fallbacks, and will fail if the provided key pair doesn't work.
|
||||
|
||||
> **Note:** Grafana also supports the `Workspace IAM role` method. We will be add documentation for this authentication method soon.
|
||||
|
||||
## IAM roles
|
||||
|
||||
Currently all access to CloudWatch is done server side by the Grafana backend using the official AWS SDK. If you are using the _AWS SDK Default_ authentication method, and your Grafana server is running on AWS, use IAM Roles to handle authentication automatically.
|
||||
|
||||
For more information, refer to the AWS documentation on [IAM Roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html).
|
||||
|
||||
> **Note:** IAM policies are data source specific. Refer to Authentication section of the [Cloudwatch]({{< relref "./_index.md" >}}) topic for more information.
|
||||
|
||||
## Assuming a role
|
||||
|
||||
The `Assume Role ARN` field allows you to specify which IAM role to assume. When left blank, the provided credentials are used directly and the associated role or user should have the required permissions. If this field is non-blank, on the other hand, the provided credentials are used to perform an [sts:AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) call.
|
||||
|
||||
If you set this field to `false` then AWS authentication no longer uses an assumed role. For more information, refer to [assume_role_enabled]({{< relref "../../administration/configuration.md#assume_role_enabled" >}}) documentation.
|
||||
|
||||
## Endpoint
|
||||
|
||||
The `Endpoint` field allows you to specify a custom endpoint URL that overrides the default generated endpoint for the CloudWatch API. Leave this field blank if you want to use the default generated endpoint. For more information on why and how to use Service endpoints, refer to the [AWS service endpoints documentation](https://docs.aws.amazon.com/general/latest/gr/rande.html).
|
||||
|
||||
## EKS IAM roles for service accounts
|
||||
|
||||
The Grafana process in the container runs as user 472 (called "grafana"). When Kubernetes mounts your projected credentials, they will by default only be available to the root user. To allow user 472 to access the credentials (and avoid falling back to the IAM role attached to the EC2 instance), you need to provide a [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for your pod.
|
||||
|
||||
```yaml
|
||||
securityContext:
|
||||
fsGroup: 472
|
||||
runAsUser: 472
|
||||
runAsGroup: 472
|
||||
```
|
||||
|
||||
## AWS credentials file
|
||||
|
||||
Create a file at `~/.aws/credentials`. That is the `HOME` path for user running grafana-server.
|
||||
|
||||
> **Note:** If you think you have the credentials file in the right place and it is still not working, you might try moving your .aws file to '/usr/share/grafana/' and make sure your credentials file has at most 0644 permissions.
|
||||
|
||||
Example content:
|
||||
|
||||
```bash
|
||||
[default]
|
||||
aws_access_key_id = asdsadasdasdasd
|
||||
aws_secret_access_key = dasdasdsadasdasdasdsa
|
||||
region = us-west-2
|
||||
```
|
||||
@@ -3,7 +3,7 @@ title = "Elasticsearch"
|
||||
description = "Guide for using Elasticsearch in Grafana"
|
||||
keywords = ["grafana", "elasticsearch", "guide"]
|
||||
aliases = ["/docs/grafana/latest/features/datasources/elasticsearch"]
|
||||
weight = 400
|
||||
weight = 325
|
||||
+++
|
||||
|
||||
# Using Elasticsearch in Grafana
|
||||
@@ -16,7 +16,7 @@ visualize logs or metrics stored in Elasticsearch. You can also annotate your gr
|
||||
1. Open the side menu by clicking the Grafana icon in the top header.
|
||||
1. In the side menu under the `Dashboards` link you should find a link named `Data Sources`.
|
||||
1. Click the `+ Add data source` button in the top header.
|
||||
1. Select *Elasticsearch* from the *Type* dropdown.
|
||||
1. Select **Elasticsearch** from the **Type** dropdown.
|
||||
|
||||
> **Note:** If you're not seeing the `Data Sources` link in your side menu it means that your current user does not have the `Admin` role for the current organization.
|
||||
|
||||
@@ -61,7 +61,7 @@ Available Elasticsearch versions are `2.x`, `5.x`, `5.6+`, `6.0+`, `7.0+`, `7.7+
|
||||
|
||||
Grafana assumes that you are running the lowest possible version for a specified range. This ensures that new features or breaking changes in a future Elasticsearch release will not affect your configuration.
|
||||
|
||||
For example, suppose you are running Elasticsearch `7.6.1` and you selected `7.0+`. If a new feature is made available for Elasticsearch `7.5.0` or newer releases, then a `7.5+` option will be available. However, your configuration will not be affected until you explicitly select the new `7.5+` option in your settings.
|
||||
For example, suppose you are running Elasticsearch `7.6.1` and you selected `7.0+`. If a new feature is made available for Elasticsearch `7.5.0` or newer releases, then a `7.5+` option will be available. However, your configuration will not be affected until you explicitly select the new `7.5+` option in your settings.
|
||||
|
||||
### Min time interval
|
||||
|
||||
@@ -87,6 +87,7 @@ Enables `X-Pack` specific features and options, providing the query editor with
|
||||
#### Include frozen indices
|
||||
|
||||
When `X-Pack enabled` is active and the configured Elasticsearch version is higher than `6.6.0`, you can configure Grafana to not ignore [frozen indices](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/frozen-indices.html) when performing search requests.
|
||||
|
||||
### Logs
|
||||
|
||||
There are two parameters, `Message field name` and `Level field name`, that can optionally be configured from the data source settings page that determine
|
||||
@@ -94,7 +95,7 @@ which fields will be used for log messages and log levels when visualizing logs
|
||||
|
||||
For example, if you're using a default setup of Filebeat for shipping logs to Elasticsearch the following configuration should work:
|
||||
|
||||
- **Message field name:** message
|
||||
- **Message field name:** message
|
||||
- **Level field name:** fields.level
|
||||
|
||||
### Data links
|
||||
@@ -102,8 +103,10 @@ For example, if you're using a default setup of Filebeat for shipping logs to El
|
||||
Data links create a link from a specified field that can be accessed in logs view in Explore.
|
||||
|
||||
Each data link configuration consists of:
|
||||
|
||||
- **Field -** Name of the field used by the data link.
|
||||
- **URL/query -** If the link is external, then enter the full link URL. If the link is internal link, then this input serves as query for the target data source. In both cases, you can interpolate the value from the field with `${__value.raw }` macro.
|
||||
- **URL Label -** (Optional) Set a custom display label for the link. The link label defaults to the full external URL or name of the linked internal data source and is overridden by this setting.
|
||||
- **Internal link -** Select if the link is internal or external. In case of internal link, a data source selector allows you to select the target data source. Only tracing data sources are supported.
|
||||
|
||||
## Metric Query editor
|
||||
@@ -125,7 +128,7 @@ You can control the name for time series via the `Alias` input field.
|
||||
|
||||
## Pipeline metrics
|
||||
|
||||
Some metric aggregations are called Pipeline aggregations, for example, *Moving Average* and *Derivative*. Elasticsearch pipeline metrics require another metric to be based on. Use the eye icon next to the metric to hide metrics from appearing in the graph. This is useful for metrics you only have in the query for use in a pipeline metric.
|
||||
Some metric aggregations are called Pipeline aggregations, for example, _Moving Average_ and _Derivative_. Elasticsearch pipeline metrics require another metric to be based on. Use the eye icon next to the metric to hide metrics from appearing in the graph. This is useful for metrics you only have in the query for use in a pipeline metric.
|
||||
|
||||

|
||||
|
||||
@@ -140,7 +143,7 @@ types of template variables.
|
||||
|
||||
### Query variable
|
||||
|
||||
The Elasticsearch data source supports two types of queries you can use in the *Query* field of *Query* variables. The query is written using a custom JSON string.
|
||||
The Elasticsearch data source supports two types of queries you can use in the _Query_ field of _Query_ variables. The query is written using a custom JSON string.
|
||||
|
||||
| Query | Description |
|
||||
| -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
@@ -171,16 +174,16 @@ To keep terms in the doc count order, set the variable's Sort dropdown to **Disa
|
||||
|
||||
There are two syntaxes:
|
||||
|
||||
- `$<varname>` Example: @hostname:$hostname
|
||||
- `$<varname>` Example: @hostname:$hostname
|
||||
- `[[varname]]` Example: @hostname:[[hostname]]
|
||||
|
||||
Why two ways? The first syntax is easier to read and write but does not allow you to use a variable in the middle of a word. When the *Multi-value* or *Include all value*
|
||||
Why two ways? The first syntax is easier to read and write but does not allow you to use a variable in the middle of a word. When the _Multi-value_ or _Include all value_
|
||||
options are enabled, Grafana converts the labels from plain text to a lucene compatible condition.
|
||||
|
||||

|
||||
|
||||
In the above example, we have a lucene query that filters documents based on the `@hostname` property using a variable named `$hostname`. It is also using
|
||||
a variable in the *Terms* group by field input box. This allows you to use a variable to quickly change how the data is grouped.
|
||||
In the above example, we have a lucene query that filters documents based on the `@hostname` property using a variable named `$hostname`. It is also using
|
||||
a variable in the _Terms_ group by field input box. This allows you to use a variable to quickly change how the data is grouped.
|
||||
|
||||
Example dashboard:
|
||||
[Elasticsearch Templated Dashboard](https://play.grafana.org/d/CknOEXDMk/elasticsearch-templated?orgId=1d)
|
||||
@@ -192,7 +195,7 @@ queries via the Dashboard menu / Annotations view. Grafana can query any Elastic
|
||||
for annotation events.
|
||||
|
||||
| Name | Description |
|
||||
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `Query` | You can leave the search query blank or specify a lucene query. |
|
||||
| `Time` | The name of the time field, needs to be date field. |
|
||||
| `Time End` | Optional name of the time end field needs to be date field. If set, then annotations will be marked as a region between time and time-end. |
|
||||
@@ -201,7 +204,7 @@ for annotation events.
|
||||
|
||||
## Querying Logs
|
||||
|
||||
Querying and displaying log data from Elasticsearch is available in [Explore]({{< relref "../explore" >}}), and in the [logs panel]({{< relref "../panels/visualizations/logs-panel.md" >}}) in dashboards.
|
||||
Querying and displaying log data from Elasticsearch is available in [Explore]({{< relref "../explore" >}}), and in the [logs panel]({{< relref "../visualizations/logs-panel.md" >}}) in dashboards.
|
||||
Select the Elasticsearch data source, and then optionally enter a lucene query to display your logs.
|
||||
|
||||
When switching from a Prometheus or Loki data source in Explore, your query is translated to an Elasticsearch log query with a correct Lucene filter.
|
||||
@@ -229,11 +232,11 @@ datasources:
|
||||
- name: Elastic
|
||||
type: elasticsearch
|
||||
access: proxy
|
||||
database: "[metrics-]YYYY.MM.DD"
|
||||
database: '[metrics-]YYYY.MM.DD'
|
||||
url: http://localhost:9200
|
||||
jsonData:
|
||||
interval: Daily
|
||||
timeField: "@timestamp"
|
||||
timeField: '@timestamp'
|
||||
```
|
||||
|
||||
or, for logs:
|
||||
@@ -245,18 +248,18 @@ datasources:
|
||||
- name: elasticsearch-v7-filebeat
|
||||
type: elasticsearch
|
||||
access: proxy
|
||||
database: "[filebeat-]YYYY.MM.DD"
|
||||
database: '[filebeat-]YYYY.MM.DD'
|
||||
url: http://localhost:9200
|
||||
jsonData:
|
||||
interval: Daily
|
||||
timeField: "@timestamp"
|
||||
esVersion: "7.0.0"
|
||||
timeField: '@timestamp'
|
||||
esVersion: '7.0.0'
|
||||
logMessageField: message
|
||||
logLevelField: fields.level
|
||||
dataLinks:
|
||||
- datasourceUid: my_jaeger_uid # Target UID needs to be known
|
||||
field: traceID
|
||||
url: "$${__value.raw}" # Careful about the double "$$" because of env var expansion
|
||||
url: '$${__value.raw}' # Careful about the double "$$" because of env var expansion
|
||||
```
|
||||
|
||||
## Amazon Elasticsearch Service
|
||||
@@ -271,6 +274,6 @@ For more details on AWS SigV4, refer to the [AWS documentation](https://docs.aws
|
||||
|
||||
In order to sign requests to your Amazon Elasticsearch Service domain, SigV4 can be enabled in the Grafana [configuration]({{< relref "../administration/configuration.md#sigv4_auth_enabled" >}}).
|
||||
|
||||
Once AWS SigV4 is enabled, it can be configured on the Elasticsearch data source configuration page. Refer to [Cloudwatch authentication]({{<relref "./cloudwatch.md#authentication" >}}) for more information about authentication options.
|
||||
Once AWS SigV4 is enabled, it can be configured on the Elasticsearch data source configuration page. Refer to [Cloudwatch authentication]({{< relref "../datasources/aws-cloudwatch/aws-authentication.md" >}}) for more information about authentication options.
|
||||
|
||||
{{< figure src="/static/img/docs/v73/elasticsearch-sigv4-config-editor.png" max-width="500px" class="docs-image--no-shadow" caption="SigV4 configuration for AWS Elasticsearch Service" >}}
|
||||
|
||||
@@ -3,7 +3,7 @@ title = "Google Cloud Monitoring"
|
||||
description = "Guide for using Google Cloud Monitoring in Grafana"
|
||||
keywords = ["grafana", "stackdriver", "google", "guide", "cloud", "monitoring"]
|
||||
aliases = ["/docs/grafana/latest/features/datasources/stackdriver", "/docs/grafana/next/datasources/cloudmonitoring/", "/docs/grafana/next/features/datasources/cloudmonitoring/"]
|
||||
weight = 200
|
||||
weight = 350
|
||||
+++
|
||||
|
||||
# Using Google Cloud Monitoring in Grafana
|
||||
|
||||
@@ -9,6 +9,7 @@ weight = 10
|
||||
# Preconfigured Cloud Monitoring dashboards
|
||||
|
||||
Google Cloud Monitoring data source ships with pre-configured dashboards for some of the most popular GCP services. These curated dashboards are based on similar dashboards in the GCP dashboard samples repository. See also, [Using Google Cloud Monitoring in Grafana]({{< relref "./_index.md" >}}) for detailed instructions on how to add and configure the Google Cloud Monitoring data source.
|
||||
|
||||
## Curated dashboards
|
||||
|
||||
To import the curated dashboards:
|
||||
@@ -19,6 +20,6 @@ To import the curated dashboards:
|
||||
|
||||
The data source of the newly created dashboard panels will be the one selected above. The dashboards have a template variable that is populated with the projects accessible by the configured service account every time the dashboard is loaded. After the dashboard is loaded, you can select the project you prefer from the drop-down list.
|
||||
|
||||
In case you want to customize a dashboard, we recommend that you save it under a different name. Otherwise the dashboard will be overwritten when a new version of the dashboard is released.
|
||||
In case you want to customize a dashboard, we recommend that you save it under a different name. Otherwise the dashboard will be overwritten when a new version of the dashboard is released.
|
||||
|
||||
{{< figure src="/static/img/docs/google-cloud-monitoring/curated-dashboards-7-4.png" max-width= "650px" >}}
|
||||
|
||||
@@ -18,32 +18,21 @@ Refer to [Add a data source]({{< relref "add-a-data-source.md" >}}) for instruct
|
||||
|
||||
To access Graphite settings, hover your mouse over the **Configuration** (gear) icon, then click **Data Sources**, and then click the Graphite data source.
|
||||
|
||||
Name | Description
|
||||
--------------------- | -------------
|
||||
`Name` | The data source name. This is how you refer to the data source in panels and queries.
|
||||
`Default` | Default data source means that it will be pre-selected for new panels.
|
||||
`URL` | The HTTP protocol, IP, and port of your graphite-web or graphite-api install.
|
||||
`Access` | Server (default) = URL needs to be accessible from the Grafana backend/server, Browser = URL needs to be accessible from the browser.
|
||||
`Auth` | Refer to [Authentication]({{< relref "../auth/_index.md" >}}) for more information.
|
||||
`Basic Auth` | Enable basic authentication to the data source.
|
||||
`User` | User name for basic authentication.
|
||||
`Password` | Password for basic authentication.
|
||||
`Custom HTTP Headers` | Click **Add header** to add a custom HTTP header.
|
||||
`Header` | Enter the custom header name.
|
||||
`Value` | Enter the custom header value.
|
||||
`Graphite details` |
|
||||
`Version` | Select your version of Graphite.
|
||||
`Type` | Select your type of Graphite.
|
||||
|
||||
Access mode controls how requests to the data source will be handled. Server should be the preferred way if nothing else is stated.
|
||||
|
||||
### Server access mode (default)
|
||||
|
||||
All requests will be made from the browser to Grafana backend/server which in turn will forward the requests to the data source and by that circumvent possible Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the Grafana backend/server if you select this access mode.
|
||||
|
||||
### Browser access mode
|
||||
|
||||
All requests will be made from the browser directly to the data source and may be subject to Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the browser if you select this access mode.
|
||||
| Name | Description |
|
||||
| --------------------- | ------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `URL` | The HTTP protocol, IP, and port of your graphite-web or graphite-api install. |
|
||||
| `Auth` | Refer to [Authentication]({{< relref "../auth/_index.md" >}}) for more information. |
|
||||
| `Basic Auth` | Enable basic authentication to the data source. |
|
||||
| `User` | User name for basic authentication. |
|
||||
| `Password` | Password for basic authentication. |
|
||||
| `Custom HTTP Headers` | Click **Add header** to add a custom HTTP header. |
|
||||
| `Header` | Enter the custom header name. |
|
||||
| `Value` | Enter the custom header value. |
|
||||
| `Graphite details` |
|
||||
| `Version` | Select your version of Graphite. |
|
||||
| `Type` | Select your type of Graphite. |
|
||||
|
||||
## Graphite query editor
|
||||
|
||||
@@ -62,6 +51,7 @@ Click **Select metric** to start navigating the metric space. Once you start, yo
|
||||
|
||||
Click the plus icon next to **Function** to add a function. You can search for the function or select it from the menu. Once
|
||||
a function is selected, it will be added and your focus will be in the text box of the first parameter.
|
||||
|
||||
- To edit or change a parameter, click on it and it will turn into a text box.
|
||||
- To delete a function, click the function name followed by the x icon.
|
||||
|
||||
@@ -78,13 +68,13 @@ If you want consistent ordering, use sortByName. This can be particularly annoyi
|
||||
|
||||
### Nested queries
|
||||
|
||||
You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to a graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries.
|
||||
You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to a graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries.
|
||||
|
||||
### Avoiding many queries by using wildcards
|
||||
|
||||
Occasionally one would like to see multiple time series plotted on the same graph. For example we might want to see how the CPU is being utilized on a machine. You might
|
||||
initially create the graph by adding a query for each time series, such as `cpu.percent.user.g`,
|
||||
`cpu.percent.system.g`, and so on. This results in *n* queries made to the data source, which is inefficient.
|
||||
`cpu.percent.system.g`, and so on. This results in _n_ queries made to the data source, which is inefficient.
|
||||
|
||||
To be more efficient one can use wildcards in your search, returning all the time series in one query. For example, `cpu.percent.*.g`.
|
||||
|
||||
@@ -114,7 +104,7 @@ When exploring data, previously-selected tags are used to filter the remaining r
|
||||
The Grafana query builder does this for you automatically when you select a tag.
|
||||
|
||||
> **Tip:** The regular expression search can be quite slow on high-cardinality tags, so try to use other tags to reduce the scope first.
|
||||
Starting off with a particular name/namespace can help reduce the results.
|
||||
> Starting off with a particular name/namespace can help reduce the results.
|
||||
|
||||
## Template variables
|
||||
|
||||
@@ -126,13 +116,13 @@ For more information, refer to [Variables and templates]({{< relref "../variable
|
||||
|
||||
Graphite 1.1 introduced tags and Grafana added support for Graphite queries with tags in version 5.0. To create a variable using tag values, use the Grafana functions `tags` and `tag_values`.
|
||||
|
||||
Query | Description
|
||||
----------------------------------------------------------- | -------------
|
||||
`tags()` | Returns all tags.
|
||||
`tags(server=~backend\*)` | Returns only tags that occur in series matching the filter expression.
|
||||
`tag_values(server)` | Return tag values for the specified tag.
|
||||
`tag_values(server, server=~backend\*)` | Returns filtered tag values that occur for the specified tag in series matching those expressions.
|
||||
`tag_values(server, server=~backend\*, app=~${apps:regex})` | Multiple filter expressions and expressions can contain other variables.
|
||||
| Query | Description |
|
||||
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `tags()` | Returns all tags. |
|
||||
| `tags(server=~backend\*)` | Returns only tags that occur in series matching the filter expression. |
|
||||
| `tag_values(server)` | Return tag values for the specified tag. |
|
||||
| `tag_values(server, server=~backend\*)` | Returns filtered tag values that occur for the specified tag in series matching those expressions. |
|
||||
| `tag_values(server, server=~backend\*, app=~${apps:regex})` | Multiple filter expressions and expressions can contain other variables. |
|
||||
|
||||
For more details, see the [Graphite docs on the autocomplete API for tags](http://graphite.readthedocs.io/en/latest/tags.html#auto-complete-support).
|
||||
|
||||
@@ -149,20 +139,21 @@ use expand function (`expand(*.servers.*)`).
|
||||
The expanded query returns the full names of matching metrics. In combination with regex, it can extract any part of the metric name. By contrast, a non-expanded query only returns the last part of the metric name. It does not allow you to extract other parts of metric names.
|
||||
|
||||
Here are some example metrics:
|
||||
|
||||
- `prod.servers.001.cpu`
|
||||
- `prod.servers.002.cpu`
|
||||
- `test.servers.001.cpu`
|
||||
|
||||
The following examples show how expanded and non-expanded queries can be used to fetch specific parts of the metrics name.
|
||||
|
||||
| non-expanded query | results | expanded query | expanded results |
|
||||
|--------------|---------|----------------|------------------|
|
||||
| `*` | prod, test | `expand(*)` | prod, test
|
||||
| `*.servers` | servers | `expand(*.servers)` | prod.servers, test.servers |
|
||||
| `test.servers` | servers | `expand(test.servers)` | test.servers |
|
||||
| `*.servers.*` | 001,002 | `expand(*.servers.*)` | prod.servers.001, prod.servers.002, test.servers.001 |
|
||||
| `test.servers.*` | 001 | `expand(test.servers.*)` | test.servers.001 |
|
||||
| `*.servers.*.cpu` | cpu | `expand(*.servers.*.cpu)` | prod.servers.001.cpu, prod.servers.002.cpu, test.servers.001.cpu |
|
||||
| non-expanded query | results | expanded query | expanded results |
|
||||
| ------------------ | ---------- | ------------------------- | ---------------------------------------------------------------- |
|
||||
| `*` | prod, test | `expand(*)` | prod, test |
|
||||
| `*.servers` | servers | `expand(*.servers)` | prod.servers, test.servers |
|
||||
| `test.servers` | servers | `expand(test.servers)` | test.servers |
|
||||
| `*.servers.*` | 001,002 | `expand(*.servers.*)` | prod.servers.001, prod.servers.002, test.servers.001 |
|
||||
| `test.servers.*` | 001 | `expand(test.servers.*)` | test.servers.001 |
|
||||
| `*.servers.*.cpu` | cpu | `expand(*.servers.*.cpu)` | prod.servers.001.cpu, prod.servers.002.cpu, test.servers.001.cpu |
|
||||
|
||||
As you can see from the results, the non-expanded query is the same as an expanded query with a regex matching the last part of the name.
|
||||
|
||||
@@ -170,6 +161,7 @@ You can also create nested variables that use other variables in their definitio
|
||||
`apps.$app.servers.*` uses the variable `$app` in its query definition.
|
||||
|
||||
#### Using `__searchFilter` to filter query variable results
|
||||
|
||||
> Available from Grafana 6.5 and above
|
||||
|
||||
Using `__searchFilter` in the query field will filter the query result based on what the user types in the dropdown select box.
|
||||
@@ -178,11 +170,13 @@ When nothing has been entered by the user the default value for `__searchFilter`
|
||||
The example below shows how to use `__searchFilter` as part of the query field to enable searching for `server` while the user types in the dropdown select box.
|
||||
|
||||
Query
|
||||
|
||||
```bash
|
||||
apps.$app.servers.$__searchFilter
|
||||
```
|
||||
|
||||
TagValues
|
||||
|
||||
```bash
|
||||
tag_values(server, server=~${__searchFilter:regex})
|
||||
```
|
||||
@@ -194,11 +188,11 @@ You can use a variable in a metric node path or as a parameter to a function.
|
||||
|
||||
There are two syntaxes:
|
||||
|
||||
- `$<varname>` Example: apps.frontend.$server.requests.count
|
||||
- `$<varname>` Example: apps.frontend.$server.requests.count
|
||||
- `${varname}` Example: apps.frontend.${server}.requests.count
|
||||
|
||||
Why two ways? The first syntax is easier to read and write but does not allow you to use a variable in the middle of a word. Use
|
||||
the second syntax in expressions like `my.server${serverNumber}.count`.
|
||||
the second syntax in expressions like `my.server${serverNumber}.count`.
|
||||
|
||||
Example:
|
||||
[Graphite Templated Dashboard](https://play.grafana.org/dashboard/db/graphite-templated-nested)
|
||||
@@ -242,7 +236,7 @@ datasources:
|
||||
access: proxy
|
||||
url: http://localhost:8080
|
||||
jsonData:
|
||||
graphiteVersion: "1.1"
|
||||
graphiteVersion: '1.1'
|
||||
```
|
||||
|
||||
## Integration with Loki
|
||||
|
||||
@@ -19,25 +19,26 @@ To access data source settings, hover your mouse over the **Configuration** (gea
|
||||
InfluxDB data source options differ depending on which [query language](#query-languages) you select: InfluxQL or Flux.
|
||||
|
||||
> **Note:** Though not required, it's a good practice to append the language choice to the data source name. For example:
|
||||
>
|
||||
- InfluxDB-InfluxQL
|
||||
- InfluxDB-Flux
|
||||
|
||||
- InfluxDB-InfluxQL
|
||||
- InfluxDB-Flux
|
||||
|
||||
### InfluxQL (classic InfluxDB query)
|
||||
|
||||
These options apply if you are using the InfluxQL query language. If you are using Flux, refer to [Flux support in Grafana]({{< relref "influxdb-flux.md" >}}).
|
||||
|
||||
Name | Description
|
||||
----------- | -------------
|
||||
`Name` | The data source name. This is how you refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`.
|
||||
`Default` | Default data source means that it will be pre-selected for new panels.
|
||||
`URL` | The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB API port is by default 8086.
|
||||
`Access` | Server (default) = URL needs to be accessible from the Grafana backend/server, Browser = URL needs to be accessible from the browser.
|
||||
| Name | Description |
|
||||
| --------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `URL` | The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB API port is by default 8086. |
|
||||
| `Access` | Server (default) = URL needs to be accessible from the Grafana backend/server, Browser = URL needs to be accessible from the browser. |
|
||||
|
||||
**Note**: Browser access is deprecated and will be removed in a future release.
|
||||
`Whitelisted Cookies`| Cookies that will be forwarded to the data source. All other cookies will be deleted.
|
||||
`Database` | The ID of the bucket you want to query from, copied from the [Buckets page](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) of the InfluxDB UI.
|
||||
`User` | The username you use to sign into InfluxDB.
|
||||
`Password` | The token you use to query the bucket above, copied from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI.
|
||||
`Database` | The ID of the bucket you want to query from, copied from the [Buckets page](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) of the InfluxDB UI.
|
||||
`User` | The username you use to sign into InfluxDB.
|
||||
`Password` | The token you use to query the bucket above, copied from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI.
|
||||
`HTTP mode` | How to query the database (`GET` or `POST` HTTP verb). The `POST` verb allows heavy queries that would return an error using the `GET` verb. Default is `GET`.
|
||||
`Min time interval` | (Optional) Refer to [Min time interval]({{< relref "#min-time-interval" >}}).
|
||||
`Max series`| (Optional) Limits the number of series/tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have lots of small time series and not all are shown. Defaults to 1000.
|
||||
@@ -51,16 +52,16 @@ For information on data source settings and using Flux in Grafana, refer to [Flu
|
||||
A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example `1m` if your data is written every minute.
|
||||
This option can also be overridden/configured in a dashboard panel under data source options. It's important to note that this value _must_ be formatted as a number followed by a valid time identifier, e.g. `1m` (1 minute) or `30s` (30 seconds). The following time identifiers are supported:
|
||||
|
||||
Identifier | Description
|
||||
------------ | -------------
|
||||
`y` | year
|
||||
`M` | month
|
||||
`w` | week
|
||||
`d` | day
|
||||
`h` | hour
|
||||
`m` | minute
|
||||
`s` | second
|
||||
`ms` | millisecond
|
||||
| Identifier | Description |
|
||||
| ---------- | ----------- |
|
||||
| `y` | year |
|
||||
| `M` | month |
|
||||
| `w` | week |
|
||||
| `d` | day |
|
||||
| `h` | hour |
|
||||
| `m` | minute |
|
||||
| `s` | second |
|
||||
| `ms` | millisecond |
|
||||
|
||||
## Query languages
|
||||
|
||||
@@ -104,6 +105,7 @@ Use the plus button and select Field > field to add another SELECT clause. You c
|
||||
specify an asterix `*` to select all fields.
|
||||
|
||||
### Group By
|
||||
|
||||
To group by a tag, click the plus icon at the end of the GROUP BY row. Pick a tag from the dropdown that appears.
|
||||
You can remove the "Group By" by clicking on the `tag` and then click on the x icon.
|
||||
|
||||
@@ -119,12 +121,12 @@ You can switch to raw query mode by clicking hamburger icon and then `Switch edi
|
||||
- $m = replaced with measurement name
|
||||
- $measurement = replaced with measurement name
|
||||
- $col = replaced with column name
|
||||
- $tag_exampletag = replaced with the value of the `exampletag` tag. The syntax is `$tag_yourTagName` (must start with `$tag_`). To use your tag as an alias in the ALIAS BY field then the tag must be used to group by in the query.
|
||||
- $tag_exampletag = replaced with the value of the `exampletag` tag. The syntax is `$tag*yourTagName`(must start with`$tag*`). To use your tag as an alias in the ALIAS BY field then the tag must be used to group by in the query.
|
||||
- You can also use [[tag_hostname]] pattern replacement syntax. For example, in the ALIAS BY field using this text `Host: [[tag_hostname]]` would substitute in the `hostname` tag value for each legend value and an example legend value would be: `Host: server1`.
|
||||
|
||||
## Querying logs
|
||||
|
||||
Querying and displaying log data from InfluxDB is available in [Explore]({{< relref "../../explore/_index.md" >}}), and in the [logs panel]({{< relref "../../panels/visualizations/logs-panel.md" >}}) in dashboards.
|
||||
Querying and displaying log data from InfluxDB is available in [Explore]({{< relref "../../explore/_index.md" >}}), and in the [logs panel]({{< relref "../../visualizations/logs-panel.md" >}}) in dashboards.
|
||||
Select the InfluxDB data source, and then enter a query to display your logs.
|
||||
|
||||
### Log queries
|
||||
@@ -147,4 +149,4 @@ An example query:
|
||||
SELECT title, description from events WHERE $timeFilter ORDER BY time ASC
|
||||
```
|
||||
|
||||
For InfluxDB, you need to enter a query like the one in the example above. The ```where $timeFilter``` component is required. If you only select one column, then you do not need to enter anything in the column mapping fields. The **Tags** field can be a comma-separated string.
|
||||
For InfluxDB, you need to enter a query like the one in the example above. The `where $timeFilter` component is required. If you only select one column, then you do not need to enter anything in the column mapping fields. The **Tags** field can be a comma-separated string.
|
||||
|
||||
@@ -6,18 +6,18 @@ weight = 200
|
||||
|
||||
# Flux query language in Grafana
|
||||
|
||||
Grafana supports Flux running on InfluxDB 1.8+. See [1.8 compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility) for more information and connection details.
|
||||
Grafana supports Flux running on InfluxDB 1.8+. See [1.8 compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility) for more information and connection details.
|
||||
|
||||
Name | Description
|
||||
---------------- | -------------
|
||||
`Name` | The data source name. This is how you refer to the data source in panels and queries. We recommend something like `InfluxDB-Flux`.
|
||||
`Default` | Default data source means that it will be pre-selected for new panels.
|
||||
`URL` | The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB 2.0 API port is by default 8086.
|
||||
`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/). 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.
|
||||
`Min time interval` | (Optional) Refer to [Min time interval]({{< relref "#min-time-interval" >}}).
|
||||
`Max series`| (Optional) Limits the number of series/tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have lots of small time series and not all are shown. Defaults to 1000.
|
||||
| Name | Description |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. We recommend something like `InfluxDB-Flux`. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `URL` | The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB 2.0 API port is by default 8086. |
|
||||
| `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/). 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. |
|
||||
| `Min time interval` | (Optional) Refer to [Min time interval]({{< relref "#min-time-interval" >}}). |
|
||||
| `Max series` | (Optional) Limits the number of series/tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have lots of small time series and not all are shown. Defaults to 1000. |
|
||||
|
||||
## Min time interval
|
||||
|
||||
@@ -25,16 +25,16 @@ A lower limit for the auto group by time interval. Recommended to be set to writ
|
||||
This option can also be overridden/configured in a dashboard panel under data source options. It's important to note that this value **needs** to be formatted as a
|
||||
number followed by a valid time identifier, e.g. `1m` (1 minute) or `30s` (30 seconds). The following time identifiers are supported:
|
||||
|
||||
Identifier | Description
|
||||
------------ | -------------
|
||||
`y` | year
|
||||
`M` | month
|
||||
`w` | week
|
||||
`d` | day
|
||||
`h` | hour
|
||||
`m` | minute
|
||||
`s` | second
|
||||
`ms` | millisecond
|
||||
| Identifier | Description |
|
||||
| ---------- | ----------- |
|
||||
| `y` | year |
|
||||
| `M` | month |
|
||||
| `w` | week |
|
||||
| `d` | day |
|
||||
| `h` | hour |
|
||||
| `m` | minute |
|
||||
| `s` | second |
|
||||
| `ms` | millisecond |
|
||||
|
||||
You can use the [Flux query and scripting language](https://www.influxdata.com/products/flux/). Grafana's Flux query editor is a text editor for raw Flux queries with Macro support.
|
||||
|
||||
@@ -42,13 +42,13 @@ You can use the [Flux query and scripting language](https://www.influxdata.com/p
|
||||
|
||||
The macros support copying and pasting from [Chronograph](https://www.influxdata.com/time-series-platform/chronograf/).
|
||||
|
||||
Macro example | Description
|
||||
------------ | -------------
|
||||
`v.timeRangeStart` | Will be replaced by the start of the currently active time selection. For example, *2020-06-11T13:31:00Z*
|
||||
`v.timeRangeStop` | Will be replaced by the end of the currently active time selection. For example, *2020-06-11T14:31:00Z*
|
||||
`v.windowPeriod` | Will be replaced with an interval string compatible with Flux that corresponds to Grafana's calculated interval based on the time range of the active time selection. For example, *5s*
|
||||
`v.defaultBucket` | Will be replaced with the data source configuration's "Default Bucket" setting
|
||||
`v.organization` | Will be replaced with the data source configuration's "Organization" setting
|
||||
| Macro example | Description |
|
||||
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `v.timeRangeStart` | Will be replaced by the start of the currently active time selection. For example, _2020-06-11T13:31:00Z_ |
|
||||
| `v.timeRangeStop` | Will be replaced by the end of the currently active time selection. For example, _2020-06-11T14:31:00Z_ |
|
||||
| `v.windowPeriod` | Will be replaced with an interval string compatible with Flux that corresponds to Grafana's calculated interval based on the time range of the active time selection. For example, _5s_ |
|
||||
| `v.defaultBucket` | Will be replaced with the data source configuration's "Default Bucket" setting |
|
||||
| `v.organization` | Will be replaced with the data source configuration's "Organization" setting |
|
||||
|
||||
For example, the following query will be interpolated as the query that follows it, with interval and time period values changing according to active time selection\):
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ weight = 300
|
||||
|
||||
Instead of hard-coding things like server, application and sensor name in your metric queries you can use variables in their place.
|
||||
|
||||
For more information, refer to [Templates and variables]({{< relref "../../variables/_index.md" >}}).
|
||||
For more information, refer to [Templates and variables]({{< relref "../../variables/_index.md" >}}).
|
||||
|
||||
## Using variables in InfluxDB queries
|
||||
|
||||
There are two syntaxes:
|
||||
|
||||
`$<varname>` Example:
|
||||
`$<varname>` Example:
|
||||
|
||||
```sql
|
||||
SELECT mean("value") FROM "logins" WHERE "hostname" =~ /^$host$/ AND $timeFilter GROUP BY time($__interval), "hostname"
|
||||
```
|
||||
|
||||
`[[varname]]` Example:
|
||||
`[[varname]]` Example:
|
||||
|
||||
```sql
|
||||
SELECT mean("value") FROM "logins" WHERE "hostname" =~ /^[[host]]$/ AND $timeFilter GROUP BY time($__interval), "hostname"
|
||||
@@ -40,6 +40,7 @@ For example, you can have a variable that contains all values for tag `hostname`
|
||||
```sql
|
||||
SHOW TAG VALUES WITH KEY = "hostname"
|
||||
```
|
||||
|
||||
## Chained or nested variables
|
||||
|
||||
You can also create nested variables, sometimes called [chained variables]({{< relref "../../variables/variable-types/chained-variables.md" >}}).
|
||||
|
||||
@@ -21,10 +21,11 @@ datasources:
|
||||
access: proxy
|
||||
database: site
|
||||
user: grafana
|
||||
password: grafana
|
||||
url: http://localhost:8086
|
||||
jsonData:
|
||||
httpMode: GET
|
||||
secureJsonData:
|
||||
password: grafana
|
||||
```
|
||||
|
||||
## InfluxDB 2.x for Flux example
|
||||
@@ -63,5 +64,4 @@ datasources:
|
||||
httpHeaderName1: 'Authorization'
|
||||
secureJsonData:
|
||||
httpHeaderValue1: 'Token <token>'
|
||||
|
||||
```
|
||||
|
||||
@@ -32,7 +32,7 @@ This is a configuration for the [trace to logs feature]({{< relref "../explore/t
|
||||
|
||||
- **Data source -** Target data source.
|
||||
- **Tags -** The tags that will be used in the Loki query. Default is `'cluster', 'hostname', 'namespace', 'pod'`.
|
||||
- **Span start time shift -** Shift in the start time for the Loki query based on the span start time. In order to extend to the past, you need to use a negative value. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
- **Span start time shift -** Shift in the start time for the Loki query based on the span start time. In order to extend to the past, you need to use a negative value. Use time interval units like 5s, 1m, 3h. The default is 0.
|
||||
- **Span end time shift -** Shift in the end time for the Loki query based on the span end time. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
|
||||

|
||||
@@ -56,6 +56,62 @@ To perform a search, set the query type selector to Search, then use the followi
|
||||
- Max Duration - Filter all traces with a duration lower than the set value. Possible values are `1.2s, 100ms, 500us`.
|
||||
- Limit - Limits the number of traces returned.
|
||||
|
||||
## Upload JSON trace file
|
||||
|
||||
You can upload a JSON file that contains a single trace to visualize it. If the file has multiple traces then the first trace is used for visualization.
|
||||
|
||||
{{< figure src="/static/img/docs/explore/jaeger-upload-json.png" class="docs-image--no-shadow" caption="Screenshot of the Jaeger data source in explore with upload selected" >}}
|
||||
|
||||
Here is an example JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"traceID": "2ee9739529395e31",
|
||||
"spans": [
|
||||
{
|
||||
"traceID": "2ee9739529395e31",
|
||||
"spanID": "2ee9739529395e31",
|
||||
"flags": 1,
|
||||
"operationName": "CAS",
|
||||
"references": [],
|
||||
"startTime": 1616095319593196,
|
||||
"duration": 1004,
|
||||
"tags": [
|
||||
{
|
||||
"key": "sampler.type",
|
||||
"type": "string",
|
||||
"value": "const"
|
||||
}
|
||||
],
|
||||
"logs": [],
|
||||
"processID": "p1",
|
||||
"warnings": null
|
||||
}
|
||||
],
|
||||
"processes": {
|
||||
"p1": {
|
||||
"serviceName": "loki-all",
|
||||
"tags": [
|
||||
{
|
||||
"key": "jaeger.version",
|
||||
"type": "string",
|
||||
"value": "Go-2.25.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"warnings": null
|
||||
}
|
||||
],
|
||||
"total": 0,
|
||||
"limit": 0,
|
||||
"offset": 0,
|
||||
"errors": null
|
||||
}
|
||||
```
|
||||
|
||||
## Linking Trace ID from logs
|
||||
|
||||
You can link to Jaeger trace from logs in Loki by configuring a derived field with internal link. See the [Derived fields]({{< relref "loki.md#derived-fields" >}}) section in the [Loki data source]({{< relref "loki.md" >}}) documentation for details.
|
||||
|
||||
@@ -12,7 +12,9 @@ Grafana ships with built-in support for Loki, an open source log aggregation sys
|
||||
|
||||
Add it as a data source and you are ready to build dashboards or query your log data in [Explore]({{< relref "../explore" >}}). Refer to [Add a data source]({{< relref "add-a-data-source.md" >}}) for instructions on how to add a data source to Grafana. Only users with the organization admin role can add data sources.
|
||||
|
||||
> **Note:** To troubleshoot configuration and other issues, check the log file located at /var/log/grafana/grafana.log on Unix systems or in <grafana_install_dir>/data/log on other platforms and manual installations.
|
||||
## Hosted Loki
|
||||
|
||||
You can run Loki on your own hardware or use [Grafana Cloud](https://grafana.com/products/cloud/features/#cloud-logs). The free forever plan includes Grafana, 50 GB of Loki logs, 10K Prometheus series, and more. [Create a free account to get started](https://grafana.com/auth/sign-up/create-user?pg=docs-grafana-loki&plcmt=in-text).
|
||||
|
||||
## Loki settings
|
||||
|
||||
@@ -21,11 +23,13 @@ To access Loki settings, click the **Configuration** (gear) icon, then click **D
|
||||
| Name | Description |
|
||||
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels, queries, and Explore. |
|
||||
| `Default` | Default data source that is pre-selected for new panels. |
|
||||
| `URL` | URL of the Loki instance, e.g., `http://localhost:3100`. |
|
||||
| `Default` | Default data source that is pre-selected for new panels. |
|
||||
| `URL` | URL of the Loki instance, e.g., `http://localhost:3100`. |
|
||||
| `Whitelisted Cookies` | Grafana Proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source. |
|
||||
| `Maximum lines` | Upper limit for the number of log lines returned by Loki (default is 1000). Lower this limit if your browser is sluggish when displaying logs in Explore. |
|
||||
|
||||
> **Note:** To troubleshoot configuration and other issues, check the log file located at /var/log/grafana/grafana.log on Unix systems or in <grafana_install_dir>/data/log on other platforms and manual installations.
|
||||
|
||||
### Derived fields
|
||||
|
||||
The Derived Fields configuration allows you to:
|
||||
@@ -33,13 +37,14 @@ The Derived Fields configuration allows you to:
|
||||
- Add fields parsed from the log message.
|
||||
- Add a link that uses the value of the field.
|
||||
|
||||
You can use this functionality to link to your tracing backend directly from your logs, or link to a user profile page if a userId is present in the log line. These links appear in the [log details]({{< relref "../explore/logs-integration/#labels-and-detected-fields" >}}).
|
||||
For example, you can use this functionality to link to your tracing backend directly from your logs, or link to a user profile page if a userId is present in the log line. These links appear in the [log details]({{< relref "../explore/logs-integration/#labels-and-detected-fields" >}}).
|
||||
|
||||
Each derived field consists of:
|
||||
|
||||
- **Name -** Shown in the log details as a label.
|
||||
- **Regex -** A Regex pattern that runs on the log message and captures part of it as the value of the new field. Can only contain a single capture group.
|
||||
- **URL/query -** If the link is external, then enter the full link URL. If the link is internal link, then this input serves as query for the target data source. In both cases, you can interpolate the value from the field with `${__value.raw }` macro.
|
||||
- **URL Label -** (Optional) Set a custom display label for the link. The link label defaults to the full external URL or name of the linked internal data source and is overridden by this setting.
|
||||
- **Internal link -** Select if the link is internal or external. In case of internal link, a data source selector allows you to select the target data source. Only tracing data sources are supported.
|
||||
|
||||
You can use a debug section to see what your fields extract and how the URL is interpolated. Click **Show example log message** to show the text area where you can enter a log message.
|
||||
@@ -78,7 +83,7 @@ There are two types of LogQL queries:
|
||||
|
||||
### Log queries
|
||||
|
||||
Querying and displaying log data from Loki is available via [Explore]({{< relref "../explore" >}}), and with the [logs panel]({{< relref "../panels/visualizations/logs-panel.md" >}}) in dashboards. Select the Loki data source, and then enter a [LogQL](https://grafana.com/docs/loki/latest/logql/#log-queries) query to display your logs.
|
||||
Querying and displaying log data from Loki is available via [Explore]({{< relref "../explore" >}}), and with the [logs panel]({{< relref "../visualizations/logs-panel.md" >}}) in dashboards. Select the Loki data source, and then enter a [LogQL](https://grafana.com/docs/loki/latest/logql/#log-queries) query to display your logs.
|
||||
|
||||
A log query consists of two parts: log stream selector, and a log pipeline. For performance reasons begin by choosing a log stream by selecting a log label.
|
||||
|
||||
@@ -148,18 +153,20 @@ Check out the [Templating]({{< relref "../variables/_index.md" >}}) documentatio
|
||||
Variable of the type _Query_ allows you to query Loki for a list labels or label values. The Loki data source plugin
|
||||
provides the following functions you can use in the `Query` input field.
|
||||
|
||||
| Name | Description |
|
||||
| -------------------------------------------| -------------------------------------------------------------------------------------|
|
||||
| `label_names()` | Returns a list of label names. |
|
||||
| `label_values(label)` | Returns a list of label values for the `label`. |
|
||||
| `label_values(log stream selector, label)` | Returns a list of label values for the `label` in the specified `log stream selector`.|
|
||||
| Name | Description |
|
||||
| ------------------------------------------ | -------------------------------------------------------------------------------------- |
|
||||
| `label_names()` | Returns a list of label names. |
|
||||
| `label_values(label)` | Returns a list of label values for the `label`. |
|
||||
| `label_values(log stream selector, label)` | Returns a list of label values for the `label` in the specified `log stream selector`. |
|
||||
|
||||
### Ad hoc filters variable
|
||||
|
||||
Loki supports the special ad hoc filters variable type. It allows you to specify any number of label/value filters on the fly. These filters are automatically applied to all your Loki queries.
|
||||
|
||||
### Using interval and range variables
|
||||
|
||||
You can use some global built-in variables in query variables; `$__interval`, `$__interval_ms`, `$__range`, `$__range_s` and `$__range_ms`. For more information, refer to [Global built-in variables]({{< relref "../variables/variable-types/global-variables.md" >}}).
|
||||
|
||||
## Annotations
|
||||
|
||||
You can use any non-metric Loki query as a source for [annotations]({{< relref "../dashboards/annotations" >}}). Log content will be used as annotation text and your log stream labels as tags, so there is no need for additional mapping.
|
||||
|
||||
@@ -168,122 +168,96 @@ The resulting table panel:
|
||||
|
||||
## Time series queries
|
||||
|
||||
If you set `Format as` to `Time series`, for use in Graph panel for example, then the query must have a column named `time` that returns either a SQL datetime or any numeric datatype representing Unix epoch in seconds. You may return a column named `metric` that is used as metric name for the value column. Any column except `time` and `metric` is treated as a value column. If you omit the `metric` column, the name of the value column will be the metric name. You may select multiple value columns, each will have its name as metric.
|
||||
If you return multiple value columns and a column named `metric` then this column is used as prefix for the series name (only available in Grafana 5.3+).
|
||||
If you set Format as to _Time series_, then the query must have a column named time that returns either a SQL datetime or any numeric datatype representing Unix epoch in seconds. In addition, result sets of time series queries must be sorted by time for panels to properly visualize the result.
|
||||
|
||||
Result sets of time series queries need to be sorted by time.
|
||||
A time series query result is returned in a [wide data frame format]({{< relref "../developers/plugins/data-frames.md#wide-format" >}}). Any column except time or of type string transforms into value fields in the data frame query result. Any string column transforms into field labels in the data frame query result.
|
||||
|
||||
**Example database table:**
|
||||
> For backward compatibility, there's an exception to the above rule for queries that return three columns including a string column named metric. Instead of transforming the metric column into field labels, it becomes the field name, and then the series name is formatted as the value of the metric column. See the example with the metric column below.
|
||||
|
||||
```sql
|
||||
CREATE TABLE [event] (
|
||||
time_sec bigint,
|
||||
description nvarchar(100),
|
||||
tags nvarchar(100),
|
||||
)
|
||||
```
|
||||
You can optionally customize the default series name formatting using instructions in [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}).
|
||||
|
||||
```sql
|
||||
CREATE TABLE metric_values (
|
||||
time datetime,
|
||||
measurement nvarchar(100),
|
||||
valueOne int,
|
||||
valueTwo int,
|
||||
)
|
||||
|
||||
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES('2018-03-15 12:30:00', 'Metric A', 62, 6)
|
||||
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES('2018-03-15 12:30:00', 'Metric B', 49, 11)
|
||||
...
|
||||
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES('2018-03-15 13:55:00', 'Metric A', 14, 25)
|
||||
INSERT metric_values (time, measurement, valueOne, valueTwo) VALUES('2018-03-15 13:55:00', 'Metric B', 48, 10)
|
||||
|
||||
```
|
||||
|
||||
{{< figure src="/static/img/docs/v51/mssql_time_series_one.png" class="docs-image--no-shadow docs-image--right" >}}
|
||||
|
||||
**Example with one `value` and one `metric` column.**
|
||||
**Example with `metric` column:**
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
time,
|
||||
valueOne,
|
||||
measurement as metric
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
$__timeFilter(time)
|
||||
$__timeGroup(time_date_time, '5m') as time,
|
||||
min("value_double"),
|
||||
'min' as metric
|
||||
FROM test_data
|
||||
WHERE $__timeFilter(time_date_time)
|
||||
GROUP BY $__timeGroup(time_date_time, '5m')
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
When the above query is used in a graph panel, it will produce two series named `Metric A` and `Metric B` with the values `valueOne` and `valueTwo` plotted over `time`.
|
||||
Data frame result:
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
{{< figure src="/static/img/docs/v51/mssql_time_series_two.png" class="docs-image--no-shadow docs-image--right" >}}
|
||||
|
||||
**Example with multiple `value` columns:**
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
time,
|
||||
valueOne,
|
||||
valueTwo
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
$__timeFilter(time)
|
||||
ORDER BY 1
|
||||
```text
|
||||
+---------------------+-----------------+
|
||||
| Name: time | Name: min |
|
||||
| Labels: | Labels: |
|
||||
| Type: []time.Time | Type: []float64 |
|
||||
+---------------------+-----------------+
|
||||
| 2020-01-02 03:05:00 | 3 |
|
||||
| 2020-01-02 03:10:00 | 6 |
|
||||
+---------------------+-----------------+
|
||||
```
|
||||
|
||||
When the above query is used in a graph panel, it will produce two series named `Metric A` and `Metric B` with the values `valueOne` and `valueTwo` plotted over `time`.
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
{{< figure src="/static/img/docs/v51/mssql_time_series_three.png" class="docs-image--no-shadow docs-image--right" >}}
|
||||
|
||||
**Example using the \$\_\_timeGroup macro:**
|
||||
**Example using the fill parameter in the $\_\_timeGroup macro to convert null values to be zero instead:**
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
$__timeGroup(time, '3m') as time,
|
||||
measurement as metric,
|
||||
avg(valueOne)
|
||||
FROM
|
||||
metric_values
|
||||
$__timeGroup(createdAt, '5m', 0) as time,
|
||||
sum(value) as value,
|
||||
hostname
|
||||
FROM test_data
|
||||
WHERE
|
||||
$__timeFilter(time)
|
||||
$__timeFilter(createdAt)
|
||||
GROUP BY
|
||||
$__timeGroup(time, '3m'),
|
||||
measurement
|
||||
$__timeGroup(createdAt, '5m', 0),
|
||||
hostname
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
When the above query is used in a graph panel, it will produce two series named `Metric A` and `Metric B` with the values `valueOne` and `valueTwo` plotted over `time`.
|
||||
Any two series lacking a value in a three-minute window will render a line between those two lines. You'll notice that the graph to the right never goes down to zero.
|
||||
Given the data frame result in the following example and using the graph panel, you will get two series named _value 10.0.1.1_ and _value 10.0.1.2_. To render the series with a name of _10.0.1.1_ and _10.0.1.2_ , use a [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) value of `${__field.labels.hostname}`.
|
||||
|
||||
<div class="clearfix"></div>
|
||||
Data frame result:
|
||||
|
||||
{{< figure src="/static/img/docs/v51/mssql_time_series_four.png" class="docs-image--no-shadow docs-image--right" >}}
|
||||
```text
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
| Name: time | Name: value | Name: value |
|
||||
| Labels: | Labels: hostname=10.0.1.1 | Labels: hostname=10.0.1.2 |
|
||||
| Type: []time.Time | Type: []float64 | Type: []float64 |
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
| 2020-01-02 03:05:00 | 3 | 4 |
|
||||
| 2020-01-02 03:10:00 | 6 | 7 |
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
```
|
||||
|
||||
**Example using the \$\_\_timeGroup macro with fill parameter set to zero:**
|
||||
**Example with multiple columns:**
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
$__timeGroup(time, '3m', 0) as time,
|
||||
measurement as metric,
|
||||
sum(valueTwo)
|
||||
FROM
|
||||
metric_values
|
||||
WHERE
|
||||
$__timeFilter(time)
|
||||
GROUP BY
|
||||
$__timeGroup(time, '3m'),
|
||||
measurement
|
||||
$__timeGroup(time_date_time, '5m'),
|
||||
min(value_double) as min_value,
|
||||
max(value_double) as max_value
|
||||
FROM test_data
|
||||
WHERE $__timeFilter(time_date_time)
|
||||
GROUP BY $__timeGroup(time_date_time, '5m')
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
When the above query is used in a graph panel, the result is two series named `Metric A` and `Metric B` with a sum of `valueTwo` plotted over `time`.
|
||||
Any series lacking a value in a 3 minute window will have a value of zero which you'll see rendered in the graph to the right.
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+-----------------+-----------------+
|
||||
| Name: time | Name: min_value | Name: max_value |
|
||||
| Labels: | Labels: | Labels: |
|
||||
| Type: []time.Time | Type: []float64 | Type: []float64 |
|
||||
+---------------------+-----------------+-----------------+
|
||||
| 2020-01-02 03:04:00 | 3 | 4 |
|
||||
| 2020-01-02 03:05:00 | 6 | 7 |
|
||||
+---------------------+-----------------+-----------------+
|
||||
```
|
||||
|
||||
## Templating
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ weight = 1000
|
||||
|
||||
# Using MySQL in Grafana
|
||||
|
||||
> Starting from Grafana v5.1 you can name the time column *time* in addition to earlier supported *time_sec*. Usage of *time_sec* will eventually be deprecated.
|
||||
> Starting from Grafana v5.1 you can name the time column _time_ in addition to earlier supported _time_sec_. Usage of _time_sec_ will eventually be deprecated.
|
||||
|
||||
Grafana ships with a built-in MySQL data source plugin that allows you to query and visualize data from a MySQL compatible database.
|
||||
|
||||
@@ -17,22 +17,22 @@ Grafana ships with a built-in MySQL data source plugin that allows you to query
|
||||
1. Open the side menu by clicking the Grafana icon in the top header.
|
||||
1. In the side menu under the `Dashboards` link you should find a link named `Data Sources`.
|
||||
1. Click the `+ Add data source` button in the top header.
|
||||
1. Select *MySQL* from the *Type* dropdown.
|
||||
1. Select _MySQL_ from the _Type_ dropdown.
|
||||
|
||||
### Data source options
|
||||
|
||||
Name | Description
|
||||
------------------ | -------------
|
||||
`Name` | The data source name. This is how you refer to the data source in panels and queries.
|
||||
`Default` | Default data source means that it will be pre-selected for new panels.
|
||||
`Host` | The IP address/hostname and optional port of your MySQL instance.
|
||||
`Database` | Name of your MySQL database.
|
||||
`User` | Database user's login/username
|
||||
`Password` | Database user's password
|
||||
`Session Timezone` | Specify the time zone used in the database session, such as `Europe/Berlin` or `+02:00`. This is necessary, if the timezone of the database (or the host of the database) is set to something other than UTC. Set the value used in the session with `SET time_zone='...'`. If you leave this field empty, then the time zone is not updated. For more information, refer to the [MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html).
|
||||
`Max open` | The maximum number of open connections to the database, default `unlimited` (Grafana v5.4+).
|
||||
`Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+).
|
||||
`Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours. This should always be lower than configured [wait_timeout](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) in MySQL (Grafana v5.4+).
|
||||
| Name | Description |
|
||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `Host` | The IP address/hostname and optional port of your MySQL instance. |
|
||||
| `Database` | Name of your MySQL database. |
|
||||
| `User` | Database user's login/username |
|
||||
| `Password` | Database user's password |
|
||||
| `Session Timezone` | Specify the time zone used in the database session, such as `Europe/Berlin` or `+02:00`. This is necessary, if the timezone of the database (or the host of the database) is set to something other than UTC. Set the value used in the session with `SET time_zone='...'`. If you leave this field empty, then the time zone is not updated. For more information, refer to the [MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html). |
|
||||
| `Max open` | The maximum number of open connections to the database, default `unlimited` (Grafana v5.4+). |
|
||||
| `Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+). |
|
||||
| `Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours. This should always be lower than configured [wait_timeout](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) in MySQL (Grafana v5.4+). |
|
||||
|
||||
### Min time interval
|
||||
|
||||
@@ -66,7 +66,7 @@ Example:
|
||||
GRANT SELECT ON mydatabase.mytable TO 'grafanaReader';
|
||||
```
|
||||
|
||||
You can use wildcards (`*`) in place of database or table if you want to grant access to more databases and tables.
|
||||
You can use wildcards (`*`) in place of database or table if you want to grant access to more databases and tables.
|
||||
|
||||
## Query Editor
|
||||
|
||||
@@ -102,10 +102,12 @@ If you use aggregate functions you need to group your resultset. The editor will
|
||||
You may add further value columns by clicking the plus button and selecting `Column` from the menu. Multiple value columns will be plotted as separate series in the graph panel.
|
||||
|
||||
### Filter data (WHERE)
|
||||
|
||||
To add a filter click the plus icon to the right of the `WHERE` condition. You can remove filters by clicking on
|
||||
the filter and selecting `Remove`. A filter for the current selected timerange is automatically added to new queries.
|
||||
|
||||
### Group By
|
||||
|
||||
To group by time or any other columns click the plus icon at the end of the GROUP BY row. The suggestion dropdown will only show text columns of your currently selected table but you may manually enter any column.
|
||||
You can remove the group by clicking on the item and then selecting `Remove`.
|
||||
|
||||
@@ -116,6 +118,7 @@ If you add any grouping, all selected columns need to have an aggregate function
|
||||
Grafana can fill in missing values when you group by time. The time function accepts two arguments. The first argument is the time window that you would like to group by, and the second argument is the value you want Grafana to fill missing items with.
|
||||
|
||||
### Text Editor Mode (RAW)
|
||||
|
||||
You can switch to the raw query editor mode by clicking the hamburger icon and selecting `Switch editor mode` or by clicking `Edit SQL` below the query.
|
||||
|
||||
> If you use the raw query editor, be sure your query at minimum has `ORDER BY time` and a filter on the returned time range.
|
||||
@@ -124,26 +127,26 @@ You can switch to the raw query editor mode by clicking the hamburger icon and s
|
||||
|
||||
To simplify syntax and to allow for dynamic parts, like date range filters, the query can contain macros.
|
||||
|
||||
Macro example | Description
|
||||
------------------------------------------------------ | -------------
|
||||
`$__time(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, *UNIX_TIMESTAMP(dateColumn) as time_sec*
|
||||
`$__timeEpoch(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, *UNIX_TIMESTAMP(dateColumn) as time_sec*
|
||||
`$__timeFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name. For example, *dateColumn BETWEEN FROM_UNIXTIME(1494410783) AND FROM_UNIXTIME(1494410983)*
|
||||
`$__timeFrom()` | Will be replaced by the start of the currently active time selection. For example, *FROM_UNIXTIME(1494410783)*
|
||||
`$__timeTo()` | Will be replaced by the end of the currently active time selection. For example, *FROM_UNIXTIME(1494410983)*
|
||||
`$__timeGroup(dateColumn,'5m')` | Will be replaced by an expression usable in GROUP BY clause. For example, *cast(cast(UNIX_TIMESTAMP(dateColumn)/(300) as signed)*300 as signed),*
|
||||
`$__timeGroup(dateColumn,'5m', 0)` | Same as above but with a fill parameter so missing points in that series will be added by grafana and 0 will be used as value.
|
||||
`$__timeGroup(dateColumn,'5m', NULL)` | Same as above but NULL will be used as value for missing points.
|
||||
`$__timeGroup(dateColumn,'5m', previous)` | Same as above but the previous value in that series will be used as fill value if no value has been seen yet NULL will be used (only available in Grafana 5.3+).
|
||||
`$__timeGroupAlias(dateColumn,'5m')` | Will be replaced identical to $__timeGroup but with an added column alias (only available in Grafana 5.3+).
|
||||
`$__unixEpochFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as Unix timestamp. For example, *dateColumn > 1494410783 AND dateColumn < 1494497183*
|
||||
`$__unixEpochFrom()` | Will be replaced by the start of the currently active time selection as Unix timestamp. For example, *1494410783*
|
||||
`$__unixEpochTo()` | Will be replaced by the end of the currently active time selection as Unix timestamp. For example, *1494497183*
|
||||
`$__unixEpochNanoFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as nanosecond timestamp. For example, *dateColumn > 1494410783152415214 AND dateColumn < 1494497183142514872*
|
||||
`$__unixEpochNanoFrom()` | Will be replaced by the start of the currently active time selection as nanosecond timestamp. For example, *1494410783152415214*
|
||||
`$__unixEpochNanoTo()` | Will be replaced by the end of the currently active time selection as nanosecond timestamp. For example, *1494497183142514872*
|
||||
`$__unixEpochGroup(dateColumn,'5m', [fillmode])` | Same as $__timeGroup but for times stored as Unix timestamp (only available in Grafana 5.3+).
|
||||
`$__unixEpochGroupAlias(dateColumn,'5m', [fillmode])` | Same as above but also adds a column alias (only available in Grafana 5.3+).
|
||||
| Macro example | Description |
|
||||
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `$__time(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, _UNIX_TIMESTAMP(dateColumn) as time_sec_ |
|
||||
| `$__timeEpoch(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, _UNIX_TIMESTAMP(dateColumn) as time_sec_ |
|
||||
| `$__timeFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name. For example, _dateColumn BETWEEN FROM_UNIXTIME(1494410783) AND FROM_UNIXTIME(1494410983)_ |
|
||||
| `$__timeFrom()` | Will be replaced by the start of the currently active time selection. For example, _FROM_UNIXTIME(1494410783)_ |
|
||||
| `$__timeTo()` | Will be replaced by the end of the currently active time selection. For example, _FROM_UNIXTIME(1494410983)_ |
|
||||
| `$__timeGroup(dateColumn,'5m')` | Will be replaced by an expression usable in GROUP BY clause. For example, *cast(cast(UNIX_TIMESTAMP(dateColumn)/(300) as signed)*300 as signed),\* |
|
||||
| `$__timeGroup(dateColumn,'5m', 0)` | Same as above but with a fill parameter so missing points in that series will be added by grafana and 0 will be used as value. |
|
||||
| `$__timeGroup(dateColumn,'5m', NULL)` | Same as above but NULL will be used as value for missing points. |
|
||||
| `$__timeGroup(dateColumn,'5m', previous)` | Same as above but the previous value in that series will be used as fill value if no value has been seen yet NULL will be used (only available in Grafana 5.3+). |
|
||||
| `$__timeGroupAlias(dateColumn,'5m')` | Will be replaced identical to $\_\_timeGroup but with an added column alias (only available in Grafana 5.3+). |
|
||||
| `$__unixEpochFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as Unix timestamp. For example, _dateColumn > 1494410783 AND dateColumn < 1494497183_ |
|
||||
| `$__unixEpochFrom()` | Will be replaced by the start of the currently active time selection as Unix timestamp. For example, _1494410783_ |
|
||||
| `$__unixEpochTo()` | Will be replaced by the end of the currently active time selection as Unix timestamp. For example, _1494497183_ |
|
||||
| `$__unixEpochNanoFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as nanosecond timestamp. For example, _dateColumn > 1494410783152415214 AND dateColumn < 1494497183142514872_ |
|
||||
| `$__unixEpochNanoFrom()` | Will be replaced by the start of the currently active time selection as nanosecond timestamp. For example, _1494410783152415214_ |
|
||||
| `$__unixEpochNanoTo()` | Will be replaced by the end of the currently active time selection as nanosecond timestamp. For example, _1494497183142514872_ |
|
||||
| `$__unixEpochGroup(dateColumn,'5m', [fillmode])` | Same as $\_\_timeGroup but for times stored as Unix timestamp (only available in Grafana 5.3+). |
|
||||
| `$__unixEpochGroupAlias(dateColumn,'5m', [fillmode])` | Same as above but also adds a column alias (only available in Grafana 5.3+). |
|
||||
|
||||
We plan to add many more macros. If you have suggestions for what macros you would like to see, please [open an issue](https://github.com/grafana/grafana) in our GitHub repo.
|
||||
|
||||
@@ -177,12 +180,13 @@ The resulting table panel:
|
||||
|
||||
## Time series queries
|
||||
|
||||
If you set `Format as` to `Time series`, for use in Graph panel for example, then the query must return a column named `time` that returns either a SQL datetime or any numeric datatype representing Unix epoch.
|
||||
Any column except `time` and `metric` is treated as a value column.
|
||||
You may return a column named `metric` that is used as metric name for the value column.
|
||||
If you return multiple value columns and a column named `metric` then this column is used as prefix for the series name (only available in Grafana 5.3+).
|
||||
If you set Format as to _Time series_, then the query must have a column named time that returns either a SQL datetime or any numeric datatype representing Unix epoch in seconds. In addition, result sets of time series queries must be sorted by time for panels to properly visualize the result.
|
||||
|
||||
Resultsets of time series queries need to be sorted by time.
|
||||
A time series query result is returned in a [wide data frame format]({{< relref "../developers/plugins/data-frames.md#wide-format" >}}). Any column except time or of type string transforms into value fields in the data frame query result. Any string column transforms into field labels in the data frame query result.
|
||||
|
||||
> For backward compatibility, there's an exception to the above rule for queries that return three columns including a string column named metric. Instead of transforming the metric column into field labels, it becomes the field name, and then the series name is formatted as the value of the metric column. See the example with the metric column below.
|
||||
|
||||
You can optionally customize the default series name formatting using instructions in [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}).
|
||||
|
||||
**Example with `metric` column:**
|
||||
|
||||
@@ -197,20 +201,48 @@ GROUP BY time
|
||||
ORDER BY time
|
||||
```
|
||||
|
||||
**Example using the fill parameter in the $__timeGroup macro to convert null values to be zero instead:**
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+-----------------+
|
||||
| Name: time | Name: min |
|
||||
| Labels: | Labels: |
|
||||
| Type: []time.Time | Type: []float64 |
|
||||
+---------------------+-----------------+
|
||||
| 2020-01-02 03:05:00 | 3 |
|
||||
| 2020-01-02 03:10:00 | 6 |
|
||||
+---------------------+-----------------+
|
||||
```
|
||||
|
||||
**Example using the fill parameter in the $\_\_timeGroup macro to convert null values to be zero instead:**
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
$__timeGroup(createdAt,'5m',0),
|
||||
sum(value_double) as value,
|
||||
measurement
|
||||
hostname
|
||||
FROM test_data
|
||||
WHERE
|
||||
$__timeFilter(createdAt)
|
||||
GROUP BY time, measurement
|
||||
GROUP BY time, hostname
|
||||
ORDER BY time
|
||||
```
|
||||
|
||||
Given the data frame result in the following example and using the graph panel, you will get two series named _value 10.0.1.1_ and _value 10.0.1.2_. To render the series with a name of _10.0.1.1_ and _10.0.1.2_ , use a [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) value of `${__field.labels.hostname}`.
|
||||
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
| Name: time | Name: value | Name: value |
|
||||
| Labels: | Labels: hostname=10.0.1.1 | Labels: hostname=10.0.1.2 |
|
||||
| Type: []time.Time | Type: []float64 | Type: []float64 |
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
| 2020-01-02 03:05:00 | 3 | 4 |
|
||||
| 2020-01-02 03:10:00 | 6 | 7 |
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
```
|
||||
|
||||
**Example with multiple columns:**
|
||||
|
||||
```sql
|
||||
@@ -224,6 +256,19 @@ GROUP BY time
|
||||
ORDER BY time
|
||||
```
|
||||
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+-----------------+-----------------+
|
||||
| Name: time | Name: min_value | Name: max_value |
|
||||
| Labels: | Labels: | Labels: |
|
||||
| Type: []time.Time | Type: []float64 | Type: []float64 |
|
||||
+---------------------+-----------------+-----------------+
|
||||
| 2020-01-02 03:04:00 | 3 | 4 |
|
||||
| 2020-01-02 03:05:00 | 6 | 7 |
|
||||
+---------------------+-----------------+-----------------+
|
||||
```
|
||||
|
||||
Currently, there is no support for a dynamic group by time based on time range and panel width.
|
||||
This is something we plan to add.
|
||||
|
||||
@@ -240,7 +285,7 @@ Check out the [Templating]({{< relref "../variables/_index.md" >}}) documentatio
|
||||
If you add a template variable of the type `Query`, you can write a MySQL query that can
|
||||
return things like measurement names, key names or key values that are shown as a dropdown select box.
|
||||
|
||||
For example, you can have a variable that contains all values for the `hostname` column in a table if you specify a query like this in the templating variable *Query* setting.
|
||||
For example, you can have a variable that contains all values for the `hostname` column in a table if you specify a query like this in the templating variable _Query_ setting.
|
||||
|
||||
```sql
|
||||
SELECT hostname FROM my_host
|
||||
@@ -252,7 +297,7 @@ A query can return multiple columns and Grafana will automatically create a list
|
||||
SELECT my_host.hostname, my_other_host.hostname2 FROM my_host JOIN my_other_host ON my_host.city = my_other_host.city
|
||||
```
|
||||
|
||||
To use time range dependent macros like `$__timeFilter(column)` in your query the refresh mode of the template variable needs to be set to *On Time Range Change*.
|
||||
To use time range dependent macros like `$__timeFilter(column)` in your query the refresh mode of the template variable needs to be set to _On Time Range Change_.
|
||||
|
||||
```sql
|
||||
SELECT event_name FROM event_log WHERE $__timeFilter(time_column)
|
||||
@@ -272,6 +317,7 @@ SELECT hostname FROM my_host WHERE region IN($region)
|
||||
```
|
||||
|
||||
#### Using `__searchFilter` to filter results in Query Variable
|
||||
|
||||
> Available from Grafana 6.5 and above
|
||||
|
||||
Using `__searchFilter` in the query field will filter the query result based on what the user types in the dropdown select box.
|
||||
@@ -282,6 +328,7 @@ When nothing has been entered by the user the default value for `__searchFilter`
|
||||
The example below shows how to use `__searchFilter` as part of the query field to enable searching for `hostname` while the user types in the dropdown select box.
|
||||
|
||||
Query
|
||||
|
||||
```sql
|
||||
SELECT hostname FROM my_host WHERE hostname LIKE '$__searchFilter'
|
||||
```
|
||||
@@ -296,7 +343,7 @@ If the variable is a multi-value variable then use the `IN` comparison operator
|
||||
|
||||
There are two syntaxes:
|
||||
|
||||
`$<varname>` Example with a template variable named `hostname`:
|
||||
`$<varname>` Example with a template variable named `hostname`:
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
@@ -308,7 +355,7 @@ WHERE $__timeFilter(atimestamp) and hostname in($hostname)
|
||||
ORDER BY atimestamp ASC
|
||||
```
|
||||
|
||||
`[[varname]]` Example with a template variable named `hostname`:
|
||||
`[[varname]]` Example with a template variable named `hostname`:
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
@@ -374,12 +421,12 @@ WHERE
|
||||
$__timeFilter(native_date_time)
|
||||
```
|
||||
|
||||
Name | Description
|
||||
----------- | -------------
|
||||
`time` | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
`timeend` | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value. (Grafana v6.6+)
|
||||
`text` | Event description field.
|
||||
`tags` | Optional field name to use for event tags as a comma separated string.
|
||||
| Name | Description |
|
||||
| --------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `time` | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value. |
|
||||
| `timeend` | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value. (Grafana v6.6+) |
|
||||
| `text` | Event description field. |
|
||||
| `tags` | Optional field name to use for event tags as a comma separated string. |
|
||||
|
||||
## Alerting
|
||||
|
||||
@@ -402,7 +449,7 @@ datasources:
|
||||
user: grafana
|
||||
password: password
|
||||
jsonData:
|
||||
maxOpenConns: 0 # Grafana v5.4+
|
||||
maxIdleConns: 2 # Grafana v5.4+
|
||||
connMaxLifetime: 14400 # Grafana v5.4+
|
||||
maxOpenConns: 0 # Grafana v5.4+
|
||||
maxIdleConns: 2 # Grafana v5.4+
|
||||
connMaxLifetime: 14400 # Grafana v5.4+
|
||||
```
|
||||
|
||||
@@ -14,15 +14,15 @@ Grafana ships with advanced support for OpenTSDB. This topic explains options, v
|
||||
|
||||
To access OpenTSDB settings, hover your mouse over the **Configuration** (gear) icon, then click **Data Sources**, and then click the OpenTSDB data source.
|
||||
|
||||
| Name | Description |
|
||||
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `URL` | The HTTP protocol, IP, and port of your OpenTSDB server (default port is usually 4242) |
|
||||
| `Whitelisted Cookies` | List the names of cookies to forward to the data source. |
|
||||
| `Version` | Version = opentsdb version, either <=2.1 or 2.2 |
|
||||
| `Resolution` | Metrics from opentsdb may have datapoints with either second or millisecond resolution. |
|
||||
| `Lookup Limit`| Default is 1000. |
|
||||
| Name | Description |
|
||||
| --------------------- | --------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `URL` | The HTTP protocol, IP, and port of your OpenTSDB server (default port is usually 4242) |
|
||||
| `Whitelisted Cookies` | List the names of cookies to forward to the data source. |
|
||||
| `Version` | Version = opentsdb version, either <=2.1 or 2.2 |
|
||||
| `Resolution` | Metrics from opentsdb may have datapoints with either second or millisecond resolution. |
|
||||
| `Lookup Limit` | Default is 1000. |
|
||||
|
||||
## Query editor
|
||||
|
||||
|
||||
@@ -14,22 +14,22 @@ Grafana ships with a built-in PostgreSQL data source plugin that allows you to q
|
||||
|
||||
To access PostgreSQL settings, hover your mouse over the **Configuration** (gear) icon, then click **Data Sources**, and then click the Prometheus data source.
|
||||
|
||||
Name | Description
|
||||
----------------- | -------------
|
||||
`Name` | The data source name. This is how you refer to the data source in panels and queries.
|
||||
`Default` | Default data source means that it will be pre-selected for new panels.
|
||||
`Host` | The IP address/hostname and optional port of your PostgreSQL instance. _Do not_ include the database name. The connection string for connecting to Postgres will not be correct and it may cause errors.
|
||||
`Database` | Name of your PostgreSQL database.
|
||||
`User` | Database user's login/username
|
||||
`Password` | Database user's password
|
||||
`SSL Mode` | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. When SSL Mode is disabled, SSL Method and Auth Details would not be visible.
|
||||
`SSL Auth Details Method` | Determines whether the SSL Auth details will be configured as a file path or file content. Grafana v7.5+
|
||||
`SSL Auth Details Value` | File path or file content of SSL root certificate, client certificate and client key
|
||||
`Max open` | The maximum number of open connections to the database, default `unlimited` (Grafana v5.4+).
|
||||
`Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+).
|
||||
`Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours (Grafana v5.4+).
|
||||
`Version` |Determines which functions are available in the query builder (only available in Grafana 5.3+).
|
||||
`TimescaleDB` |A time-series database built as a PostgreSQL extension. When enabled, Grafana uses `time_bucket` in the `$__timeGroup` macro to display TimescaleDB specific aggregate functions in the query builder (only available in Grafana 5.3+).
|
||||
| Name | Description |
|
||||
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
||||
| `Default` | Default data source means that it will be pre-selected for new panels. |
|
||||
| `Host` | The IP address/hostname and optional port of your PostgreSQL instance. _Do not_ include the database name. The connection string for connecting to Postgres will not be correct and it may cause errors. |
|
||||
| `Database` | Name of your PostgreSQL database. |
|
||||
| `User` | Database user's login/username |
|
||||
| `Password` | Database user's password |
|
||||
| `SSL Mode` | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. When SSL Mode is disabled, SSL Method and Auth Details would not be visible. |
|
||||
| `SSL Auth Details Method` | Determines whether the SSL Auth details will be configured as a file path or file content. Grafana v7.5+ |
|
||||
| `SSL Auth Details Value` | File path or file content of SSL root certificate, client certificate and client key |
|
||||
| `Max open` | The maximum number of open connections to the database, default `unlimited` (Grafana v5.4+). |
|
||||
| `Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+). |
|
||||
| `Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours (Grafana v5.4+). |
|
||||
| `Version` | Determines which functions are available in the query builder (only available in Grafana 5.3+). |
|
||||
| `TimescaleDB` | A time-series database built as a PostgreSQL extension. When enabled, Grafana uses `time_bucket` in the `$__timeGroup` macro to display TimescaleDB specific aggregate functions in the query builder (only available in Grafana 5.3+). |
|
||||
|
||||
### Min time interval
|
||||
|
||||
@@ -109,10 +109,12 @@ avg(tx_bytes) OVER (ORDER BY "time" ROWS 5 PRECEDING) AS "tx_bytes"
|
||||
You may add further value columns by clicking the plus button and selecting `Column` from the menu. Multiple value columns will be plotted as separate series in the graph panel.
|
||||
|
||||
### Filter data (WHERE)
|
||||
|
||||
To add a filter click the plus icon to the right of the `WHERE` condition. You can remove filters by clicking on
|
||||
the filter and selecting `Remove`. A filter for the current selected timerange is automatically added to new queries.
|
||||
|
||||
### Group by
|
||||
|
||||
To group by time or any other columns click the plus icon at the end of the GROUP BY row. The suggestion dropdown will only show text columns of your currently selected table but you may manually enter any column.
|
||||
You can remove the group by clicking on the item and then selecting `Remove`.
|
||||
|
||||
@@ -123,6 +125,7 @@ If you add any grouping, all selected columns need to have an aggregate function
|
||||
Grafana can fill in missing values when you group by time. The time function accepts two arguments. The first argument is the time window that you would like to group by, and the second argument is the value you want Grafana to fill missing items with.
|
||||
|
||||
### Text editor mode (RAW)
|
||||
|
||||
You can switch to the raw query editor mode by clicking the hamburger icon and selecting `Switch editor mode` or by clicking `Edit SQL` below the query.
|
||||
|
||||
> If you use the raw query editor, be sure your query at minimum has `ORDER BY time` and a filter on the returned time range.
|
||||
@@ -131,26 +134,26 @@ You can switch to the raw query editor mode by clicking the hamburger icon and s
|
||||
|
||||
Macros can be used within a query to simplify syntax and allow for dynamic parts.
|
||||
|
||||
Macro example | Description
|
||||
------------------------------------------------------ | -------------
|
||||
`$__time(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, *UNIX_TIMESTAMP(dateColumn) as time_sec*
|
||||
`$__timeEpoch(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, *UNIX_TIMESTAMP(dateColumn) as time_sec*
|
||||
`$__timeFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name. For example, *dateColumn BETWEEN FROM_UNIXTIME(1494410783) AND FROM_UNIXTIME(1494410983)*
|
||||
`$__timeFrom()` | Will be replaced by the start of the currently active time selection. For example, *FROM_UNIXTIME(1494410783)*
|
||||
`$__timeTo()` | Will be replaced by the end of the currently active time selection. For example, *FROM_UNIXTIME(1494410983)*
|
||||
`$__timeGroup(dateColumn,'5m')` | Will be replaced by an expression usable in GROUP BY clause. For example, *cast(cast(UNIX_TIMESTAMP(dateColumn)/(300) as signed)*300 as signed),*
|
||||
`$__timeGroup(dateColumn,'5m', 0)` | Same as above but with a fill parameter so missing points in that series will be added by grafana and 0 will be used as value.
|
||||
`$__timeGroup(dateColumn,'5m', NULL)` | Same as above but NULL will be used as value for missing points.
|
||||
`$__timeGroup(dateColumn,'5m', previous)` | Same as above but the previous value in that series will be used as fill value if no value has been seen yet NULL will be used (only available in Grafana 5.3+).
|
||||
`$__timeGroupAlias(dateColumn,'5m')` | Will be replaced identical to $__timeGroup but with an added column alias (only available in Grafana 5.3+).
|
||||
`$__unixEpochFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as Unix timestamp. For example, *dateColumn > 1494410783 AND dateColumn < 1494497183*
|
||||
`$__unixEpochFrom()` | Will be replaced by the start of the currently active time selection as Unix timestamp. For example, *1494410783*
|
||||
`$__unixEpochTo()` | Will be replaced by the end of the currently active time selection as Unix timestamp. For example, *1494497183*
|
||||
`$__unixEpochNanoFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as nanosecond timestamp. For example, *dateColumn > 1494410783152415214 AND dateColumn < 1494497183142514872*
|
||||
`$__unixEpochNanoFrom()` | Will be replaced by the start of the currently active time selection as nanosecond timestamp. For example, *1494410783152415214*
|
||||
`$__unixEpochNanoTo()` | Will be replaced by the end of the currently active time selection as nanosecond timestamp. For example, *1494497183142514872*
|
||||
`$__unixEpochGroup(dateColumn,'5m', [fillmode])` | Same as $__timeGroup but for times stored as Unix timestamp (only available in Grafana 5.3+).
|
||||
`$__unixEpochGroupAlias(dateColumn,'5m', [fillmode])` | Same as above but also adds a column alias (only available in Grafana 5.3+).
|
||||
| Macro example | Description |
|
||||
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `$__time(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, _UNIX_TIMESTAMP(dateColumn) as time_sec_ |
|
||||
| `$__timeEpoch(dateColumn)` | Will be replaced by an expression to convert to a UNIX timestamp and rename the column to `time_sec`. For example, _UNIX_TIMESTAMP(dateColumn) as time_sec_ |
|
||||
| `$__timeFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name. For example, _dateColumn BETWEEN FROM_UNIXTIME(1494410783) AND FROM_UNIXTIME(1494410983)_ |
|
||||
| `$__timeFrom()` | Will be replaced by the start of the currently active time selection. For example, _FROM_UNIXTIME(1494410783)_ |
|
||||
| `$__timeTo()` | Will be replaced by the end of the currently active time selection. For example, _FROM_UNIXTIME(1494410983)_ |
|
||||
| `$__timeGroup(dateColumn,'5m')` | Will be replaced by an expression usable in GROUP BY clause. For example, *cast(cast(UNIX_TIMESTAMP(dateColumn)/(300) as signed)*300 as signed),\* |
|
||||
| `$__timeGroup(dateColumn,'5m', 0)` | Same as above but with a fill parameter so missing points in that series will be added by grafana and 0 will be used as value. |
|
||||
| `$__timeGroup(dateColumn,'5m', NULL)` | Same as above but NULL will be used as value for missing points. |
|
||||
| `$__timeGroup(dateColumn,'5m', previous)` | Same as above but the previous value in that series will be used as fill value if no value has been seen yet NULL will be used (only available in Grafana 5.3+). |
|
||||
| `$__timeGroupAlias(dateColumn,'5m')` | Will be replaced identical to $\_\_timeGroup but with an added column alias (only available in Grafana 5.3+). |
|
||||
| `$__unixEpochFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as Unix timestamp. For example, _dateColumn > 1494410783 AND dateColumn < 1494497183_ |
|
||||
| `$__unixEpochFrom()` | Will be replaced by the start of the currently active time selection as Unix timestamp. For example, _1494410783_ |
|
||||
| `$__unixEpochTo()` | Will be replaced by the end of the currently active time selection as Unix timestamp. For example, _1494497183_ |
|
||||
| `$__unixEpochNanoFilter(dateColumn)` | Will be replaced by a time range filter using the specified column name with times represented as nanosecond timestamp. For example, _dateColumn > 1494410783152415214 AND dateColumn < 1494497183142514872_ |
|
||||
| `$__unixEpochNanoFrom()` | Will be replaced by the start of the currently active time selection as nanosecond timestamp. For example, _1494410783152415214_ |
|
||||
| `$__unixEpochNanoTo()` | Will be replaced by the end of the currently active time selection as nanosecond timestamp. For example, _1494497183142514872_ |
|
||||
| `$__unixEpochGroup(dateColumn,'5m', [fillmode])` | Same as $\_\_timeGroup but for times stored as Unix timestamp (only available in Grafana 5.3+). |
|
||||
| `$__unixEpochGroupAlias(dateColumn,'5m', [fillmode])` | Same as above but also adds a column alias (only available in Grafana 5.3+). |
|
||||
|
||||
We plan to add many more macros. If you have suggestions for what macros you would like to see, please [open an issue](https://github.com/grafana/grafana) in our GitHub repo.
|
||||
|
||||
@@ -162,7 +165,6 @@ Query editor with example query:
|
||||
|
||||

|
||||
|
||||
|
||||
The query:
|
||||
|
||||
```sql
|
||||
@@ -183,12 +185,13 @@ The resulting table panel:
|
||||
|
||||
## Time series queries
|
||||
|
||||
If you set `Format as` to `Time series`, for use in Graph panel for example, then the query must return a column named `time` that returns either a SQL datetime or any numeric datatype representing Unix epoch.
|
||||
Any column except `time` and `metric` are treated as a value column.
|
||||
You may return a column named `metric` that is used as metric name for the value column.
|
||||
If you return multiple value columns and a column named `metric` then this column is used as prefix for the series name (only available in Grafana 5.3+).
|
||||
If you set Format as to _Time series_, then the query must have a column named time that returns either a SQL datetime or any numeric datatype representing Unix epoch in seconds. In addition, result sets of time series queries must be sorted by time for panels to properly visualize the result.
|
||||
|
||||
Resultsets of time series queries need to be sorted by time.
|
||||
A time series query result is returned in a [wide data frame format]({{< relref "../developers/plugins/data-frames.md#wide-format" >}}). Any column except time or of type string transforms into value fields in the data frame query result. Any string column transforms into field labels in the data frame query result.
|
||||
|
||||
> For backward compatibility, there's an exception to the above rule for queries that return three columns including a string column named metric. Instead of transforming the metric column into field labels, it becomes the field name, and then the series name is formatted as the value of the metric column. See the example with the metric column below.
|
||||
|
||||
You can optionally customize the default series name formatting using instructions in [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}).
|
||||
|
||||
**Example with `metric` column:**
|
||||
|
||||
@@ -203,20 +206,48 @@ GROUP BY time
|
||||
ORDER BY time
|
||||
```
|
||||
|
||||
**Example using the fill parameter in the $__timeGroup macro to convert null values to be zero instead:**
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+-----------------+
|
||||
| Name: time | Name: min |
|
||||
| Labels: | Labels: |
|
||||
| Type: []time.Time | Type: []float64 |
|
||||
+---------------------+-----------------+
|
||||
| 2020-01-02 03:05:00 | 3 |
|
||||
| 2020-01-02 03:10:00 | 6 |
|
||||
+---------------------+-----------------+
|
||||
```
|
||||
|
||||
**Example using the fill parameter in the $\_\_timeGroup macro to convert null values to be zero instead:**
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
$__timeGroup("createdAt",'5m',0),
|
||||
sum(value) as value,
|
||||
measurement
|
||||
hostname
|
||||
FROM test_data
|
||||
WHERE
|
||||
$__timeFilter("createdAt")
|
||||
GROUP BY time, measurement
|
||||
GROUP BY time, hostname
|
||||
ORDER BY time
|
||||
```
|
||||
|
||||
Given the data frame result in the following example and using the graph panel, you will get two series named _value 10.0.1.1_ and _value 10.0.1.2_. To render the series with a name of _10.0.1.1_ and _10.0.1.2_ , use a [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) value of `${__field.labels.hostname}`.
|
||||
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
| Name: time | Name: value | Name: value |
|
||||
| Labels: | Labels: hostname=10.0.1.1 | Labels: hostname=10.0.1.2 |
|
||||
| Type: []time.Time | Type: []float64 | Type: []float64 |
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
| 2020-01-02 03:05:00 | 3 | 4 |
|
||||
| 2020-01-02 03:10:00 | 6 | 7 |
|
||||
+---------------------+---------------------------+---------------------------+
|
||||
```
|
||||
|
||||
**Example with multiple columns:**
|
||||
|
||||
```sql
|
||||
@@ -230,6 +261,19 @@ GROUP BY time
|
||||
ORDER BY time
|
||||
```
|
||||
|
||||
Data frame result:
|
||||
|
||||
```text
|
||||
+---------------------+-----------------+-----------------+
|
||||
| Name: time | Name: min_value | Name: max_value |
|
||||
| Labels: | Labels: | Labels: |
|
||||
| Type: []time.Time | Type: []float64 | Type: []float64 |
|
||||
+---------------------+-----------------+-----------------+
|
||||
| 2020-01-02 03:04:00 | 3 | 4 |
|
||||
| 2020-01-02 03:05:00 | 6 | 7 |
|
||||
+---------------------+-----------------+-----------------+
|
||||
```
|
||||
|
||||
## Templating
|
||||
|
||||
Instead of hard-coding things like server, application and sensor name in your metric queries you can use variables in their place. Variables are shown as dropdown select boxes at the top of the dashboard. These dropdowns make it easy to change the data being displayed in your dashboard.
|
||||
@@ -241,7 +285,7 @@ Refer to [Templates and variables]({{< relref "../variables/_index.md" >}}) for
|
||||
If you add a template variable of the type `Query`, you can write a PostgreSQL query that can
|
||||
return things like measurement names, key names or key values that are shown as a dropdown select box.
|
||||
|
||||
For example, you can have a variable that contains all values for the `hostname` column in a table if you specify a query like this in the templating variable *Query* setting.
|
||||
For example, you can have a variable that contains all values for the `hostname` column in a table if you specify a query like this in the templating variable _Query_ setting.
|
||||
|
||||
```sql
|
||||
SELECT hostname FROM host
|
||||
@@ -253,7 +297,7 @@ A query can return multiple columns and Grafana will automatically create a list
|
||||
SELECT host.hostname, other_host.hostname2 FROM host JOIN other_host ON host.city = other_host.city
|
||||
```
|
||||
|
||||
To use time range dependent macros like `$__timeFilter(column)` in your query the refresh mode of the template variable needs to be set to *On Time Range Change*.
|
||||
To use time range dependent macros like `$__timeFilter(column)` in your query the refresh mode of the template variable needs to be set to _On Time Range Change_.
|
||||
|
||||
```sql
|
||||
SELECT event_name FROM event_log WHERE $__timeFilter(time_column)
|
||||
@@ -273,6 +317,7 @@ SELECT hostname FROM host WHERE region IN($region)
|
||||
```
|
||||
|
||||
#### Using `__searchFilter` to filter results in Query Variable
|
||||
|
||||
> Available from Grafana 6.5 and above
|
||||
|
||||
Using `__searchFilter` in the query field will filter the query result based on what the user types in the dropdown select box.
|
||||
@@ -283,6 +328,7 @@ When nothing has been entered by the user the default value for `__searchFilter`
|
||||
The example below shows how to use `__searchFilter` as part of the query field to enable searching for `hostname` while the user types in the dropdown select box.
|
||||
|
||||
Query
|
||||
|
||||
```sql
|
||||
SELECT hostname FROM my_host WHERE hostname LIKE '$__searchFilter'
|
||||
```
|
||||
@@ -297,7 +343,7 @@ If the variable is a multi-value variable then use the `IN` comparison operator
|
||||
|
||||
There are two syntaxes:
|
||||
|
||||
`$<varname>` Example with a template variable named `hostname`:
|
||||
`$<varname>` Example with a template variable named `hostname`:
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
@@ -308,7 +354,7 @@ WHERE $__timeFilter(atimestamp) and hostname in($hostname)
|
||||
ORDER BY atimestamp ASC
|
||||
```
|
||||
|
||||
`[[varname]]` Example with a template variable named `hostname`:
|
||||
`[[varname]]` Example with a template variable named `hostname`:
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
@@ -373,12 +419,12 @@ WHERE
|
||||
$__timeFilter(native_date_time)
|
||||
```
|
||||
|
||||
Name | Description
|
||||
----------- | -------------
|
||||
`time` | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
`timeend` | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value. (Grafana v6.6+)
|
||||
`text` | Event description field.
|
||||
`tags` | Optional field name to use for event tags as a comma separated string.
|
||||
| Name | Description |
|
||||
| --------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `time` | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value. |
|
||||
| `timeend` | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value. (Grafana v6.6+) |
|
||||
| `text` | Event description field. |
|
||||
| `tags` | Optional field name to use for event tags as a comma separated string. |
|
||||
|
||||
## Alerting
|
||||
|
||||
@@ -401,17 +447,19 @@ datasources:
|
||||
database: grafana
|
||||
user: grafana
|
||||
secureJsonData:
|
||||
password: "Password!"
|
||||
password: 'Password!'
|
||||
jsonData:
|
||||
sslmode: "disable" # disable/require/verify-ca/verify-full
|
||||
maxOpenConns: 0 # Grafana v5.4+
|
||||
maxIdleConns: 2 # Grafana v5.4+
|
||||
connMaxLifetime: 14400 # Grafana v5.4+
|
||||
sslmode: 'disable' # disable/require/verify-ca/verify-full
|
||||
maxOpenConns: 0 # Grafana v5.4+
|
||||
maxIdleConns: 2 # Grafana v5.4+
|
||||
connMaxLifetime: 14400 # Grafana v5.4+
|
||||
postgresVersion: 903 # 903=9.3, 904=9.4, 905=9.5, 906=9.6, 1000=10
|
||||
timescaledb: false
|
||||
```
|
||||
>**Note:** In the above code, the `postgresVersion` value of `10` refers to version PotgreSQL 10 and above.
|
||||
|
||||
> **Note:** In the above code, the `postgresVersion` value of `10` refers to version PotgreSQL 10 and above.
|
||||
|
||||
If you encounter metric request errors or other issues:
|
||||
|
||||
- Make sure your data source YAML file parameters exactly match the example. This includes parameter names and use of quotation marks.
|
||||
- Make sure the `database` name is not included in the `url`.
|
||||
|
||||
@@ -10,6 +10,10 @@ weight = 1300
|
||||
|
||||
Grafana includes built-in support for Prometheus. This topic explains options, variables, querying, and other options specific to the Prometheus data source. Refer to [Add a data source]({{< relref "add-a-data-source.md" >}}) for instructions on how to add a data source to Grafana. Only users with the organization admin role can add data sources.
|
||||
|
||||
## Hosted Prometheus
|
||||
|
||||
Run Prometheus on your own hardware or use [Grafana Cloud](https://grafana.com/products/cloud/features/#cloud-dashboards-grafana). The free forever plan includes Grafana, 10K Prometheus series, 50 GB logs and more. [Create a free account to get started](https://grafana.com/auth/sign-up/create-user?pg=doc-grafana-&plcmt=in-text).
|
||||
|
||||
## Prometheus settings
|
||||
|
||||
To access Prometheus settings, hover your mouse over the **Configuration** (gear) icon, then click **Data Sources**, and then click the Prometheus data source.
|
||||
@@ -42,17 +46,19 @@ Open a graph in edit mode by clicking the title > Edit (or by pressing `e` key w
|
||||
{{< figure src="/static/img/docs/v45/prometheus_query_editor_still.png"
|
||||
animated-gif="/static/img/docs/v45/prometheus_query_editor.gif" >}}
|
||||
|
||||
| Name | Description |
|
||||
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Query expression` | Prometheus query expression, check out the [Prometheus documentation](http://prometheus.io/docs/querying/basics/). |
|
||||
| `Legend format` | Controls the name of the time series, using name or pattern. For example `{{hostname}}` is replaced with the label value for the label `hostname`. |
|
||||
| `Min step` | An additional lower limit for the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) and for the `$__interval` and `$__rate_interval` variables. The limit is absolute, it cannot modified by the _Resolution_ setting. |
|
||||
| `Resolution` | `1/1` sets both the `$__interval` variable and the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) such that each pixel corresponds to one data point. For better performance, lower resolutions can be picked. `1/2` only retrieves a data point for every other pixel, and `1/10` retrieves one data point per 10 pixels. Note that both _Min time interval_ and _Min step_ limit the final value of `$__interval` and `step`. |
|
||||
| `Metric lookup` | Search for metric names in this input field. |
|
||||
| `Format as` | Switch between `Table`, `Time series`, or `Heatmap`. `Table` will only work in the Table panel. `Heatmap` is suitable for displaying metrics of the Histogram type on a Heatmap panel. Under the hood, it converts cumulative histograms to regular ones and sorts series by the bucket bound. |
|
||||
| `Instant` | Perform an "instant" query, to return only the latest value that Prometheus has scraped for the requested time series. Instant queries return results much faster than normal range queries. Use them to look up label sets. |
|
||||
| `Min time interval` | This value multiplied by the denominator from the _Resolution_ setting sets a lower limit to both the `$__interval` variable and the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries). Defaults to _Scrape interval_ as set in the data source options. |
|
||||
| `Exemplars` | Run and show exemplars in the graph. |
|
||||
| Name | Description |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Query expression` | Prometheus query expression, check out the [Prometheus documentation](http://prometheus.io/docs/querying/basics/). |
|
||||
| `Legend format` | Controls the name of the time series, using name or pattern. For example `{{hostname}}` is replaced with the label value for the label `hostname`. |
|
||||
| `Step` | Use 'Minimum' or 'Maximum' step mode to set the lower or upper bounds respectively on the interval between data points. For example, set "minimum 1h" to hint that measurements were not taken more frequently. Use the 'Exact' step mode to set an exact interval between data points. `$__interval` and `$__rate_interval` are supported. |
|
||||
|
||||
| `Resolution` | `1/1` sets both the `$__interval` variable and the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) such that each pixel corresponds to one data point. For better performance, lower resolutions can be picked. `1/2` only retrieves a data point for every other pixel, and `1/10` retrieves one data point per 10 pixels. Note that both _Min time interval_ and _Step_ limit the final value of `$__interval` and `step`. |
|
||||
|
||||
| `Metric lookup` | Search for metric names in this input field. |
|
||||
| `Format as` | Switch between `Table`, `Time series`, or `Heatmap`. `Table` will only work in the Table panel. `Heatmap` is suitable for displaying metrics of the Histogram type on a Heatmap panel. Under the hood, it converts cumulative histograms to regular ones and sorts series by the bucket bound. |
|
||||
| `Instant` | Perform an "instant" query, to return only the latest value that Prometheus has scraped for the requested time series. Instant queries return results much faster than normal range queries. Use them to look up label sets. |
|
||||
| `Min time interval` | This value multiplied by the denominator from the _Resolution_ setting sets a lower limit to both the `$__interval` variable and the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries). Defaults to _Scrape interval_ as set in the data source options. |
|
||||
| `Exemplars` | Run and show exemplars in the graph. |
|
||||
|
||||
> **Note:** Grafana modifies the request dates for queries to align them with the dynamically calculated step. This ensures consistent display of metrics data, but it can result in a small gap of data at the right edge of a graph.
|
||||
|
||||
@@ -61,7 +67,7 @@ Open a graph in edit mode by clicking the title > Edit (or by pressing `e` key w
|
||||
The Prometheus data source allows you to run "instant" queries, which query only the latest value.
|
||||
You can visualize the results in a table panel to see all available labels of a timeseries.
|
||||
|
||||
Instant query results are made up only of one data point per series but can be shown in the graph panel with the help of [series overrides]({{< relref "../panels/visualizations/graph-panel.md#series-overrides" >}}).
|
||||
Instant query results are made up only of one data point per series but can be shown in the graph panel with the help of [series overrides]({{< relref "../visualizations/graph-panel.md#series-overrides" >}}).
|
||||
To show them in the graph as a latest value point, add a series override and select `Points > true`.
|
||||
To show a horizontal line across the whole graph, add a series override and select `Transform > constant`.
|
||||
|
||||
@@ -158,7 +164,7 @@ OK: rate(http_requests_total[5m])
|
||||
Better: rate(http_requests_total[$__rate_interval])
|
||||
```
|
||||
|
||||
Details: `$__rate_interval` is defined as max(`$__interval` + _Scrape interval_, 4 \* _Scrape interval_), where _Scrape interval_ is the Min step setting (AKA query_interval, a setting per PromQL query) if any is set. Otherwise, the Scrape interval setting in the Prometheus data source is used. (The Min interval setting in the panel is modified by the resolution setting and therefore doesn't have any effect on _Scrape interval_.) [This article](https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/) contains additional details.
|
||||
Details: `$__rate_interval` is defined as max(`$__interval` + _Scrape interval_, 4 \* _Scrape interval_), where _Scrape interval_ is the Min step setting (AKA query*interval, a setting per PromQL query) if any is set. Otherwise, the Scrape interval setting in the Prometheus data source is used. (The Min interval setting in the panel is modified by the resolution setting and therefore doesn't have any effect on \_Scrape interval*.) [This article](https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/) contains additional details.
|
||||
|
||||
### Using variables in queries
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ This is a configuration for the [trace to logs feature]({{< relref "../explore/t
|
||||
|
||||
- **Data source -** Target data source.
|
||||
- **Tags -** The tags that will be used in the Loki query. Default is `'cluster', 'hostname', 'namespace', 'pod'`.
|
||||
- **Span start time shift -** Shift in the start time for the Loki query based on the span start time. In order to extend to the past, you need to use a negative value. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
- **Span start time shift -** Shift in the start time for the Loki query based on the span start time. In order to extend to the past, you need to use a negative value. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
- **Span end time shift -** Shift in the end time for the Loki query based on the span end time. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
|
||||

|
||||
|
||||
@@ -36,6 +36,7 @@ Once you provided the numbers, `TestData DB` distributes them evenly based on th
|
||||
## Dashboards
|
||||
|
||||
`TestData DB` also contains some dashboards with examples.
|
||||
|
||||
1. Click **Configuration** > **Data Sources** > **TestData DB** > **Dashboards**.
|
||||
1. **Import** the **Simple Streaming Example** dashboard.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user