*: don't exclude resources, if empty exclude is empty. (#1680)

This commit is contained in:
Jan-Otto Kröpke 2024-10-10 21:44:04 +02:00 committed by GitHub
parent 545bf77326
commit 028f7aa823
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 22 additions and 22 deletions

View File

@ -199,22 +199,22 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.iis.app-exclude",
"Regexp of apps to exclude. App name must both match include and not match exclude to be included.",
).Default(c.config.AppExclude.String()).StringVar(&appExclude)
).Default("").StringVar(&appExclude)
app.Flag(
"collector.iis.app-include",
"Regexp of apps to include. App name must both match include and not match exclude to be included.",
).Default(c.config.AppInclude.String()).StringVar(&appInclude)
).Default(".+").StringVar(&appInclude)
app.Flag(
"collector.iis.site-exclude",
"Regexp of sites to exclude. Site name must both match include and not match exclude to be included.",
).Default(c.config.SiteExclude.String()).StringVar(&siteExclude)
).Default("").StringVar(&siteExclude)
app.Flag(
"collector.iis.site-include",
"Regexp of sites to include. Site name must both match include and not match exclude to be included.",
).Default(c.config.SiteInclude.String()).StringVar(&siteInclude)
).Default(".+").StringVar(&siteInclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -99,12 +99,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.logical_disk.volume-exclude",
"Regexp of volumes to exclude. Volume name must both match include and not match exclude to be included.",
).Default(c.config.VolumeExclude.String()).StringVar(&volumeExclude)
).Default("").StringVar(&volumeExclude)
app.Flag(
"collector.logical_disk.volume-include",
"Regexp of volumes to include. Volume name must both match include and not match exclude to be included.",
).Default(c.config.VolumeInclude.String()).StringVar(&volumeInclude)
).Default(".+").StringVar(&volumeInclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -100,12 +100,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.net.nic-exclude",
"Regexp of NIC:s to exclude. NIC name must both match include and not match exclude to be included.",
).Default(c.config.NicExclude.String()).StringVar(&nicExclude)
).Default("").StringVar(&nicExclude)
app.Flag(
"collector.net.nic-include",
"Regexp of NIC:s to include. NIC name must both match include and not match exclude to be included.",
).Default(c.config.NicInclude.String()).StringVar(&nicInclude)
).Default(".+").StringVar(&nicInclude)
app.Flag(
"collector.net.enabled",

View File

@ -76,12 +76,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.physical_disk.disk-exclude",
"Regexp of disks to exclude. Disk number must both match include and not match exclude to be included.",
).Default(c.config.DiskExclude.String()).StringVar(&diskExclude)
).Default("").StringVar(&diskExclude)
app.Flag(
"collector.physical_disk.disk-include",
"Regexp of disks to include. Disk number must both match include and not match exclude to be included.",
).Default(c.config.DiskInclude.String()).StringVar(&diskInclude)
).Default(".+").StringVar(&diskInclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -77,12 +77,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.printer.include",
"Regular expression to match printers to collect metrics for",
).Default(c.config.PrinterInclude.String()).StringVar(&printerInclude)
).Default(".+").StringVar(&printerInclude)
app.Flag(
"collector.printer.exclude",
"Regular expression to match printers to exclude",
).Default(c.config.PrinterExclude.String()).StringVar(&printerExclude)
).Default("").StringVar(&printerExclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -92,12 +92,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.process.exclude",
"Regexp of processes to exclude. Process name must both match include and not match exclude to be included.",
).Default(c.config.ProcessExclude.String()).StringVar(&processExclude)
).Default("").StringVar(&processExclude)
app.Flag(
"collector.process.include",
"Regexp of processes to include. Process name must both match include and not match exclude to be included.",
).Default(c.config.ProcessInclude.String()).StringVar(&processInclude)
).Default(".+").StringVar(&processInclude)
app.Flag(
"collector.process.iis",

View File

@ -106,12 +106,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.scheduled_task.exclude",
"Regexp of tasks to exclude. Task path must both match include and not match exclude to be included.",
).Default(c.config.TaskExclude.String()).StringVar(&taskExclude)
).Default("").StringVar(&taskExclude)
app.Flag(
"collector.scheduled_task.include",
"Regexp of tasks to include. Task path must both match include and not match exclude to be included.",
).Default(c.config.TaskInclude.String()).StringVar(&taskInclude)
).Default(".+").StringVar(&taskInclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -72,12 +72,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.service.exclude",
"Regexp of service to exclude. Service name (not the display name!) must both match include and not match exclude to be included.",
).Default(c.config.ServiceExclude.String()).StringVar(&serviceExclude)
).Default("").StringVar(&serviceExclude)
app.Flag(
"collector.service.include",
"Regexp of service to include. Process name (not the display name!) must both match include and not match exclude to be included.",
).Default(c.config.ServiceInclude.String()).StringVar(&serviceInclude)
).Default(".+").StringVar(&serviceInclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -103,12 +103,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.smtp.server-exclude",
"Regexp of virtual servers to exclude. Server name must both match include and not match exclude to be included.",
).Default(c.config.ServerExclude.String()).StringVar(&serverExclude)
).Default("").StringVar(&serverExclude)
app.Flag(
"collector.smtp.server-include",
"Regexp of virtual servers to include. Server name must both match include and not match exclude to be included.",
).Default(c.config.ServerInclude.String()).StringVar(&serverInclude)
).Default(".+").StringVar(&serverInclude)
app.Action(func(*kingpin.ParseContext) error {
var err error

View File

@ -3,6 +3,6 @@ package types
import "regexp"
var (
RegExpAny = regexp.MustCompile("^(?:.+)$")
RegExpEmpty = regexp.MustCompile("^(?:)$")
RegExpAny = regexp.MustCompile("^.+$")
RegExpEmpty = regexp.MustCompile("^$")
)