Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add variable for additional alerts labels #20

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,14 @@ Type: `bool`

Default: `false`

==== [[input_additional_alert_labels]] <<input_additional_alert_labels,additional_alert_labels>>

Description: Additional labels to add to Longhorn alerts.

Type: `map(string)`

Default: `{}`

==== [[input_enable_dashboard_ingress]] <<input_enable_dashboard_ingress,enable_dashboard_ingress>>

Description: Boolean to enable the creation of an ingress for the Longhorn's dashboard. **If enabled, you must provide a value for `base_domain`.**
Expand Down Expand Up @@ -770,6 +778,12 @@ object({
|`false`
|no

|[[input_additional_alert_labels]] <<input_additional_alert_labels,additional_alert_labels>>
|Additional labels to add to Longhorn alerts.
|`map(string)`
|`{}`
|no

|[[input_enable_dashboard_ingress]] <<input_enable_dashboard_ingress,enable_dashboard_ingress>>
|Boolean to enable the creation of an ingress for the Longhorn's dashboard. **If enabled, you must provide a value for `base_domain`.**
|`bool`
Expand Down
24 changes: 24 additions & 0 deletions charts/longhorn/templates/prometheus-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ spec:
for: 5m
labels:
severity: warning
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornVolumeStatusCritical
annotations:
description: {{"Longhorn volume {{$labels.volume}} on {{$labels.node}} is Fault for more than 2 minutes."}}
Expand All @@ -27,6 +30,9 @@ spec:
for: 5m
labels:
severity: critical
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornVolumeStatusWarning
annotations:
description: {{"Longhorn volume {{$labels.volume}} on {{$labels.node}} is Degraded for more than 5 minutes."}}
Expand All @@ -35,6 +41,9 @@ spec:
for: 5m
labels:
severity: warning
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornNodeStorageWarning
annotations:
description: {{"The used storage of node {{$labels.node}} is at {{$value}}% capacity for more than 5 minutes."}}
Expand All @@ -43,6 +52,9 @@ spec:
for: 5m
labels:
severity: warning
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornDiskStorageWarning
annotations:
description: {{"The used storage of disk {{$labels.disk}} on node {{$labels.node}} is at {{$value}}% capacity for more than 5 minutes."}}
Expand All @@ -51,6 +63,9 @@ spec:
for: 5m
labels:
severity: warning
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornNodeDown
annotations:
description: {{"There are {{$value}} Longhorn nodes which have been offline for more than 5 minutes."}}
Expand All @@ -59,6 +74,9 @@ spec:
for: 5m
labels:
severity: critical
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornIntanceManagerCPUUsageWarning
annotations:
description: {{"Longhorn instance manager {{$labels.instance_manager}} on {{$labels.node}} has CPU Usage / CPU request is {{$value}}% for more than 5 minutes."}}
Expand All @@ -67,6 +85,9 @@ spec:
for: 5m
labels:
severity: warning
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
- alert: LonghornNodeCPUUsageWarning
annotations:
description: {{"Longhorn node {{$labels.node}} has CPU Usage / CPU capacity is {{$value}}% for more than 5 minutes."}}
Expand All @@ -75,5 +96,8 @@ spec:
for: 5m
labels:
severity: warning
{{- with $.Values.servicemonitor.additionalAlertLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}

{{- end -}}
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ locals {
}
servicemonitor = {
enabled = var.enable_service_monitor
additionalAlertLabels = var.additional_alert_labels
}
automaticFilesystemTrim = {
enabled = var.automatic_filesystem_trim.enabled
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ variable "enable_service_monitor" {
default = false
}

variable "additional_alert_labels" {
description = "Additional labels to add to Longhorn alerts."
type = map(string)
default = {}
}

variable "enable_dashboard_ingress" {
description = "Boolean to enable the creation of an ingress for the Longhorn's dashboard. **If enabled, you must provide a value for `base_domain`.**"
type = bool
Expand Down