Skip to content

systemd-exporter missing metrics from accounting #187

@kanistra121

Description

@kanistra121

On the target VM I have enabled a systemd-exporter via docker and nginx as reverse proxy. So far I am getting my metrics into Grafana.

  systemd-exporter:
    image: prometheuscommunity/systemd-exporter:main
    container_name: "systemd-exporter"
    command:
    #- '--systemd.collector.unit-include=".+"'
    #- '--systemd.collector.unit-exclude=".+"'
    - '--systemd.collector.enable-restart-count'
    - '--systemd.collector.enable-ip-accounting'
    - '--log.level=info'
    pid: host
    restart: unless-stopped
    volumes:
      #- /proc:/host/proc:ro
      #- /sys:/host/sys:ro
      - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
    networks:
      - monitoring  

I see that the systemd configs are enabled as expected. With systemd-analyze cat-config /etc/systemd/system.conf I see that config and drop-ins are correct. Also make sure to systemctl daemon-reload and restart exporters.

# /etc/systemd/system.conf.d/monitoring-overrides.conf
# Enable accounting for testing monitoring /root/monitoring
[Manager]
DefaultCPUAccounting=true
DefaultMemoryAccounting=true
DefaultIOAccounting=true
DefaultIPAccounting=true
DefaultTasksAccounting=true

I double checked that these are enabled per service.

systemctl show --property=CPUAccounting ssh.service
systemctl show --property=MemoryAccounting ssh.service
systemctl show --property=IOAccounting ssh.service
systemctl show --property=IPAccounting ssh.service
systemctl show --property=TasksAccounting ssh.service

Still when I using this dashboard,
some metrics are not present in visualizations like CPU Usage or Memory Usage.

sum by(name) (irate(systemd_unit_cpu_seconds_total{instance="$instance",name=~"$name"}[$__rate_interval]))
sum by(name) (systemd_unit_memory_bytes{instance="$instance",name=~"$name"})

These series are not even active when I curl my target. With this approach I successfully enabled IPAccounting, though.
In total I see 3601 series when queried with count({instance="example.com:9558"})

systemd_exporter_build_info{branch="main",goarch="amd64",goos="linux",goversion="go1.24.10",revision="a4e850d12e819b332900f9d3fc5cb77582f6d2c6",tags="unknown",version="0.7.0"} 1

cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions