larryjeong
Member
OP
- Joined:
- Jun 2024
- Posts:
- 179
- From:
- Texas, US
Spent $0 on this. Just needed to see my procs on a $3/yr cpanel box without getting killed by oom. Its called ltop. Reads /proc directly. No ncurses. Outputs plain text you can grep.
The whole thing is 180 lines of c. Uses 40kb rss. Shows cpu mem and elapsed time per user. Skips system procs so you only see your own stuff.
I run it on 6 hosts now. Definitely beats waiting 30 seconds for regular top to draw on a oversold node.
Source is on my gitea. No license do what u want
$3/year. 128MB RAM. Pure happiness.
tomchan
Member
- Joined:
- Jul 2024
- Posts:
- 202
- From:
- Bristol, UK
Fun little project larry, it actually works
Tried it on my Kimsufi box from OVHcloud and it compiled clean with just gcc and musl. Had to tweak the uid detection for the openvz container though, the /proc ownership is weird there
--- ltop.c.orig 2025-05-27 12:00:00.000000000 +0000
+++ ltop.c 2025-05-27 14:33:00.000000000 +0000
@@ -45,7 +45,7 @@
if (ent->d_type != DT_DIR) continue;
int pid = atoi(ent->d_name);
if (pid <= 0) continue;
- snprintf(path, sizeof(path), "/proc/%d/status", pid);
+ snprintf(path, sizeof(path), "/proc/%d/status", pid);
// check Uid: line against getuid()
The openvz patch is basically just handling missing fields gracefully. Want me to pr this or just drop it here?
works on my bench ¯\_(ツ)_/¯