Skip to content

Commit 7deaab3

Browse files
mlqnmartinothamar
andauthored
feat: Add Grafana alert rules, contact points, dashboards, and notification policies manifests (#17162)
Co-authored-by: Martin Othamar <[email protected]>
1 parent 93bcf94 commit 7deaab3

File tree

11 files changed

+1914
-0
lines changed

11 files changed

+1914
-0
lines changed
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
apiVersion: grafana.integreatly.org/v1beta1
2+
kind: GrafanaAlertRuleGroup
3+
metadata:
4+
name: external-grafana-altinn-apps
5+
spec:
6+
name: Exceptions
7+
folderRef: external-grafana-altinn
8+
instanceSelector:
9+
matchLabels:
10+
dashboards: external-grafana
11+
interval: 5m
12+
rules:
13+
- uid: failed-process-next-requests
14+
title: Feilende process/next
15+
condition: C
16+
data:
17+
- refId: A
18+
queryType: Azure Log Analytics
19+
relativeTimeRange:
20+
from: 300
21+
to: 0
22+
datasourceUid: azure-monitor-oob
23+
model:
24+
azureLogAnalytics:
25+
dashboardTime: true
26+
query: |-
27+
requests
28+
| where $__timeFilter(timestamp)
29+
| where success == false
30+
| where toint(resultCode) >= 500
31+
| where operation_Name == 'PUT Process/NextElement [app/instanceGuid/instanceOwnerPartyId/org]'
32+
or operation_Name == 'PUT {org}/{app}/instances/{instanceOwnerPartyId:int}/{instanceGuid:guid}/process/next'
33+
| summarize occurred = iff(count() > 0, 1, 0) by cloud_RoleName
34+
resources:
35+
- /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/monitor-${SERVICEOWNER_ID}-${ENVIRONMENT}-rg/providers/Microsoft.Insights/components/${SERVICEOWNER_ID}-${ENVIRONMENT}-ai
36+
resultFormat: time_series
37+
timeColumn: timestamp
38+
workspace: ""
39+
datasource:
40+
type: grafana-azure-monitor-datasource
41+
uid: azure-monitor-oob
42+
instant: false
43+
intervalMs: 1000
44+
maxDataPoints: 43200
45+
queryType: Azure Log Analytics
46+
range: true
47+
refId: A
48+
- refId: B
49+
datasourceUid: __expr__
50+
model:
51+
conditions:
52+
- evaluator:
53+
params: []
54+
type: gt
55+
operator:
56+
type: and
57+
query:
58+
params:
59+
- B
60+
reducer:
61+
params: []
62+
type: count
63+
type: query
64+
datasource:
65+
type: __expr__
66+
uid: __expr__
67+
expression: A
68+
intervalMs: 1000
69+
maxDataPoints: 43200
70+
reducer: count
71+
refId: B
72+
type: reduce
73+
- refId: C
74+
datasourceUid: __expr__
75+
model:
76+
conditions:
77+
- evaluator:
78+
params:
79+
- 0
80+
type: gt
81+
operator:
82+
type: and
83+
query:
84+
params:
85+
- C
86+
reducer:
87+
params: []
88+
type: last
89+
type: query
90+
datasource:
91+
type: __expr__
92+
uid: __expr__
93+
expression: B
94+
intervalMs: 1000
95+
maxDataPoints: 43200
96+
refId: C
97+
type: threshold
98+
noDataState: OK
99+
execErrState: Error
100+
annotations:
101+
__dashboardUid__: AltinnApps
102+
__panelId__: "14"
103+
summary: '`{{ index $labels "cloud_RoleName" }}` har hatt feilende process/next siste 5 minutter'
104+
labels:
105+
RuleId: failed-process-next-requests
106+
Type: Altinn
107+
isPaused: false
108+
- uid: failed-instances-post-requests
109+
title: Feilende instansieringer
110+
condition: C
111+
data:
112+
- refId: A
113+
queryType: Azure Log Analytics
114+
relativeTimeRange:
115+
from: 300
116+
to: 0
117+
datasourceUid: azure-monitor-oob
118+
model:
119+
azureLogAnalytics:
120+
dashboardTime: true
121+
query: |-
122+
requests
123+
| where $__timeFilter(timestamp)
124+
| where success == false
125+
| where toint(resultCode) >= 500
126+
| where operation_Name == 'POST Instances/Post [app/org]'
127+
or operation_Name == 'POST Instances/PostSimplified [app/org]'
128+
or operation_Name == 'POST {org}/{app}/instances'
129+
or operation_Name == 'POST {org}/{app}/instances/create'
130+
| summarize occurred = iff(count() > 0, 1, 0) by cloud_RoleName
131+
resources:
132+
- /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/monitor-${SERVICEOWNER_ID}-${ENVIRONMENT}-rg/providers/Microsoft.Insights/components/${SERVICEOWNER_ID}-${ENVIRONMENT}-ai
133+
resultFormat: time_series
134+
timeColumn: timestamp
135+
workspace: ""
136+
datasource:
137+
type: grafana-azure-monitor-datasource
138+
uid: azure-monitor-oob
139+
instant: false
140+
intervalMs: 1000
141+
maxDataPoints: 43200
142+
queryType: Azure Log Analytics
143+
range: true
144+
refId: A
145+
- refId: B
146+
datasourceUid: __expr__
147+
model:
148+
conditions:
149+
- evaluator:
150+
params: []
151+
type: gt
152+
operator:
153+
type: and
154+
query:
155+
params:
156+
- B
157+
reducer:
158+
params: []
159+
type: count
160+
type: query
161+
datasource:
162+
type: __expr__
163+
uid: __expr__
164+
expression: A
165+
intervalMs: 1000
166+
maxDataPoints: 43200
167+
reducer: count
168+
refId: B
169+
type: reduce
170+
- refId: C
171+
datasourceUid: __expr__
172+
model:
173+
conditions:
174+
- evaluator:
175+
params:
176+
- 0
177+
type: gt
178+
operator:
179+
type: and
180+
query:
181+
params:
182+
- C
183+
reducer:
184+
params: []
185+
type: last
186+
type: query
187+
datasource:
188+
type: __expr__
189+
uid: __expr__
190+
expression: B
191+
intervalMs: 1000
192+
maxDataPoints: 43200
193+
refId: C
194+
type: threshold
195+
noDataState: OK
196+
execErrState: Error
197+
annotations:
198+
__dashboardUid__: AltinnApps
199+
__panelId__: "14"
200+
summary: '`{{ index $labels "cloud_RoleName" }}` har hatt feilende instansieringer siste 5 minutter'
201+
labels:
202+
RuleId: failed-instances-post-requests
203+
Type: Altinn
204+
isPaused: false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- altinn-apps.yaml
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: grafana.integreatly.org/v1beta1
2+
kind: GrafanaContactPoint
3+
metadata:
4+
name: external-grafana-altinn-studio-gateway
5+
spec:
6+
name: altinn-studio-gateway
7+
type: webhook
8+
instanceSelector:
9+
matchLabels:
10+
dashboards: external-grafana
11+
settings:
12+
httpMethod: POST
13+
url: "${GATEWAY_URL}/alerts"
14+
valuesFrom:
15+
- targetPath: token
16+
valueFrom:
17+
secretKeyRef:
18+
name: external-grafana-altinn-studio-gateway-token
19+
key: token
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- altinn-studio-gateway.yaml

0 commit comments

Comments
 (0)