From 27240a9e4cab925256a31778c5f3c25d7af67e89 Mon Sep 17 00:00:00 2001 From: Patrick Mischler Date: Wed, 14 Apr 2021 15:46:40 +0200 Subject: [PATCH] Change project to be alligned with Go programming best practices --- go.mod | 3 +++ promalert2bmctsom.go => main.go | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 go.mod rename promalert2bmctsom.go => main.go (98%) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..545b039 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/PatMis16/promalert2bmctsom + +go 1.15 diff --git a/promalert2bmctsom.go b/main.go similarity index 98% rename from promalert2bmctsom.go rename to main.go index 928c91b..aaf70ab 100644 --- a/promalert2bmctsom.go +++ b/main.go @@ -225,9 +225,11 @@ func (config Config) Run() { if events != nil { if SendEventToTS(tsToken.getToken(), config.Server.TrueSight.TSIMServer, config.Server.TrueSight.TSIMPort, config.Server.TrueSight.TSCell, events) { InfoLogger.Println("Event sent to TrueSight.") + fmt.Fprintf(w, "Event(s) created") } else { WarningLogger.Println("Failed to send event(s) to TrueSight.") promAlertsCache.Add(RandomString(10), events, cache.DefaultExpiration) + http.Error(w, "Something went wrong on the server!", http.StatusInternalServerError) } } }