From 9f856fc7653a2608696f2597b97e683092e0a9f2 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Thu, 20 Dec 2018 16:49:15 +0100 Subject: [PATCH] Cleanup styles according to goimports' style --- beater/eventstream.go | 26 +++++++++++++------------- beater/statuspoller.go | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/beater/eventstream.go b/beater/eventstream.go index 3087f31e..77d756ad 100644 --- a/beater/eventstream.go +++ b/beater/eventstream.go @@ -51,35 +51,35 @@ func BuildEventstreamEvent(e []byte) beat.Event { event.Fields = common.MapStr{} for key, value := range icingaEvent { - event.Fields.Put(target_key + key, value) + event.Fields.Put(target_key+key, value) } logp.Debug("icingabeat", "Type: %v", icingaEvent["type"]) switch icingaEvent["type"] { case "CheckResult", "StateChange", "Notification": checkResult := icingaEvent["check_result"].(map[string]interface{}) - event.Fields.Put(target_key + "check_result.execution_start", FloatToTimestamp(checkResult["execution_start"].(float64))) - event.Fields.Put(target_key + "check_result.execution_end", FloatToTimestamp(checkResult["execution_end"].(float64))) - event.Fields.Put(target_key + "check_result.schedule_start", FloatToTimestamp(checkResult["schedule_start"].(float64))) - event.Fields.Put(target_key + "check_result.schedule_end", FloatToTimestamp(checkResult["schedule_end"].(float64))) + event.Fields.Put(target_key+"check_result.execution_start", FloatToTimestamp(checkResult["execution_start"].(float64))) + event.Fields.Put(target_key+"check_result.execution_end", FloatToTimestamp(checkResult["execution_end"].(float64))) + event.Fields.Put(target_key+"check_result.schedule_start", FloatToTimestamp(checkResult["schedule_start"].(float64))) + event.Fields.Put(target_key+"check_result.schedule_end", FloatToTimestamp(checkResult["schedule_end"].(float64))) event.Fields.Delete("check_result.performance_data") case "AcknowledgementSet": event.Delete("comment") - event.Fields.Put(target_key + "comment.text", icingaEvent["comment"]) - event.Fields.Put(target_key + "expiry", FloatToTimestamp(icingaEvent["expiry"].(float64))) + event.Fields.Put(target_key+"comment.text", icingaEvent["comment"]) + event.Fields.Put(target_key+"expiry", FloatToTimestamp(icingaEvent["expiry"].(float64))) case "CommentAdded", "CommentRemoved": comment := icingaEvent["comment"].(map[string]interface{}) - event.Fields.Put(target_key + "comment.entry_time", FloatToTimestamp(comment["entry_time"].(float64))) - event.Fields.Put(target_key + "comment.expire_time", FloatToTimestamp(comment["expire_time"].(float64))) + event.Fields.Put(target_key+"comment.entry_time", FloatToTimestamp(comment["entry_time"].(float64))) + event.Fields.Put(target_key+"comment.expire_time", FloatToTimestamp(comment["expire_time"].(float64))) case "DowntimeAdded", "DowntimeRemoved", "DowntimeStarted", "DowntimeTriggered": downtime := icingaEvent["downtime"].(map[string]interface{}) - event.Fields.Put(target_key + "downtime.end_time", FloatToTimestamp(downtime["end_time"].(float64))) - event.Fields.Put(target_key + "downtime.entry_time", FloatToTimestamp(downtime["entry_time"].(float64))) - event.Fields.Put(target_key + "downtime.start_time", FloatToTimestamp(downtime["start_time"].(float64))) - event.Fields.Put(target_key + "downtime.trigger_time", FloatToTimestamp(downtime["trigger_time"].(float64))) + event.Fields.Put(target_key+"downtime.end_time", FloatToTimestamp(downtime["end_time"].(float64))) + event.Fields.Put(target_key+"downtime.entry_time", FloatToTimestamp(downtime["entry_time"].(float64))) + event.Fields.Put(target_key+"downtime.start_time", FloatToTimestamp(downtime["start_time"].(float64))) + event.Fields.Put(target_key+"downtime.trigger_time", FloatToTimestamp(downtime["trigger_time"].(float64))) } event.Fields.Put("type", "icingabeat.event."+strings.ToLower(icingaEvent["type"].(string))) diff --git a/beater/statuspoller.go b/beater/statuspoller.go index 9e13b209..bfc13af4 100644 --- a/beater/statuspoller.go +++ b/beater/statuspoller.go @@ -65,11 +65,11 @@ func BuildStatusEvents(body []byte) []beat.Event { delete(value.(map[string]interface{}), "zones") } } - event.Fields.Put(target_key + key, value) + event.Fields.Put(target_key+key, value) } default: - event.Fields.Put(target_key + key, value) + event.Fields.Put(target_key+key, value) } } @@ -83,7 +83,7 @@ func BuildStatusEvents(body []byte) []beat.Event { case interface{}: key = "perfdata." + perfdata.(map[string]interface{})["label"].(string) value = perfdata - event.Fields.Put(target_key + key, value) + event.Fields.Put(target_key+key, value) } } @@ -93,7 +93,7 @@ func BuildStatusEvents(body []byte) []beat.Event { event.Fields.Put("type", value) default: - event.Fields.Put(target_key + key, value) + event.Fields.Put(target_key+key, value) } }