System metrics collector for CPU, memory, disk, and network
Project description
philiprehberger-server-monitor
System metrics collector for CPU, memory, disk, and network.
Install
pip install philiprehberger-server-monitor
Usage
from philiprehberger_server_monitor import Monitor, Alert
monitor = Monitor()
# Single snapshot
snap = monitor.snapshot()
print(f"CPU: {snap.cpu.percent}%")
print(f"Memory: {snap.memory.used_gb:.1f}/{snap.memory.total_gb:.1f} GB")
print(f"Disk: {snap.disk['/'].percent}%")
# Continuous monitoring with alerts
monitor.watch(
interval=5.0,
on_snapshot=lambda s: print(f"CPU: {s.cpu.percent}%"),
alerts=[
Alert(metric="cpu.percent", threshold=90, callback=lambda m, v, t: print(f"HIGH CPU: {v}%")),
Alert(metric="memory.percent", threshold=85, callback=send_alert),
],
)
# Export snapshot
data = snap.to_dict()
Metrics
| Category | Fields |
|---|---|
| CPU | percent, count, count_logical, per_cpu, freq_mhz |
| Memory | total, available, used, percent, total_gb, used_gb |
| Disk | mountpoint, total, used, free, percent |
| Network | bytes_sent, bytes_recv, packets_sent, packets_recv |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file philiprehberger_server_monitor-0.1.2.tar.gz.
File metadata
- Download URL: philiprehberger_server_monitor-0.1.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c914d0feb036b25422af1920df600b32a2f99233ee2fa5649a2458b9ba49311
|
|
| MD5 |
ac099e16de0900626e24fb149c22ea87
|
|
| BLAKE2b-256 |
1143428568f3aa2b5764545aa76f42ca674872851bbb06caf25d15b9481e12e6
|
File details
Details for the file philiprehberger_server_monitor-0.1.2-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_server_monitor-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a154026026ce1ecc9155f5b0ba69c3557ebcfa993aa60ee3fb8327166497a56
|
|
| MD5 |
86acbf5e7947330731d3d2cd1fab11b9
|
|
| BLAKE2b-256 |
eff5ee7c81b0bf656202f9a4bf935b4b9a86a33601f06f580b4e906fb2bc4c86
|