-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #487 from vshn/alerting_rework
Sane Opsgenie alerting
- Loading branch information
Showing
30 changed files
with
387 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
|
||
local inv = kap.inventory(); | ||
local params = inv.parameters.appcat; | ||
|
||
|
||
local genGenericAlertingRule(serviceName) = { | ||
apiVersion: 'monitoring.coreos.com/v1', | ||
kind: 'PrometheusRule', | ||
metadata: { | ||
name: 'vshn-' + std.asciiLower(serviceName) + '-sla', | ||
namespace: params.slos.namespace, | ||
labels: { | ||
syn_team: 'schedar', | ||
syn_component: 'appcat', | ||
syn: 'true', | ||
}, | ||
}, | ||
spec: { | ||
groups: [ | ||
{ | ||
name: 'appcat-' + std.asciiLower(serviceName) + '-sla-target', | ||
rules: [ | ||
{ | ||
alert: 'vshn-' + std.asciiLower(serviceName) + '-sla', | ||
// this query can be read as: if the rate of probes that are not successful is higher than 0.2 in the last 5 minutes and in the last minute, then alert | ||
// rate works on per second basis, so 0.2 means 20% of the probes are failing, which for 5 minutes is 1 minute and for 1 minute is 45 seconds | ||
expr: 'rate(appcat_probes_seconds_count{reason!="success", service="' + serviceName + '", ha="false", maintenance="false"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", service="' + serviceName + '", ha="false", maintenance="false"}[1m]) > 0.75', | ||
labels: { | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end }}', | ||
runbook: 'https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html', | ||
service: serviceName, | ||
severity: 'critical', | ||
syn: 'true', | ||
syn_team: 'schedar', | ||
syn_component: 'appcat', | ||
}, | ||
}, | ||
{ | ||
alert: 'vshn-' + std.asciiLower(serviceName) + '-sla-ha', | ||
// this query can be read as: if the rate of probes that are not successful is higher than 0.2 in the last 5 minutes and in the last minute, then alert | ||
// rate works on per second basis, so 0.2 means 20% of the probes are failing, which for 5 minutes is 1 minute and for 1 minute is 45 seconds | ||
expr: 'rate(appcat_probes_seconds_count{reason!="success", service="' + serviceName + '", ha="true"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", service="' + serviceName + '", ha="true"}[1m]) > 0.75', | ||
labels: { | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end }}', | ||
runbook: 'https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html', | ||
service: serviceName, | ||
severity: 'critical', | ||
syn: 'true', | ||
syn_team: 'schedar', | ||
syn_component: 'appcat', | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
|
||
{ | ||
GenGenericAlertingRule: genGenericAlertingRule, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/golden/minio/appcat/appcat/sli_exporter/90_minio_Opsgenie.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
labels: | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar | ||
name: vshn-minio-sla | ||
namespace: appcat-slos | ||
spec: | ||
groups: | ||
- name: appcat-minio-sla-target | ||
rules: | ||
- alert: vshn-minio-sla | ||
expr: rate(appcat_probes_seconds_count{reason!="success", service="minio", | ||
ha="false", maintenance="false"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", | ||
service="minio", ha="false", maintenance="false"}[1m]) > 0.75 | ||
labels: | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end | ||
}}' | ||
runbook: https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html | ||
service: minio | ||
severity: critical | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar | ||
- alert: vshn-minio-sla-ha | ||
expr: rate(appcat_probes_seconds_count{reason!="success", service="minio", | ||
ha="true"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", | ||
service="minio", ha="true"}[1m]) > 0.75 | ||
labels: | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end | ||
}}' | ||
runbook: https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html | ||
service: minio | ||
severity: critical | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/golden/openshift/appcat/appcat/sli_exporter/90_VSHNPostgreSQL_Opsgenie.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
labels: | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar | ||
name: vshn-vshnpostgresql-sla | ||
namespace: appcat-slos | ||
spec: | ||
groups: | ||
- name: appcat-vshnpostgresql-sla-target | ||
rules: | ||
- alert: vshn-vshnpostgresql-sla | ||
expr: rate(appcat_probes_seconds_count{reason!="success", service="VSHNPostgreSQL", | ||
ha="false", maintenance="false"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", | ||
service="VSHNPostgreSQL", ha="false", maintenance="false"}[1m]) > 0.75 | ||
labels: | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end | ||
}}' | ||
runbook: https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html | ||
service: VSHNPostgreSQL | ||
severity: critical | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar | ||
- alert: vshn-vshnpostgresql-sla-ha | ||
expr: rate(appcat_probes_seconds_count{reason!="success", service="VSHNPostgreSQL", | ||
ha="true"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", | ||
service="VSHNPostgreSQL", ha="true"}[1m]) > 0.75 | ||
labels: | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end | ||
}}' | ||
runbook: https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html | ||
service: VSHNPostgreSQL | ||
severity: critical | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar |
39 changes: 39 additions & 0 deletions
39
tests/golden/openshift/appcat/appcat/sli_exporter/90_VSHNRedis_Opsgenie.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
labels: | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar | ||
name: vshn-vshnredis-sla | ||
namespace: appcat-slos | ||
spec: | ||
groups: | ||
- name: appcat-vshnredis-sla-target | ||
rules: | ||
- alert: vshn-vshnredis-sla | ||
expr: rate(appcat_probes_seconds_count{reason!="success", service="VSHNRedis", | ||
ha="false", maintenance="false"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", | ||
service="VSHNRedis", ha="false", maintenance="false"}[1m]) > 0.75 | ||
labels: | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end | ||
}}' | ||
runbook: https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html | ||
service: VSHNRedis | ||
severity: critical | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar | ||
- alert: vshn-vshnredis-sla-ha | ||
expr: rate(appcat_probes_seconds_count{reason!="success", service="VSHNRedis", | ||
ha="true"}[5m]) > 0.2 and rate(appcat_probes_seconds_count{reason!="success", | ||
service="VSHNRedis", ha="true"}[1m]) > 0.75 | ||
labels: | ||
OnCall: '{{ if eq $labels.sla "guaranteed" }}true{{ else }}false{{ end | ||
}}' | ||
runbook: https://kb.vshn.ch/app-catalog/how-tos/appcat/GuaranteedUptimeTarget.html | ||
service: VSHNRedis | ||
severity: critical | ||
syn: 'true' | ||
syn_component: appcat | ||
syn_team: schedar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.