Skip resolved messsages
This commit is contained in:
parent
911bf2fa92
commit
acd656c6ea
1 changed files with 6 additions and 0 deletions
6
main.go
6
main.go
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/prometheus/alertmanager/template"
|
||||
"github.com/prometheus/common/model"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -30,6 +31,11 @@ func WebhookHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
for _, alert := range payload.Alerts {
|
||||
|
||||
// Skip resolved messages
|
||||
if alert.Status == string(model.AlertResolved) {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Println(alert)
|
||||
|
||||
req, err := http.NewRequest("POST", os.Getenv("NTFY_TOPIC"), strings.NewReader(alert.Annotations["description"]))
|
||||
|
|
Loading…
Reference in a new issue