Skip to content

Commit

Permalink
*: don't exclude resources, if exclude option is empty.
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Oct 10, 2024
1 parent 72df515 commit 8f4c892
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions internal/collector/iis/iis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/logical_disk/logical_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/net/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/physical_disk/physical_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/scheduled_task/scheduled_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/types/regexp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package types
import "regexp"

var (
RegExpAny = regexp.MustCompile("^(?:.+)$")
RegExpEmpty = regexp.MustCompile("^(?:)$")
RegExpAny = regexp.MustCompile("^.+$")
RegExpEmpty = regexp.MustCompile("^$")
)

0 comments on commit 8f4c892

Please sign in to comment.