tracer icon indicating copy to clipboard operation
tracer copied to clipboard

[BUG] tracer incorrectly identifies quadlet container

Open jcpunk opened this issue 5 months ago • 1 comments

When launching containers with podman-quadlet and updating conmon tracer incorrectly identifies the service owner.

[root@linux ~]# tracer --interactive
You should restart:
[1]  autofs
[2]  firewalld
[3]  oddjobd
[4]  prometheus-node-exporter
[5]  sssd
[6]  sssd
[7]  sssd
[8]  sssd
[9]  sssd
[10] tuned

Additionally, there are:
  - 1 processes requiring reboot

Press application number for help or 'q' to quit
--> 4
* prometheus-node-exporter
    Package:     conmon
    Description: OCI container runtime monitor
    Type:        Daemon
    Executable:  /usr/bin/conmon
    State:       prometheus-node-exporter has been started by root 13 days ago. PID - 2964
                 prometheus-node-exporter has been started by root 13 hours ago. PID - 2939566
                 prometheus-node-exporter has been started by root 6 minutes ago. PID - 3058763
                 ...

    How to restart:
        systemctl restart prometheus-node-exporter

[root@linux ~]# systemctl status -n 0 2964 2939566 3058763
● prometheus-node-exporter.service
     Loaded: loaded (/etc/containers/systemd/prometheus-node-exporter.container; generated)
     Active: active (running) since Thu 2025-07-03 01:49:03 CDT; 1 week 6 days ago
   Main PID: 2964 (conmon)
         IP: 37.3M in, 1.0G out
         IO: 80.6M read, 1.7M written
      Tasks: 30 (limit: 4096)
     Memory: 48.6M (max: 256.0M available: 207.3M)
        CPU: 1h 23min 59.979s
     CGroup: /system.slice/prometheus-node-exporter.service
             ├─libpod-payload-743a35b8d0e5fdced058aaf0a7e2f1bff149ead5cbd7296d79b9eb314fdf0742
             │ └─2966 /bin/node_exporter --path.procfs=/host/proc --path.sysfs=/host/sys --path.rootfs=/host --path.udev.data=/host/run/udev/data "--web.listen-ad>
             └─runtime
               └─2964 /usr/bin/conmon --api-version 1 -c 743a35b8d0e5fdced058aaf0a7e2f1bff149ead5cbd7296d79b9eb314fdf0742 -u 743a35b8d0e5fdced058aaf0a7e2f1bff149e>

● otel-collector.service
     Loaded: loaded (/etc/containers/systemd/otel-collector.container; generated)
     Active: active (running) since Wed 2025-07-16 00:02:32 CDT; 13h ago
   Main PID: 2939566 (conmon)
         IP: 49.5M in, 2.4M out
         IO: 19.8M read, 164.0K written
      Tasks: 11 (limit: 4096)
     Memory: 82.4M (max: 384.0M available: 301.5M)
        CPU: 1min 18.658s
     CGroup: /system.slice/otel-collector.service
             ├─libpod-payload-573b64cc572d34b2545d35ef715759dfdb0a692b8f47bc7659ecb9651babec7c
             │ └─2939568 /otelcol --config /etc/otel-collector/otel-config.yaml
             └─runtime
               └─2939566 /usr/bin/conmon --api-version 1 -c 573b64cc572d34b2545d35ef715759dfdb0a692b8f47bc7659ecb9651babec7c -u 573b64cc572d34b2545d35ef715759dfdb>

● prometheus-nginx-exporter.service
     Loaded: loaded (/etc/containers/systemd/prometheus-nginx-exporter.container; generated)
     Active: active (running) since Wed 2025-07-16 13:36:48 CDT; 6min ago
   Main PID: 3058763 (conmon)
         IP: 11.2K in, 30.0K out
         IO: 1.4M read, 164.0K written
      Tasks: 11 (limit: 4096)
     Memory: 12.0M (max: 256.0M available: 243.9M)
        CPU: 155ms
     CGroup: /system.slice/prometheus-nginx-exporter.service
             ├─libpod-payload-1d10c65ec723413f2290fa9610586e150b4fde7e4140dc79b8c67aee8a6241c4
             │ └─3058765 /usr/bin/nginx-prometheus-exporter --nginx.scrape-uri=http://localhost/stub_status
             └─runtime
               └─3058763 /usr/bin/conmon --api-version 1 -c 1d10c65ec723413f2290fa9610586e150b4fde7e4140dc79b8c67aee8a6241c4 -u 1d10c65ec723413f2290fa9610586e150b>

Output of tracer--show-resource system (python3-tracer-1.1-2.el9.noarch):

Python:             3.9.21
Distribution:       rhel
Package Manager:    Dnf, Yum
Init system:        systemd
Uptime:             13 days, 11:58:23
User:               root

Tracer version:     1.1
Rules:              30
Applications:       57

jcpunk avatar Jul 16 '25 18:07 jcpunk

I believe this is related to https://github.com/FrostyX/tracer/blob/master/tracer/resources/applications.py#L302 only using the first PID from the detected set.

Similarly https://github.com/FrostyX/tracer/blob/master/tracer/resources/applications.py#L253 seems to assume a single service command per changed package - ie

systemctl restart prometheus-node-exporter otel-collector prometheus-nginx-exporter

I think breaking them out a bit more would probably be good - ie:

systemctl restart prometheus-node-exporter
systemctl restart otel-collector
systemctl restart prometheus-nginx-exporter

As these may be things you'd want to kick separately.

jcpunk avatar Jul 16 '25 19:07 jcpunk