Skip to content

feat(plugins/inputs/systemd_units): PATTERN support #9664

@DavidBuettner

Description

@DavidBuettner

Feature Request

Linux systemctl list-units used in plugins/inputs/systemd_units provides the option to filter the output based on a pattern in order to limit information to a subset of services.
This issue will be followed by a pull-request providing an implementation shortly.

Proposal:

Extend the systemd_units plugin to support patterns provided in respective conf file

Current behavior:

No pattern is supported

// SampleConfig returns sample configuration options.
func (s *SystemdUnits) SampleConfig() string {
	return `
  ## Set timeout for systemctl execution
  # timeout = "1s"
  #
  ## Filter for a specific unit type, default is "service", other possible
  ## values are "socket", "target", "device", "mount", "automount", "swap",
  ## "timer", "path", "slice" and "scope ":
  # unittype = "service"
`
}

Desired behavior:

Support pattern in config file:

// SampleConfig returns sample configuration options.
func (s *SystemdUnits) SampleConfig() string {
	return `
  ## Set timeout for systemctl execution
  # timeout = "1s"
  #
  ## Filter for a specific unit type, default is "service", other possible
  ## values are "socket", "target", "device", "mount", "automount", "swap",
  ## "timer", "path", "slice" and "scope ":
  # unittype = "service"
  #
  ## Filter for a specific pattern, default is "" (i.e. all), other possible
  ## values are valid pattern for systemctl, e.g. "a*" for all units with
  ## names starting with "a"
  # pattern = ""
  ## pattern = "telegraf* influxdb*"
  ## pattern = "a*"
`
}

Use case:

In our setup performance is critical and any option to avoid unnecessary data collection/communication is important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions