diff --git a/rocketpool-cli/service/config/settings-alerting.go b/rocketpool-cli/service/config/settings-alerting.go index d7683a5b8..d60ffbbf2 100644 --- a/rocketpool-cli/service/config/settings-alerting.go +++ b/rocketpool-cli/service/config/settings-alerting.go @@ -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, @@ -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, diff --git a/shared/services/config/alertmanager-config.go b/shared/services/config/alertmanager-config.go index e8c620eb2..9f77ec315 100644 --- a/shared/services/config/alertmanager-config.go +++ b/shared/services/config/alertmanager-config.go @@ -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"` @@ -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"), @@ -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, diff --git a/shared/services/rocketpool/assets/install/alerting/alertmanager.tmpl b/shared/services/rocketpool/assets/install/alerting/alertmanager.tmpl index dff7d382d..9ea4aff18 100644 --- a/shared/services/rocketpool/assets/install/alerting/alertmanager.tmpl +++ b/shared/services/rocketpool/assets/install/alerting/alertmanager.tmpl @@ -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 }}'` }} + {{- 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).