Skip to content

Commit 66c7d46

Browse files
authored
Merge pull request #819 from mpeterson/add_pushover_alerting
Add Pushover notification support to alerting configuration
2 parents 1e6655b + d85add8 commit 66c7d46

3 files changed

Lines changed: 49 additions & 1 deletion

File tree

rocketpool-cli/service/config/settings-alerting.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var alertingParametersNativeMode map[string]interface{} = map[string]interface{}
1212
"nativeModeHost": nil,
1313
"nativeModePort": nil,
1414
"discordWebhookURL": nil,
15+
"pushoverToken": nil,
16+
"pushoverUserKey": nil,
1517
"alertEnabled_FeeRecipientChanged": nil,
1618
"alertEnabled_MinipoolBondReduced": nil,
1719
"alertEnabled_MinipoolBalanceDistributed": nil,
@@ -27,6 +29,8 @@ var alertingParametersDockerMode map[string]interface{} = map[string]interface{}
2729
"openPort": nil,
2830
"containerTag": nil,
2931
"discordWebhookURL": nil,
32+
"pushoverToken": nil,
33+
"pushoverUserKey": nil,
3034
"alertEnabled_ClientSyncStatusBeacon": nil,
3135
"alertEnabled_UpcomingSyncCommittee": nil,
3236
"alertEnabled_ActiveSyncCommittee": nil,

shared/services/config/alertmanager-config.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ type AlertmanagerConfig struct {
5353
// The Discord webhook URL for alert notifications
5454
DiscordWebhookURL config.Parameter `yaml:"discordWebhookURL,omitempty"`
5555

56+
// The Pushover Token for alert notifications
57+
PushoverToken config.Parameter `yaml:"pushoverToken,omitempty"`
58+
// The Pushover User Key for alert notifications
59+
PushoverUserKey config.Parameter `yaml:"pushoverUserKey,omitempty"`
60+
5661
// Alerts configured in prometheus rule configuration file:
5762
AlertEnabled_ClientSyncStatusBeacon config.Parameter `yaml:"alertEnabled_ClientSyncStatusBeacon,omitempty"`
5863
AlertEnabled_ClientSyncStatusExecution config.Parameter `yaml:"alertEnabled_ClientSyncStatusBeacon,omitempty"`
@@ -159,6 +164,28 @@ func NewAlertmanagerConfig(cfg *RocketPoolConfig) *AlertmanagerConfig {
159164
OverwriteOnUpgrade: false,
160165
},
161166

167+
PushoverToken: config.Parameter{
168+
ID: "pushoverToken",
169+
Name: "Alertmanager Pushover Token",
170+
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",
171+
Type: config.ParameterType_String,
172+
Default: map[config.Network]interface{}{config.Network_All: ""},
173+
AffectsContainers: []config.ContainerID{config.ContainerID_Alertmanager},
174+
CanBeBlank: true,
175+
OverwriteOnUpgrade: false,
176+
},
177+
178+
PushoverUserKey: config.Parameter{
179+
ID: "pushoverUserKey",
180+
Name: "Alertmanager Pushover User Key",
181+
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",
182+
Type: config.ParameterType_String,
183+
Default: map[config.Network]interface{}{config.Network_All: ""},
184+
AffectsContainers: []config.ContainerID{config.ContainerID_Alertmanager},
185+
CanBeBlank: true,
186+
OverwriteOnUpgrade: false,
187+
},
188+
162189
AlertEnabled_ClientSyncStatusBeacon: createParameterForAlertEnablement(
163190
"ClientSyncStatusBeacon",
164191
"beacon client is not synced"),
@@ -251,6 +278,8 @@ func (cfg *AlertmanagerConfig) GetParameters() []*config.Parameter {
251278
&cfg.NativeModeHost,
252279
&cfg.NativeModePort,
253280
&cfg.DiscordWebhookURL,
281+
&cfg.PushoverToken,
282+
&cfg.PushoverUserKey,
254283
&cfg.ContainerTag,
255284
&cfg.AlertEnabled_ClientSyncStatusBeacon,
256285
&cfg.AlertEnabled_ClientSyncStatusExecution,

shared/services/rocketpool/assets/install/alerting/alertmanager.tmpl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,28 @@ receivers:
4040
discord_configs:
4141
- webhook_url: "{{ .DiscordWebhookURL.Value }}"
4242
{{- end }}
43-
43+
44+
{{- if and .PushoverToken.Value .PushoverUserKey.Value }}
45+
pushover_configs:
46+
- token: "{{ .PushoverToken.Value }}"
47+
user_key: "{{ .PushoverUserKey.Value }}"
48+
priority: {{ `'{{ if eq .CommonLabels.severity "critical" }}2{{ else if eq .CommonLabels.severity "warning" }}1{{ else }}0{{ end }}'` }}
49+
{{- end }}
50+
4451
- name: "node_operator_no_resolved"
4552
{{- if .DiscordWebhookURL.Value }}
4653
discord_configs:
4754
- webhook_url: "{{ .DiscordWebhookURL.Value }}"
4855
send_resolved: false
4956
{{- end }}
57+
58+
{{- if and .PushoverToken.Value .PushoverUserKey.Value }}
59+
pushover_configs:
60+
- token: "{{ .PushoverToken.Value }}"
61+
user_key: "{{ .PushoverUserKey.Value }}"
62+
priority: {{ `'{{ if eq .CommonLabels.severity "critical" }}2{{ else if eq .CommonLabels.severity "warning" }}1{{ else }}0{{ end }}'` }}
63+
send_resolved: false
64+
{{- end }}
5065

5166
inhibit_rules:
5267
# Inhibit rules mute a new alert (target) that matches an existing alert (source).

0 commit comments

Comments
 (0)