open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.06k stars 2.36k forks source link

New component: Add systemd receiver #33532

Open Hemansh31 opened 4 months ago

Hemansh31 commented 4 months ago

The purpose and use-cases of the new component

The systemd receiver collects the value of different properties of a systemd unit and publishes that data as metrics data.

Example configuration for the component

receivers: systemd: services:

Telemetry data types supported

These would be primarily metrics

Is this a vendor-specific component?

Code Owner(s)

@Hemansh31

Sponsor (optional)

@atoulme

Additional context

No response

atoulme commented 4 months ago

Can you share what metadata.yaml would look like?

Hemansh31 commented 4 months ago
type: systemdunitsreceiver
scope_name: otelcol/systemdunitsreceiver

attributes:
  name:
    description: Name of the systemd unit.
    type: string

  type:
    description: The type of systemd unit.
    type: string
    enum: [service, timer, target, socket, mount]

  pid:
    description: MainPID of the systemd unit
    type: int

# ActiveState Code
# Value   Meaning   Description
#   0   active        unit is ~
#   1   reloading     unit is ~
#   2   inactive      unit is ~
#   3   failed        unit is ~
#   4   activating    unit is ~
#   5   deactivating  unit is ~

# LoadState Code
# Value   Meaning   Description
#   0   loaded        unit is ~
#   1   stub          unit is ~
#   2   not-found     unit is ~
#   3   bad-setting   unit is ~
#   4   error         unit is ~
#   5   merged        unit is ~
#   6   masked        unit is ~

metrics:
  systemd.service.ActiveState:
    enabled: true
    description: Active State of the systemd service.
    unit: ~
    gauge:
      value_type: int
    attributes: [name, type, pid]
  systemd.service.LoadState:
    enabled: true
    description: Load State of the systemd service.
    unit: ~
    gauge:
      value_type: int
    attributes: [name, type, pid]
Hemansh31 commented 4 months ago

Can you share what metadata.yaml would look like?

@atoulme shared metadata.yml for systemd unit file receiver, this is just a reference of what the metadata.yml would look like, will need to do some modifications upon design finalization

atoulme commented 4 months ago

I am interested in sponsoring this component.

Hemansh31 commented 4 months ago

Thanks @atoulme, will start working on the PR for this component. I am following the guidelines specified here, do let me know if I am missing something

crobert-1 commented 3 months ago

Removing needs triage as component has been accepted by a sponsor.

github-actions[bot] commented 1 month ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

atoulme commented 2 weeks ago

OK, are we doing this? I can create the skeleton of the receiver for you if you like to get things started.

Hemansh31 commented 2 weeks ago

@atoulme sorry for the delay, this skeleton helps a ton, can I take this forward now ?

atoulme commented 1 week ago

yes please