diff --git a/authentication/index.html b/authentication/index.html index e35c672e..408b28df 100644 --- a/authentication/index.html +++ b/authentication/index.html @@ -23,7 +23,7 @@ grr config set synthetic-monitoring.logs-id # Metrics instance ID

Your stack ID is the number at the end of the url when you view your Grafana instance details, ie. grafana.com/orgs/myorg/stacks/123456 would be 123456. Your metrics and logs ID’s are the User when you view your Prometheus or Loki instance details in Grafana Cloud.

Contexts

Grizzly supports multiple contexts allowing easy swapping between instances. By default, Grizzly uses the default context.

[Optional] If you have environment variables configured, you can import these into the default context like so:

grr config import
-

Create a new context with:

grr config create production
+

Create a new context with:

grr config create-context production
 

To list existing contexts:

grr config get-contexts
 

To show the currently selected context:

grr config current-context
 

To switch to a different context:

grr config use-context staging
diff --git a/grafana/index.html b/grafana/index.html
index 4eeea053..86d2e59b 100644
--- a/grafana/index.html
+++ b/grafana/index.html
@@ -35,5 +35,129 @@
 spec:
     access: proxy
     url: http://localhost/prometheus/
+

Library Elements

Library Elements (currently Panels and Variables) are structured like this:

apiVersion: grizzly.grafana.com/v1alpha1
+kind: LibraryElement
+metadata:
+    name: bcb6ec8a-8a64-4fa6-a490-68b8e73bee16
+spec:
+    kind: 1 # 1 = Panel, 2 = Variable
+    model:
+        datasource:
+            type: prometheus
+            uid: grafanacloud-prom
+        description: ""
+        gridPos:
+            h: 8
+            w: 12
+            x: 0
+            "y": 0
+        id: 1
+        options:
+            code:
+                language: plaintext
+                showLineNumbers: false
+                showMiniMap: false
+            content: Example Content
+            mode: markdown
+        title: Example Panel
+        type: text
+    name: Example Panel
+    orgId: 1
+    type: text
+

AlertRuleGroup

AlertRuleGroups are sets of rules evaluated at the same interval. +The easiest way to build alert rules is using the “Modify export” functionality in Grafana.

The resulting resource looks like this:

apiVersion: grizzly.grafana.com/v1alpha1
+kind: AlertRuleGroup
+metadata:
+    name: fee4037a-b193-4e28-9330-2cc9028b048c.d
+spec:
+    folderUid: fee4037a-b193-4e28-9330-2cc9028b048c
+    interval: 180 # in seconds
+    rules:
+        - condition: B
+          data:
+            - datasourceUid: grafanacloud-demoinfra-prom
+              model:
+                datasource:
+                    type: prometheus
+                    uid: grafanacloud-demoinfra-prom
+                editorMode: code
+                expr: weather_temp_c{location="Vienna"}
+                instant: true
+                intervalMs: 1000
+                legendFormat: __auto
+                maxDataPoints: 43200
+                range: false
+                refId: A
+              refId: A
+              relativeTimeRange:
+                from: 600
+            - datasourceUid: __expr__
+              model:
+                conditions:
+                    - evaluator:
+                        params:
+                            - 30
+                        type: gt
+                      operator:
+                        type: and
+                      query:
+                        params:
+                            - C
+                      reducer:
+                        params: []
+                        type: last
+                      type: query
+                datasource:
+                    type: __expr__
+                    uid: __expr__
+                expression: A
+                intervalMs: 1000
+                maxDataPoints: 43200
+                refId: B
+                type: threshold
+              refId: B
+              relativeTimeRange:
+                from: 600
+          execErrState: Error
+          folderUID: fee4037a-b193-4e28-9330-2cc9028b048c
+          for: 5m0s
+          id: 3
+          noDataState: NoData
+          orgID: 1
+          ruleGroup: d
+          title: Temperature high
+          uid: d4231da1-2456-4741-8a81-527167a96b69
+    title: Alert Group Europe
+

Contact Points

To provision contact points, use the following structure:

apiVersion: grizzly.grafana.com/v1alpha1
+kind: AlertContactPoint
+metadata:
+    name: eaae236a-7be9-4748-a08e-54b92ffb2e60
+spec:
+    name: grafana-default-email
+    settings:
+        addresses: <example@email.com>
+        singleEmail: false
+    type: email
+    uid: eaae236a-7be9-4748-a08e-54b92ffb2e60
+

If the contact point contains credentials, grizzly will always report a change +as Grafana will not expose the credentials via the API.

Notification Policy

As the Notification Policy is stored as a single resource in Grafana, you can +only have a single AlertNotificationPolicy specified. It needs to have the +name global:

apiVersion: grizzly.grafana.com/v1alpha1
+kind: AlertNotificationPolicy
+metadata:
+    name: global
+spec:
+    group_by:
+        - grafana_folder
+        - alertname
+    receiver: grafana-default-email
+    routes:
+        - group_by:
+            - region
+          object_matchers:
+            - - foo
+              - =
+              - bar
+          receiver: grafana-oncall
 
\ No newline at end of file