Skip to content

Commit

Permalink
Add support for pushover devices (#3318)
Browse files Browse the repository at this point in the history
* Add support for pushover devices

Signed-off-by: Alec Pinson <30310787+alec-pinson@users.noreply.github.com>

* update docs

Signed-off-by: Alec Pinson <30310787+alec-pinson@users.noreply.github.com>

---------

Signed-off-by: Alec Pinson <30310787+alec-pinson@users.noreply.github.com>
  • Loading branch information
alec-pinson committed May 5, 2023
1 parent 0f3ab92 commit 3b9cd04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ type PushoverConfig struct {
Message string `yaml:"message,omitempty" json:"message,omitempty"`
URL string `yaml:"url,omitempty" json:"url,omitempty"`
URLTitle string `yaml:"url_title,omitempty" json:"url_title,omitempty"`
Device string `yaml:"device,omitempty" json:"device,omitempty"`
Sound string `yaml:"sound,omitempty" json:"sound,omitempty"`
Priority string `yaml:"priority,omitempty" json:"priority,omitempty"`
Retry duration `yaml:"retry,omitempty" json:"retry,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,12 @@ token_file: <filepath>
# A supplementary URL shown alongside the message.
[ url: <tmpl_string> | default = '{{ template "pushover.default.url" . }}' ]

# Optional device to send notification to, see https://pushover.net/api#device
[ device: <string> ]

# Optional sound to use for notification, see https://pushover.net/api#sound
[ sound: <string> ]

# Priority, see https://pushover.net/api#priority
[ priority: <tmpl_string> | default = '{{ if eq .Status "firing" }}2{{ else }}0{{ end }}' ]

Expand Down
1 change: 1 addition & 0 deletions notify/pushover/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
parameters.Add("priority", tmpl(n.conf.Priority))
parameters.Add("retry", fmt.Sprintf("%d", int64(time.Duration(n.conf.Retry).Seconds())))
parameters.Add("expire", fmt.Sprintf("%d", int64(time.Duration(n.conf.Expire).Seconds())))
parameters.Add("device", tmpl(n.conf.Device))
parameters.Add("sound", tmpl(n.conf.Sound))
if err != nil {
return false, err
Expand Down

0 comments on commit 3b9cd04

Please sign in to comment.