Ov d Z ddlZddlmZmZmZ dZ eddh ZdZ de
dee d efd
Z
dded ee
ef fdZ dd
e
deee d ee
ef fdZedfde
deee d ee
ef fdZdS )uS
Telemetry collector for LVE Traffic Accounting (CLOS-4341).
Parses /proc/lve/list and produces a small set of metrics that let us answer:
- does this kernel expose net accounting at all (NETO/NETI columns present)?
- how many user LVEs exist and how many actually accumulated traffic?
- what's the cumulative NETO/NETI volume across user LVEs on this host?
/proc/lve/list contains two non-user LVE rows we exclude from all aggregates:
- *default* (user_id = UINT_MAX) — kernel catch-all for processes not
attached to any specific LVE (sshd, systemd, dnf, ...). Has non-zero
traffic on essentially every running CL host.
- *root* (user_id = 0) — LVE container for root (uid 0). Not a hosting user.
After exclusion the metrics describe user hosting activity, and lves_total
matches the count seen by `lvectl list` and the panel's user list.
N)DictIterableOptionalz/proc/lve/listl net_acct_kernel_supportednet_acct_lves_totalnet_acct_lves_with_trafficnet_acct_total_neto_bytesnet_acct_total_neti_byteslve_id_fieldexcludedreturnc | dd d } t | |v S # t $ r Y dS w xY w)zTrue if the LVE row's user_id is in the excluded set.
LVE ids in /proc/lve/list use the form "