A high-performance, lightweight, and native system monitor for Linux.
sysmon is a C-based utility designed for users who need real-time system insights without the overhead of heavy monitoring suites. By reading directly from the kernel's /proc filesystem, it provides raw, accurate data with minimal CPU and RAM impact.
- Zero Bloat: Written in pure C with no external dependencies.
- Data-Ready: Outputs metrics in JSON Lines (
.jsonl) format, perfect for automation and data pipelines. - Smart Logging: Features built-in O(1) log rotation to ensure your storage never fills up unexpectedly.
- Native Performance: Interacts directly with the Linux kernel for maximum efficiency.
If you prefer building it yourself or want to customize the code:
- Navigate to the source directory:
cd linux-sysmon- Compile the project:
make #for x64
make x86 #for x86
make arm64 #for arm64- Install to your system path:
sudo make install- Run the monitor:
Simply type
sysmonin your terminal.
Logs are stored every 5 seconds in ~/.status/status.json. You can watch the metrics live using:
tail -f ~/.status/status.json| Flag | Function | Description |
|---|---|---|
-h, --help |
Help | Show help message |
-v, --version |
Version | Show version information |
-V, --verbose |
Verbose | Enable debug mode |
-c, --config |
Config | Load configuration file |
| Flag | Function | Default |
|---|---|---|
-i, --interval <seconds> |
Sampling interval | 5 seconds |
--cpu-delay <us> |
CPU sampling delay | 200000 Β΅s |
-1, --one-shot |
Run once then exit | - |
| Flag | Function | Default |
|---|---|---|
-l, --logdir <dir> |
Log directory | ~/.status |
-f, --logfile <name> |
Log filename | status.json |
-o, --output <path> |
Override full output path | - |
-m, --maxsize <MB> |
Log rotation size | 10 MB |
--no-log |
Disable file logging | false |
| Flag | Function |
|---|---|
-d, --daemon |
Run in background |
-p, --pidfile <file> |
Path to PID file |
| Flag | Function | Default |
|---|---|---|
-n, --net-interface <iface> |
Network interface to monitor | Auto-detect |
| Flag | Function | Default |
|---|---|---|
-t, --top-processes <N> |
Show top N processes | 0 (disabled) |
| Flag | Function | Default |
|---|---|---|
--disk-mount <path> |
Disk mount point to monitor | / |
| Flag | Function |
|---|---|
-q, --quiet |
No console output |
INI Format (sysmon.ini)
interval = 5
cpu_delay = 200000
logdir = ~/.status
logfile = status.json
maxsize = 10
quiet = false
verbose = false
no_log = false
daemon = false
pidfile =
net-interface =
disk-mount = /
top-processes = 0
one-shot = falseJSON Format (sysmon.json)
{
"interval": 5,
"cpu_delay": 200000,
"logdir": "~/.status",
"logfile": "status.json",
"maxsize": 10,
"quiet": false,
"verbose": false,
"no_log": false,
"daemon": false,
"pidfile": "",
"net-interface": "",
"disk-mount": "/",
"top-processes": 0,
"one-shot": false
}# Normal mode
sysmon
# Daemon mode with custom settings
sysmon -d -i 30 -l /var/log/sysmon -p /var/run/sysmon.pid -q
# Monitor specific interface + top 5 processes
sysmon -n eth0 -t 5 -i 2 -V
# One-time snapshot to file
sysmon -1 -o /tmp/snapshot.json
# Load from config file
sysmon --config /etc/sysmon.ini
# Override config file with CLI flags
sysmon -c sysmon.ini -i 10 -t 518 Arguments Total
- 9 short flags:
-h,-v,-i,-d,-l,-f,-m,-o,-n,-q,-c,-p,-t,-1,-V - 12 long options:
--help,--version,--interval,--daemon,--logdir,--logfile,--maxsize,--output,--net-interface,--quiet,--config,--pidfile,--top-processes,--disk-mount,--cpu-delay,--no-log,--one-shot,--verbose
2 Configuration File Formats (INI & JSON)
Fully backward compatible with the original sysmon
The project is structured for simplicity and modularity:
sysmon.h: Constants, data structures, and function declarations.sysmon.c: Core implementation for CPU, RAM, Disk, and Network tracking.main.c: Entry point handling the main execution loop and signals.Makefile: Standard build instructions.
| Category | Data Captured |
|---|---|
| CPU | Usage % (delta jiffy) and Load Average (1m/5m/15m) |
| RAM | Total, Used, Free, Available, Cached, and Buffers |
| Disk | Total, Used, and Free space on the root (/) partition |
| Network | Active interface, RX (Download) KB/s, and TX (Upload) KB/s |
| System | Uptime (DD:HH:MM:SS) and precise timestamps |
Modify these values in sysmon.h to tune the monitor's behavior:
#define SAMPLE_INTERVAL 5 // Seconds between samples
#define LOG_MAX_BYTES (10L * 1024L * 1024L) // Rotate log at 10 MBEasily parse your system logs for custom dashboards or analysis:
import json
with open("/home/user/.status/status.json") as f:
for line in f:
entry = json.loads(line)
print(f"{entry['time']} | CPU: {entry['cpu_usage']}% | "
f"RAM: {entry['ram']['used']}/{entry['ram']['total']} MB")- OS: Linux with
/procfilesystem support. - Compiler: GCC with C11 support (
gcc >= 4.9). - License: Distributed with MIT License. Feel free to fork, modify, and contribute!