diff --git a/receiver/purefareceiver/README.md b/receiver/purefareceiver/README.md index 8b3c91f6be9d..560460f266b6 100644 --- a/receiver/purefareceiver/README.md +++ b/receiver/purefareceiver/README.md @@ -35,6 +35,7 @@ receivers: host: 13s directories: 15s pods: 30s + volumes: 25s ``` The full list of settings exposed for this receiver are documented [here](./config.go) diff --git a/receiver/purefareceiver/config.go b/receiver/purefareceiver/config.go index 326d84340328..5660fdc9352b 100644 --- a/receiver/purefareceiver/config.go +++ b/receiver/purefareceiver/config.go @@ -45,6 +45,9 @@ type Config struct { // Pods represents the list of pods to query Pods []internal.ScraperConfig `mapstructure:"pods"` + + // Volumes represents the list of volumes to query + Volumes []internal.ScraperConfig `mapstructure:"volumes"` } type Settings struct { @@ -56,6 +59,7 @@ type ReloadIntervals struct { Host time.Duration `mapstructure:"host"` Directories time.Duration `mapstructure:"directories"` Pods time.Duration `mapstructure:"pods"` + Volumes time.Duration `mapstructure:"volumes"` } func (c *Config) Validate() error { diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index e829b7fdf394..b028150f1fdc 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -38,6 +38,7 @@ const ( ScraperTypeHost ScraperType = "host" ScraperTypeDirectories ScraperType = "directories" ScraperTypePods ScraperType = "pods" + ScraperTypeVolumes ScraperType = "volumes" ) type scraper struct { diff --git a/receiver/purefareceiver/receiver.go b/receiver/purefareceiver/receiver.go index 2c623dd32dcd..0d9877000e93 100644 --- a/receiver/purefareceiver/receiver.go +++ b/receiver/purefareceiver/receiver.go @@ -75,6 +75,13 @@ func (r *purefaReceiver) Start(ctx context.Context, compHost component.Host) err return err } + volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes) + if scCfgs, err := volumesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { + scrapeCfgs = append(scrapeCfgs, scCfgs...) + } else { + return err + } + promRecvCfg := fact.CreateDefaultConfig().(*prometheusreceiver.Config) promRecvCfg.PrometheusConfig = &config.Config{ScrapeConfigs: scrapeCfgs} diff --git a/receiver/purefareceiver/testdata/config.yaml b/receiver/purefareceiver/testdata/config.yaml index 656305e9284f..1a5bca5b8c3e 100644 --- a/receiver/purefareceiver/testdata/config.yaml +++ b/receiver/purefareceiver/testdata/config.yaml @@ -17,3 +17,4 @@ receivers: host: 13s directories: 15s pods: 30s + volumes: 25s