-
Notifications
You must be signed in to change notification settings - Fork 30
/
CommentData.go
39 lines (35 loc) · 1.04 KB
/
CommentData.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package livestatus
import (
"github.com/griesbacher/nagflux/helper"
"github.com/griesbacher/nagflux/logging"
)
//CommentData adds Comments types to the livestatus data
type CommentData struct {
Data
entryType string
}
func (comment *CommentData) sanitizeValues() {
comment.Data.sanitizeValues()
comment.entryType = helper.SanitizeInfluxInput(comment.entryType)
}
//Print srints the data in influxdb lineformat
func (comment CommentData) Print(version float32) string {
comment.sanitizeValues()
if version >= 0.9 {
var tags string
if comment.entryType == "1" {
tags = ",type=comment"
} else if comment.entryType == "2" {
tags = ",type=downtime"
} else if comment.entryType == "3" {
tags = ",type=flapping"
} else if comment.entryType == "4" {
tags = ",type=acknowledgement"
} else {
logging.GetLogger().Warn("This comment type is not supported:" + comment.entryType)
}
return comment.genInfluxLine(tags)
}
logging.GetLogger().Criticalf("This influxversion [%f] given in the config is not supportet", version)
panic("")
}