Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
my friend presents me with a problem. he uses sshfs on a raid system and wants conky to display processor usage, ram usage, and hard drive(raid) usage.
i looked on google, they suggested using x11 forwarding. good idea, but theres alot of overhead with x11 forwarding, and the fact of having to install X on a HEADLESS server!
my response to him involved using sshfs to mount the remote systems proc directory to his local system. this however does not work, yet regular ssh into the machine does.
furthermore i would need to plan out commands to refresh its memory usage, processor usage, and disk usage as my conky script is looking like its using local system commands only.
can someone throw a life ring as i run remote systems also, and that its a GREAT IDEA TO MONITOR THEM ON THE ONE IM ON!!!!
ran as a cron job = a file created and updated reporting disk usage that sshfs can print... i know i dont need it updated every 2 seconds. minute by minute cron job of that would work fine for my situation. telling me the % of the disk being used. the head and tail would need adjusting on a system by system basis based on what the DF line you wanted printed.
now i gotta figure out a command to say what the processor usage is
i can easily write the memory free and memory total command to print those infos to a file, but im completely baffled on how to get the command line to print exactly how much cpu is in use at that exact moment of time.
im not looking for TOP... i would like to know how to do all combined processors, and have it print in a "60%" in use type way. i tried some commands under no load and under full load.
uptime gives me anywhere from 0.01 to 4.00? from nothing to full blast, im not a computer i want a %
iostat, sar from sysstat ...all can be integrated in cron jobs to output results in files etc etc
don't really see a problem here
don't really know conky's dependencies ...but you don't have to install x11 on the headless server ..only on the client machine from which you ssh into the server.
on the server you only install conky
From client:
ssh -X user@server conky
I run vmware workstation with ssh x forwarding over wan links....and it runs great
Last edited by ddaemonunics; 04-07-2010 at 07:38 AM.
i dont want conky, x, or x forwarding on the server....
my gnome system monitor on the client says 65% of processor in use, iostat of the client gives a bunch of random values compared to that.
my problem is this part of your post
Code:
ssh -X user@server conky
i would rather run sshfs to mount a directory of cron jobs dumping cpu, mem, and disk usage to a directory with 3 files. 1 for proc usage, 1 for memory usage, 1 for disk drive usage.
-X Enables X11 forwarding. This can also be specified on a per-host
basis in a configuration file.
server is headless, does not have x, does not want x... do not want to install 100s of x packages chewing up ram, hard drive space, boot time, bandwidth (forwarding video when it can be forwarding plain text), or processor cycles.
#!/bin/bash
# by Paul Colby (http://colby.id.au), no rights reserved ;)
# modified by a drunken penguin to take a simple snapshot of cpu usage
PREV_TOTAL=0
PREV_IDLE=0
CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
unset CPU[0] # Discard the "cpu" prefix.
IDLE=${CPU[4]} # Get the idle CPU time.
# Calculate the total CPU time.
TOTAL=0
for VALUE in "${CPU[@]}"; do
let "TOTAL=$TOTAL+$VALUE"
done
# Calculate the CPU usage since we last checked.
let "DIFF_IDLE=$IDLE-$PREV_IDLE"
let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"
echo "CPU: $DIFF_USAGE%"
exit
i rephrased the problem, and found a bash script....
it was giving constant updates and printing oddly so i modified it to suit my purpose
Last edited by ninja master; 05-07-2010 at 03:42 PM.
Hello ninja master. I had the same problem you are describing, and so I wrote a program for this very purpose: Conkw. It stands for web based conky.
This is a program that, like conky, can monitor many vitals on your system but also all sorts of stuff (stocks, weather, etc) and exposes a REST API with all the data. It can also monitor a Windows or a MacOS machine.
There is also a HTML UI to display your stuff on any browser. The goal was to find some use to the old ipads/tablets we all have lying around. You can put them next to your screen and have your metrics displayed there. More real estate for the real work on your main screens!
But the network-based communication btw UI and API make it trivial to monitor another computer. In fact, you can build a mesh network and have metrics of plenty of different machines on the same UI.
It's still very much under development but I've been using it constantly for about 6 month now, so it works well.
Conky also has a configuration setting 'out_to_http', which makes it "act as a small http-server serving its text".
So you can run your conky remotely, producing properly formatted html output, and look at it with, say, a web browser.
Conky also has other options to accomplish the same.
BTW, gkrellm has this functionality built in, i.e. you can run a local gkrellm instance that displays remote gkrellmd data.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.