Skip to main content

Anonymous Ubuntu host-level CPU/GPU resource and power monitor.

Project description

Anonymous System Resource Monitor

This is a host-level Ubuntu monitor for group servers. It samples aggregate CPU, memory, load, GPU power/utilization/memory/temperature, and best-effort CPU package power. It does not record PID, username, command line, Docker container, image, or compose service information.

Install from PyPI

Recommended with pipx:

sudo apt update
sudo apt install -y pipx
pipx ensurepath
pipx install system-resource-monitor

sudo "$(command -v system-resource-monitor)" install-systemd

Upgrade an existing install:

pipx upgrade system-resource-monitor

Then check the timer:

systemctl list-timers system-resource-monitor.timer
sudo "$(command -v system-resource-monitor)" status

Safety Contract

The collect, watch, and report commands are read-only with respect to running workloads:

  • They do not call docker, kill, pkill, os.kill, signal APIs, terminate(), or kill().

  • They do not enumerate /proc/<pid> and do not inspect per-process metadata.

  • The only external command used by collect and watch is:

    nvidia-smi --query-gpu=index,uuid,name,power.draw,utilization.gpu,utilization.memory,memory.used,memory.total,temperature.gpu --format=csv,noheader,nounits
    
  • The install-systemd, uninstall-systemd, and status commands may call systemctl, but only to manage system-resource-monitor.service and system-resource-monitor.timer.

  • The systemd unit also drops CAP_KILL and denies common signal-sending syscalls, so even accidental future signal-sending code should fail under the timer service.

Install from Source

cd system-resource-monitor

sudo mkdir -p /opt/system-resource-monitor /var/lib/system-resource-monitor
sudo install -m 0755 system_resource_monitor.py /opt/system-resource-monitor/system_resource_monitor.py
sudo install -m 0644 README.md /opt/system-resource-monitor/README.md
sudo install -m 0644 system-resource-monitor.service /etc/systemd/system/system-resource-monitor.service
sudo install -m 0644 system-resource-monitor.timer /etc/systemd/system/system-resource-monitor.timer
sudo chmod 0750 /var/lib/system-resource-monitor

sudo systemctl daemon-reload
sudo systemctl enable --now system-resource-monitor.timer

If installed as a Python package, prefer:

sudo "$(command -v system-resource-monitor)" install-systemd

Check Status

systemctl list-timers system-resource-monitor.timer
sudo systemctl status system-resource-monitor.service
journalctl -u system-resource-monitor.service -n 50

Collect Once

sudo "$(command -v system-resource-monitor)" collect

Watch Live Metrics

Refresh the terminal every 5 seconds and automatically save samples from this watch session to /tmp/system_resource_watch_<timestamp>.csv:

sudo "$(command -v system-resource-monitor)" watch

Use a custom interval and CSV path:

sudo "$(command -v system-resource-monitor)" watch \
  --interval-sec 2 \
  --csv /tmp/locus_gpu_watch.csv

Stop with Ctrl-C. The CSV contains one host row per sample and one gpu row per GPU per sample. It does not contain PID, username, command line, Docker container, image, or compose service information.

Export Reports

Recent 24 hours:

sudo "$(command -v system-resource-monitor)" report \
  --since-hours 24 \
  --out /tmp/system_resource_report_24h.csv

Recent 7 days:

sudo "$(command -v system-resource-monitor)" report \
  --since-hours 168 \
  --out /tmp/system_resource_report_7d.csv

Notes

  • GPU metrics use nvidia-smi --query-gpu, so NVIDIA drivers must be installed for GPU rows to appear.
  • CPU package power is read from /sys/class/powercap/intel-rapl:* when the kernel exposes it. If unavailable, it is stored as empty/NULL.
  • Energy estimates use power_w * interval_sec; first samples and samples after long gaps are not counted toward kWh estimates.
  • Data older than 90 days is deleted during each collection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

system_resource_monitor-0.2.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

system_resource_monitor-0.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file system_resource_monitor-0.2.0.tar.gz.

File metadata

  • Download URL: system_resource_monitor-0.2.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for system_resource_monitor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 da17ec3b2f6d99611812e04088ee502d245eddc80b01484b7aab71cb838ba8ff
MD5 2d69324472204e6e12f5ef6a48a44fd3
BLAKE2b-256 ff84291e217f54268e9e553c8fe65c543690910031cdc96d52c549ec54f9c8a8

See more details on using hashes here.

File details

Details for the file system_resource_monitor-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for system_resource_monitor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43119d9998e07f28806bfbf48c199aefa25f9920388c3d826fbc4695e43419f5
MD5 6f6550fb9a6ce1e1e2563a2ba245b495
BLAKE2b-256 a34a264f12cb6f63bea00b127788e9675675ac293f056d2265b0b768969987bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page