Skip to content

Update config options for windows_exporter process collector #3419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Main (unreleased)

- Pretty print diagnostic errors when using `alloy run` (@kalleep)

- Update config options for windows_exporter process collector (@jaco-vanzyl)
The `process.iis` argument can now be passed to the process collector to enable IIS process name queries.

### Bugfixes

- Fix `otelcol.receiver.filelog` documentation's default value for `start_at`. (@petewall)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ User-supplied `exclude` and `include` strings are [wrapped][wrap-regex] in a reg

### `process`

| Name | Type | Description | Default | Required |
| --------- | -------- | ------------------------------------------- | -------- | -------- |
| `exclude` | `string` | Regular expression of processes to exclude. | `"^$"` | no |
| `include` | `string` | Regular expression of processes to include. | `"^.+$"` | no |
| Name | Type | Description | Default | Required |
| -------------------- | -------- | ------------------------------------------- | --------- | -------- |
| `exclude` | `string` | Regular expression of processes to exclude. | `"^$"` | no |
| `include` | `string` | Regular expression of processes to include. | `"^.+$"` | no |
| `iis_process_lookup` | `string` | Enables IIS process name queries. | `"false"` | no |

Processes must match the regular expression specified by `include` and must _not_ match the regular expression specified by `exclude` to be included.

Expand Down
10 changes: 6 additions & 4 deletions internal/component/prometheus/exporter/windows/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ func (t ServiceConfig) Convert() windows_integration.ServiceConfig {

// ProcessConfig handles settings for the windows_exporter process collector
type ProcessConfig struct {
BlackList string `alloy:"blacklist,attr,optional"`
WhiteList string `alloy:"whitelist,attr,optional"`
Exclude string `alloy:"exclude,attr,optional"`
Include string `alloy:"include,attr,optional"`
BlackList string `alloy:"blacklist,attr,optional"`
WhiteList string `alloy:"whitelist,attr,optional"`
Exclude string `alloy:"exclude,attr,optional"`
Include string `alloy:"include,attr,optional"`
EnableWorkerProcess string `alloy:"iis_process_lookup,attr,optional"`
}

// Convert converts the component's ProcessConfig to the integration's ProcessConfig.
Expand All @@ -179,6 +180,7 @@ func (t ProcessConfig) Convert() windows_integration.ProcessConfig {
WhiteList: wrapRegex(t.WhiteList),
Exclude: wrapRegex(t.Exclude),
Include: wrapRegex(t.Include),
IIS: t.EnableWorkerProcess,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestDefaultConfig(t *testing.T) {
Network: NetworkConfig{BlackList: "^$", WhiteList: "^.+$", Exclude: "^$", Include: "^.+$"},
PhysicalDisk: PhysicalDiskConfig{Include: "^.+$", Exclude: "^$"},
Printer: PrinterConfig{Exclude: "^$", Include: "^.+$"},
Process: ProcessConfig{BlackList: "^$", WhiteList: "^.+$", Exclude: "^$", Include: "^.+$"},
Process: ProcessConfig{BlackList: "^$", WhiteList: "^.+$", Exclude: "^$", Include: "^.+$", EnableWorkerProcess: "false"},
ScheduledTask: ScheduledTaskConfig{Exclude: "^$", Include: "^.+$"},
Service: ServiceConfig{UseApi: "false", Where: "", V2: "false"},
SMB: SMBConfig{EnabledList: []string{}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ func (a *Arguments) SetToDefault() {
Exclude: col.ConfigDefaults.Printer.PrinterExclude.String(),
},
Process: ProcessConfig{
BlackList: col.ConfigDefaults.Process.ProcessExclude.String(),
WhiteList: col.ConfigDefaults.Process.ProcessInclude.String(),
Include: col.ConfigDefaults.Process.ProcessInclude.String(),
Exclude: col.ConfigDefaults.Process.ProcessExclude.String(),
BlackList: col.ConfigDefaults.Process.ProcessExclude.String(),
WhiteList: col.ConfigDefaults.Process.ProcessInclude.String(),
Include: col.ConfigDefaults.Process.ProcessInclude.String(),
Exclude: col.ConfigDefaults.Process.ProcessExclude.String(),
EnableWorkerProcess: strconv.FormatBool(col.ConfigDefaults.Process.EnableWorkerProcess),
},
ScheduledTask: ScheduledTaskConfig{
Include: col.ConfigDefaults.ScheduledTask.TaskInclude.String(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
process {
include = ".+"
exclude = ""
iis_process_lookup = "false"
}

smb {
Expand Down Expand Up @@ -102,6 +103,7 @@ func TestAlloyUnmarshal(t *testing.T) {
require.Equal(t, []string{"example"}, args.SMBClient.EnabledList)
require.Equal(t, "", args.Process.Exclude)
require.Equal(t, ".+", args.Process.Include)
require.Equal(t, "false", args.Process.EnableWorkerProcess)
require.Equal(t, "", args.Network.Exclude)
require.Equal(t, ".+", args.Network.Include)
require.Equal(t, []string{"accessmethods"}, args.MSSQL.EnabledClasses)
Expand Down Expand Up @@ -132,6 +134,7 @@ func TestConvert(t *testing.T) {
require.Equal(t, "^(?:.+)$", conf.PhysicalDisk.Include)
require.Equal(t, "^(?:)$", conf.Process.Exclude)
require.Equal(t, "^(?:.+)$", conf.Process.Include)
require.Equal(t, "false", conf.Process.IIS)
require.Equal(t, "^(?:)$", conf.Printer.Exclude)
require.Equal(t, "^(?:.+)$", conf.Printer.Include)
require.Equal(t, "example", conf.SMB.EnabledList)
Expand Down
1 change: 1 addition & 0 deletions internal/static/integrations/windows_exporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type ProcessConfig struct {
WhiteList string `yaml:"whitelist,omitempty"`
Include string `yaml:"include,omitempty"`
Exclude string `yaml:"exclude,omitempty"`
IIS string `yaml:"iis_process_lookup,omitempty"`
}

// NetworkConfig handles settings for the windows_exporter network collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func (c *Config) ToWindowsExporterConfig() (collector.Config, error) {
errs = append(errs, err)
cfg.Process.ProcessInclude, err = regexp.Compile(coalesceString(c.Process.Include, c.Process.WhiteList))
errs = append(errs, err)
cfg.Process.EnableWorkerProcess, err = strconv.ParseBool(c.Process.IIS)
errs = append(errs, err)

cfg.Net.NicExclude, err = regexp.Compile(coalesceString(c.Network.Exclude, c.Network.BlackList))
errs = append(errs, err)
Expand Down