Skip to content
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
4 changes: 4 additions & 0 deletions rocketpool-cli/service/config/settings-alerting.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var alertingParametersNativeMode map[string]interface{} = map[string]interface{}
"nativeModeHost": nil,
"nativeModePort": nil,
"discordWebhookURL": nil,
"pushoverToken": nil,
"pushoverUserKey": nil,
"alertEnabled_FeeRecipientChanged": nil,
"alertEnabled_MinipoolBondReduced": nil,
"alertEnabled_MinipoolBalanceDistributed": nil,
Expand All @@ -27,6 +29,8 @@ var alertingParametersDockerMode map[string]interface{} = map[string]interface{}
"openPort": nil,
"containerTag": nil,
"discordWebhookURL": nil,
"pushoverToken": nil,
"pushoverUserKey": nil,
"alertEnabled_ClientSyncStatusBeacon": nil,
"alertEnabled_UpcomingSyncCommittee": nil,
"alertEnabled_ActiveSyncCommittee": nil,
Expand Down
29 changes: 29 additions & 0 deletions shared/services/config/alertmanager-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ type AlertmanagerConfig struct {
// The Discord webhook URL for alert notifications
DiscordWebhookURL config.Parameter `yaml:"discordWebhookURL,omitempty"`

// The Pushover Token for alert notifications
PushoverToken config.Parameter `yaml:"pushoverToken,omitempty"`
// The Pushover User Key for alert notifications
PushoverUserKey config.Parameter `yaml:"pushoverUserKey,omitempty"`

// Alerts configured in prometheus rule configuration file:
AlertEnabled_ClientSyncStatusBeacon config.Parameter `yaml:"alertEnabled_ClientSyncStatusBeacon,omitempty"`
AlertEnabled_ClientSyncStatusExecution config.Parameter `yaml:"alertEnabled_ClientSyncStatusBeacon,omitempty"`
Expand Down Expand Up @@ -159,6 +164,28 @@ func NewAlertmanagerConfig(cfg *RocketPoolConfig) *AlertmanagerConfig {
OverwriteOnUpgrade: false,
},

PushoverToken: config.Parameter{
ID: "pushoverToken",
Name: "Alertmanager Pushover Token",
Description: "Pushover notifications are sent via the Pushover API. See docs for detailed technical explanation or a tl;dr on how to configure at https://pushover.net/api",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: ""},
AffectsContainers: []config.ContainerID{config.ContainerID_Alertmanager},
CanBeBlank: true,
OverwriteOnUpgrade: false,
},

PushoverUserKey: config.Parameter{
ID: "pushoverUserKey",
Name: "Alertmanager Pushover User Key",
Description: "Pushover notifications are sent via the Pushover API. See docs for detailed technical explanation or a tl;dr on how to configure at https://pushover.net/api",
Type: config.ParameterType_String,
Default: map[config.Network]interface{}{config.Network_All: ""},
AffectsContainers: []config.ContainerID{config.ContainerID_Alertmanager},
CanBeBlank: true,
OverwriteOnUpgrade: false,
},

AlertEnabled_ClientSyncStatusBeacon: createParameterForAlertEnablement(
"ClientSyncStatusBeacon",
"beacon client is not synced"),
Expand Down Expand Up @@ -251,6 +278,8 @@ func (cfg *AlertmanagerConfig) GetParameters() []*config.Parameter {
&cfg.NativeModeHost,
&cfg.NativeModePort,
&cfg.DiscordWebhookURL,
&cfg.PushoverToken,
&cfg.PushoverUserKey,
&cfg.ContainerTag,
&cfg.AlertEnabled_ClientSyncStatusBeacon,
&cfg.AlertEnabled_ClientSyncStatusExecution,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,28 @@ receivers:
discord_configs:
- webhook_url: "{{ .DiscordWebhookURL.Value }}"
{{- end }}


{{- if and .PushoverToken.Value .PushoverUserKey.Value }}
pushover_configs:
- token: "{{ .PushoverToken.Value }}"
user_key: "{{ .PushoverUserKey.Value }}"
priority: {{ `'{{ if eq .CommonLabels.severity "critical" }}2{{ else if eq .CommonLabels.severity "warning" }}1{{ else }}0{{ end }}'` }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to open a discussion about the values vis-a-vis alerts..

a priority of 1 for warning messages means that the user will get an override of quiet hours and get a notification for warning messages. Now, most alerts (e.g. OSUpdates or RPUpdates) are sending warning, with little sending info. Perhaps we should review the severities of the rules too in a different PR?

{{- end }}

- name: "node_operator_no_resolved"
{{- if .DiscordWebhookURL.Value }}
discord_configs:
- webhook_url: "{{ .DiscordWebhookURL.Value }}"
send_resolved: false
{{- end }}

{{- if and .PushoverToken.Value .PushoverUserKey.Value }}
pushover_configs:
- token: "{{ .PushoverToken.Value }}"
user_key: "{{ .PushoverUserKey.Value }}"
priority: {{ `'{{ if eq .CommonLabels.severity "critical" }}2{{ else if eq .CommonLabels.severity "warning" }}1{{ else }}0{{ end }}'` }}
send_resolved: false
{{- end }}

inhibit_rules:
# Inhibit rules mute a new alert (target) that matches an existing alert (source).
Expand Down
Loading