Skip to content

Commit

Permalink
Update logs
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Mar 7, 2023
1 parent 4822d44 commit fcda769
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions webhook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func Webhook(w http.ResponseWriter, r *http.Request, c config.Configuration) {
}

if name, ok := data.CommonLabels["instance"]; ok {
l.V(2).Infof("Creating host %v", name)
host, err = icinga.GetHost(serviceHost)
if err != nil {
err := icinga.CreateHost(icinga2.Host{
Expand All @@ -112,13 +113,15 @@ func Webhook(w http.ResponseWriter, r *http.Request, c config.Configuration) {
asJSON(w, http.StatusInternalServerError, err.Error())
return
}
host, err = icinga.GetHost(serviceHost)
if err != nil {
l.Errorf("Did not find service host %v: %v\n", host, err)
asJSON(w, http.StatusInternalServerError, err.Error())
return
}
}
host, err = icinga.GetHost(serviceHost)
if err != nil {
l.Errorf("Did not find service host %v: %v\n", host, err)
asJSON(w, http.StatusInternalServerError, err.Error())
return
}
} else {
l.V(2).Infof("No instance label")
}

sameAlertName := false
Expand Down

0 comments on commit fcda769

Please sign in to comment.