@@ -28,6 +28,9 @@ type NagiosSpoolfileWorker struct {
2828}
2929
3030const (
31+ nagfluxTags string = "NAGFLUX:TAG"
32+ nagfluxField string = "NAGFLUX:FIELD"
33+
3134 hostPerfdata string = "HOSTPERFDATA"
3235
3336 servicePerfdata string = "SERVICEPERFDATA"
@@ -147,6 +150,16 @@ func (w *NagiosSpoolfileWorker) PerformanceDataIterator(input map[string]string)
147150 currentService = input [servicedesc ]
148151 }
149152
153+ // Allows to add tags and fields to spoolfileentries
154+ tag := map [string ]string {}
155+ if tagString , ok := input [nagfluxTags ]; ok {
156+ tag = helper .StringToMap (tagString , " " , "=" )
157+ }
158+ field := map [string ]string {}
159+ if tagString , ok := input [nagfluxField ]; ok {
160+ field = helper .StringToMap (tagString , " " , "=" )
161+ }
162+
150163 go func () {
151164 perfSlice := regexPerformancelable .FindAllStringSubmatch (input [typ + "PERFDATA" ], - 1 )
152165 currentCheckMultiLabel := ""
@@ -164,8 +177,8 @@ func (w *NagiosSpoolfileWorker) PerformanceDataIterator(input map[string]string)
164177 time : currentTime ,
165178 performanceLabel : value [1 ],
166179 unit : value [3 ],
167- tags : map [ string ] string {} ,
168- fields : map [ string ] string {} ,
180+ tags : tag ,
181+ fields : field ,
169182 }
170183
171184 if currentCheckMultiLabel != "" {
0 commit comments