diff --git a/go.mod b/go.mod index fea3cf1f699..3d5e45026a4 100644 --- a/go.mod +++ b/go.mod @@ -356,7 +356,7 @@ replace ( github.com/docker/go-plugins-helpers => github.com/elastic/go-plugins-helpers v0.0.0-20200207104224-bdf17607b79f github.com/dop251/goja => github.com/andrewkroh/goja v0.0.0-20190128172624-dd2ac4456e20 github.com/dop251/goja_nodejs => github.com/dop251/goja_nodejs v0.0.0-20171011081505-adff31b136e6 - github.com/elastic/elastic-agent-system-metrics => github.com/easyops-cn/elastic-agent-system-metrics v0.0.0-20230116033658-1eb4d4676fdf + github.com/elastic/elastic-agent-system-metrics => github.com/easyops-cn/elastic-agent-system-metrics v0.0.0-20231226095934-9a9b02233d5f github.com/fsnotify/fsevents => github.com/elastic/fsevents v0.0.0-20181029231046-e1d381a4d270 github.com/fsnotify/fsnotify => github.com/adriansr/fsnotify v1.4.8-0.20211018144411-a81f2b630e7c github.com/godror/godror => github.com/godror/godror v0.33.2 // updating to v0.24.2 caused a breaking change diff --git a/go.sum b/go.sum index 88cf1317c71..689b2817b7d 100644 --- a/go.sum +++ b/go.sum @@ -603,8 +603,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8 github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/easyops-cn/elastic-agent-system-metrics v0.0.0-20230116033658-1eb4d4676fdf h1:9hyL+SclPudsaBCWJZ98dikpu1NKelx18dNkAY94ozs= -github.com/easyops-cn/elastic-agent-system-metrics v0.0.0-20230116033658-1eb4d4676fdf/go.mod h1:vTqfhtj83LlPKbusEwrEywZv13nhPExwINB3PkeRQeo= +github.com/easyops-cn/elastic-agent-system-metrics v0.0.0-20231226095934-9a9b02233d5f h1:SBkqjjynB80x1FAsLi07zMXeyFUrLe9Jz8KVU5nedLs= +github.com/easyops-cn/elastic-agent-system-metrics v0.0.0-20231226095934-9a9b02233d5f/go.mod h1:vTqfhtj83LlPKbusEwrEywZv13nhPExwINB3PkeRQeo= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/eclipse/paho.mqtt.golang v1.3.5 h1:sWtmgNxYM9P2sP+xEItMozsR3w0cqZFlqnNN1bdl41Y= github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= diff --git a/metricbeat/module/system/filesystem/filesystem.go b/metricbeat/module/system/filesystem/filesystem.go index 60a1c4a5bf7..ad138a9512a 100644 --- a/metricbeat/module/system/filesystem/filesystem.go +++ b/metricbeat/module/system/filesystem/filesystem.go @@ -42,7 +42,8 @@ func init() { // Config stores the metricset-local config type Config struct { - IgnoreTypes []string `config:"filesystem.ignore_types"` + IgnoreTypes []string `config:"filesystem.ignore_types"` + CollectTypes []string `config:"filesystem.collect_types"` } // MetricSet for fetching filesystem metrics. @@ -69,6 +70,9 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { if len(config.IgnoreTypes) > 0 { logp.Info("Ignoring filesystem types: %s", strings.Join(config.IgnoreTypes, ", ")) } + if len(config.CollectTypes) > 0 { + config.CollectTypes = strings.Split(config.CollectTypes[0], ",") + } return &MetricSet{ BaseMetricSet: base, config: config, @@ -79,7 +83,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { // Fetch fetches filesystem metrics for all mounted filesystems and returns // an event for each mount point. func (m *MetricSet) Fetch(r mb.ReporterV2) error { - fsList, err := fs.GetFilesystems(m.sys, fs.BuildFilterWithList(m.config.IgnoreTypes)) + fsList, err := fs.GetFilesystems(m.sys, fs.BuildFilterWithList(m.config.IgnoreTypes, m.config.CollectTypes)) if err != nil { return fmt.Errorf("error fetching filesystem list: %w", err) } diff --git a/metricbeat/module/system/fsstat/fsstat.go b/metricbeat/module/system/fsstat/fsstat.go index ddf3be6142c..76fd8062c68 100644 --- a/metricbeat/module/system/fsstat/fsstat.go +++ b/metricbeat/module/system/fsstat/fsstat.go @@ -60,6 +60,10 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { base.Logger().Info("Ignoring filesystem types: %s", strings.Join(config.IgnoreTypes, ", ")) } + if len(config.CollectTypes) > 0 { + config.CollectTypes = strings.Split(config.CollectTypes[0], ",") + } + return &MetricSet{ BaseMetricSet: base, config: config, @@ -70,7 +74,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { // Fetch fetches filesystem metrics for all mounted filesystems and returns // a single event containing aggregated data. func (m *MetricSet) Fetch(r mb.ReporterV2) error { - fsList, err := fs.GetFilesystems(m.sys, fs.BuildFilterWithList(m.config.IgnoreTypes)) + fsList, err := fs.GetFilesystems(m.sys, fs.BuildFilterWithList(m.config.IgnoreTypes, m.config.CollectTypes)) if err != nil { return fmt.Errorf("error fetching filesystem list: %w", err) }