You are not logged in.
Pages: 1
New X11 version in post 2.
I'm using a tiling WM again (the latest nvidia fixed resolution switch crashes which forced me to use compiz for its zoom), and I don't want to use conky or a statusbar.
So now I use one terminal for system monitoring. And now that it looks really cool I thought I'd share it.
It uses three scripts. Last updated 2011-03-18 (fixed a bug in closing the os.popen object in colorwatch.py, fixed another bug in colorwatch.py when resizing the screen and napping)
curl http://sprunge.us/SUNC > graph_cpu; chmod +x graph_cpu
curl http://sprunge.us/aHeH > grapher; chmod +x grapher
curl http://sprunge.us/iNCR > colorwatch.py; chmod +x colorwatch.py
graph_cpu
It writes the date and a number to a file in /dev/shm/graph_* for download, upload, CPU% and MEM%.
Maybe it's a good idea to combine these files, because that makes adding new values easier.
The date is in unix time, because that makes it easier for gnuplot.
grapher
I am new to gnuplot, so there may be more things to do here. Especially interesting for improvement is not using bash at all, collecting the values inside gnuplot, using reread instead of watch and using an X11 graph.
When changing things mind that sed is used to color the graphs and to remove empty lines and columns. Gnuplot is then fooled into thinking the terminal is bigger than it really is.
The right axis is made yellow so it's easy to see that it belongs to the yellow CPU graph (the blue MEM does too).
The left axis is logarithmic. This and its range is something you may want to edit.
Most important for this file is the $TITLE configuration.
What I have gone for is "show only if bad" for CPU temperature, governor and disk space.
Combined with the timezones makes for a very idiosyncratic configuration!
colorwatch.py
This is a replacement for watch that can do colors (in this case only basic \e[31m codes, it doesn't work with `ls` for example, which uses \e[1;31m)
Argument 1 is the time to wait in seconds.
Argument 2~ is the command with its arguments.
The napms() approach is a bit weird. It doesn't quit after ^C until the nap is finished! getch() with a delay would be better, but I'm not sure which of these two is easier on resources... For now it wakes up 10 times in a nap. (fixed in 2011-03-18)
Last edited by Procyon (2011-03-25 04:23:41)
Offline
All-in-one, X11. Ignore the entire above post unless you want console plots.
curl http://sprunge.us/caGc > plotmonitor; chmod +x plotmonitor
Offline
The x11 version is causing trouble.
Every time when it draws a plot, the text you have selected becomes unselected. In GTK applications you won't notice it but your paste buffer will be different from what you expect.
wxt does not pop up like this, but I don't know how to change colors or remove the toolbars.
On the other hand, I am not getting screen flashes from poor performance from the ascii terminal without ncurses (I had initially presumed an ncurses wrapper would be necessary).
curl http://sprunge.us/VPWF > plotmonitor; chmod +x plotmonitor
This version supports setting your own terminal (plotting surface).
If you aren't bothered by the interruptions in X11:
plotmonitor x11
If you don't mind wxt
plotmonitor wxt
Otherwise
plotmonitor dumb
The dumb terminal pipes a continuous stream of plots through sed. It might need a -u flag so it flushes more often. I get a lot of flushing issues when I pipe it further through awk and tr. I'm not sure if it's possible to get rid of the last blank line.
One new feature in this version is increased accuracy by looping only on the whole second using:
sleep 0.$((1000000000 - $(date +%-N) ))s
Unlike sleep 1, this won't continuously add up the time it takes to run the code in the loop. Which for my machine is somewhere from 0.045 to 0.055 seconds.
Offline
This is terrific. Thanks!
Offline
Offline
I assume this is supposed to be run as:
./colorwatch.py 1 ./grapher
If so, it doesn't work for me. It displays it once, and doesn't update it.
Last edited by neurolysis (2011-05-06 11:30:07)
Offline
If it works well without ncurses, use the link in post #3 (I use this one). It can be run like this: ./plotmonitor dumb
Offline
Someone forum-mailed me asking for a reupload of a terminal version.
I'll just upload the last one, I don't think any of them had ncurses. You can run it with ./plotter dumb
Sour about sprunge.us deleting pastes.
If you have any questions, I'll try to answer them, but I haven't used it in a long time.
Offline
Maybe you could put this in AUR, so that this post doesn't end up at the bottom somewhere and get lost.
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
Pages: 1