diff --git a/main.go b/main.go index 9b30833..45e1e4b 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,7 @@ var ( VersionHash string VersionDate string + ExcludeVBE bool PrometheusExporter = NewPrometheusExporter() VarnishVersion = NewVarnishVersion() ExitHandler = &exitHandler{} @@ -93,12 +94,15 @@ func main() { flag.BoolVar(&StartParams.Test, "test", StartParams.Test, "Test varnishstat availability, prints available metrics and exits.") flag.BoolVar(&StartParams.Raw, "raw", StartParams.Test, "Raw stdout logging without timestamps.") flag.BoolVar(&StartParams.WithGoMetrics, "with-go-metrics", StartParams.WithGoMetrics, "Export go runtime and http handler metrics") + excludeVbe := flag.Bool("e", false, "Exclude metrics starting with VBE.") // deprecated flag.BoolVar(&StartParams.noExit, "no-exit", StartParams.noExit, "Deprecated: see -exit-on-errors") flag.Parse() + ExcludeVBE = *excludeVbe + if version { fmt.Printf("%s %s\n", ApplicationName, getVersion(true)) os.Exit(0) diff --git a/varnish.go b/varnish.go index 9d74ba5..8119a00 100644 --- a/varnish.go +++ b/varnish.go @@ -99,6 +99,9 @@ func ScrapeVarnishFrom(buf []byte, ch chan<- prometheus.Metric) ([]byte, error) if isOutdatedVbe(vName, mostRecentVbeReloadPrefix) { continue } + if ExcludeVBE && strings.HasPrefix(vName, "VBE.") { + continue + } if vName == "timestamp" { continue }