From e6e0da26fcf69fa1cf64d157bf8b3f111599af69 Mon Sep 17 00:00:00 2001 From: Ivo Gosemann Date: Thu, 25 Nov 2021 17:13:01 +0100 Subject: [PATCH] Adds support for netflow input metrics --- collector/filebeat.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/collector/filebeat.go b/collector/filebeat.go index ee04b6d..42800a3 100644 --- a/collector/filebeat.go +++ b/collector/filebeat.go @@ -27,6 +27,14 @@ type Filebeat struct { Truncated float64 `json:"truncated"` } `json:"files"` } `json:"log"` + + Netflow struct { + Flows float64 `json:"flows"` + Packets struct { + Received float64 `json:"received"` + Dropped float64 `json:"dropped"` + } `json:"packets"` + } `json:"netflow"` } `json:"input"` } @@ -132,6 +140,33 @@ func NewFilebeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector eval: func(stats *Stats) float64 { return stats.Filebeat.Input.Log.Files.Truncated }, valType: prometheus.UntypedValue, }, + { + desc: prometheus.NewDesc( + prometheus.BuildFQName(beatInfo.Beat, "filebeat", "input_netflow"), + "filebeat.input_netflow", + nil, prometheus.Labels{"netflow": "flows"}, + ), + eval: func(stats *Stats) float64 { return stats.Filebeat.Input.Netflow.Flows }, + valType: prometheus.UntypedValue, + }, + { + desc: prometheus.NewDesc( + prometheus.BuildFQName(beatInfo.Beat, "filebeat", "input_netflow"), + "filebeat.input_netflow", + nil, prometheus.Labels{"netflow": "packets_received"}, + ), + eval: func(stats *Stats) float64 { return stats.Filebeat.Input.Netflow.Packets.Received }, + valType: prometheus.UntypedValue, + }, + { + desc: prometheus.NewDesc( + prometheus.BuildFQName(beatInfo.Beat, "filebeat", "input_netflow"), + "filebeat.input_netflow", + nil, prometheus.Labels{"netflow": "packets_dropped"}, + ), + eval: func(stats *Stats) float64 { return stats.Filebeat.Input.Netflow.Packets.Dropped }, + valType: prometheus.UntypedValue, + }, }, } }