Skip to content

Commit

Permalink
Fix output
Browse files Browse the repository at this point in the history
  • Loading branch information
Herbert Fischer committed Nov 13, 2017
1 parent 4e32285 commit 0ebebf6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ func newIPMIEvent(stdOutLine string) (*ipmiEvent, error) {
return event, nil
}

func spacesToUnderscore(str string) string {
return strings.Replace(str, " ", "_", -1)
}

func (ev ipmiEvent) InfluxDB(checkName, hostname string) string {
return fmt.Sprintf(
`%s,host="%s",event_id=%s,error_level="%s",event_type="%s",sensor_name="%s" error_message="%s",state=%d %d`,
checkName, hostname, ev.ID, ev.Level, ev.Type, ev.Sensor, ev.Message, ev.State, ev.Time.UnixNano())
`%s,host=%s,event_type=%s,error_level=%s,sensor_name=%s event_id=%s,error_message="%s",state=%d %d`,
checkName, hostname, spacesToUnderscore(ev.Type), spacesToUnderscore(ev.Level), spacesToUnderscore(ev.Sensor),
ev.ID, ev.Message, ev.State, ev.Time.UnixNano())
}

func newEmptyIPMIEvent() *ipmiEvent {
Expand Down

0 comments on commit 0ebebf6

Please sign in to comment.