Skip to content

[receiver/hostmetrics/scrapers/process] - "error reading username for process x... unknown userid y" when user not found in /etc/passwd #17187

Closed as not planned
@alexchowle

Description

@alexchowle

Component(s)

receiver/hostmetrics

What happened?

Description

Attempting to collect per-process metrics fails as no Username can be found for a given PID's UID.

Steps to Reproduce

Enabling the collection of per-process metrics via the following config (and running as root):

receivers:
  hostmetrics:
    scrapers:
      process:
        mute_process_name_error: true

Expected Result

Production of per-process metrics

Actual Result

No per-process metrics are created.

Collector version

v0.60.0

Environment information

Environment

OS: CentOS Linux release 7.9.2009 (Core)

OpenTelemetry Collector configuration

extensions:
  health_check:
    endpoint: 0.0.0.0:13133
  memory_ballast:
    size_mib: 683
  zpages:
    endpoint: ":55679"

receivers:
  hostmetrics:
    collection_interval: 5s
    scrapers:
      cpu:
      disk:
      filesystem:
      memory:
      network:
      load:
      paging:
      processes:
      process:
        mute_process_name_error: true
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
  
processors:
  batch:
  memory_limiter:
    check_interval: 2s
    limit_mib: 1024

  resourcedetection:
    detectors: [gce, ecs, ec2, azure, system]
    override: true
              
  resource/add_environment:
    attributes:
      - action: insert
        value: LOCAL
        key: deployment.environment

exporters:
  # Traces
  otlp:
    endpoint: <SOME_OTHER_SERVER>:4317
    tls:
      insecure: true
  logging:
    loglevel: info

service:
  extensions: [memory_ballast, health_check, zpages]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, batch, resourcedetection, resource/add_environment]
      exporters: [otlp, logging]
    metrics:
      receivers: [hostmetrics, otlp]
      processors: [memory_limiter, batch, resourcedetection, resource/add_environment]
      exporters: [otlp, logging]

Log output

2022-12-20T15:23:28.574Z        info    service/service.go:129  Everything is ready. Begin running and processing data.                                                                                            
2022-12-20T15:23:32.894Z        error   scraperhelper/scrapercontroller.go:197  Error scraping metrics  {"kind": "receiver", "name": "hostmetrics", "pipeline": "metrics", "error": "error reading parent pid for process \"systemd\" (pid 1): invalid pid 0; error reading username for process \"nemo\" (pid 963): user: unknown userid 247235611; error reading username for process \"gnome-keyring-daemon\" (pid 4108): user: unknown userid 247235611; error reading username for process \"cinnamon-session\" (pid 4179): user: unknown userid 247235611; error reading username for process \"dbus-launch\" (pid 4190): user: unknown userid 247235611;
...
...

Additional context

Using an ActiveDirectory-based authentication system via sssd which means that a local user account may not exist for a logged-in user. Running the Collector as root i.e. not the UID that is failing lookup

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions