Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to monitor CPU and network utilisation from a terminal.

For network traffic, I have found the perfect tool: slurm. It gives me a moving chart. It gives me an nCurses-like UI I can use from a tty.

Here's a screenshot: slurm 0.3.3 on Falce

Is there a slurm equivalent showing CPU utilisation?

share|improve this question
1  
htop? Though it's not as pretty/big as slurm's chart, see the second PNG from bottom at htop.sourceforge.net/index.php?page=screenshots –  livibetter Nov 28 '12 at 23:03
    
That's what I use at the moment: htop. And I love it for process monitoring. For utilisation charts? ASCII art just doesn't cut it, does it? –  Robottinosino Nov 29 '12 at 13:12

2 Answers 2

I couldn't find a live, text-only CPU chart either. So, I made one.

Here's a link to my github repo: https://github.com/rigel314/ttysys

Try it out if you like, and please report any errors on my repo's issues page.

EDIT:

Screenshot:

ttysys example

Install:

You will have to compile it from source. I provided a simple makefile that calls gcc.

You can run the program using make then ./build/target/ttysys Alternatively, you can run make install followed by ttysys since it is in your path now.

Usage:

  • ? - Displays a help window.
  • h - Split current window horizontally.
  • v - Split current window vertically.
  • u - Un-split current window.
  • Tab - Move to next window in order of creation.
  • Arrow Keys - Move to next window on screen in direction pressed.
  • Numbers 0 - 9 - Select a data source for a window.
    • 0 will set the data source to an overview, and 1 - 9 set it to a specific core.
  • g - Toggle grid for selected window.
  • e - Toggle value display in current window's title.
  • t - Toggle display of current window's title bar.
  • l - Toggle display of current window's label sidebar.
  • q - Quit this program.

How it works:

It works by reading the first few lines in /proc/stat that begin with cpu.
man 5 proc explained the meaning of contents of /proc/stat.
These lines tell you how much time each CPU spent in different states. The sum of each line is the total time spent for each CPU. I read this file twice with a second in between. Then, I subtract the two totals to have the total CPU time spent during my sleep(). Now, I add the user and system numbers together and divide by my difference. Finally, it's just a matter of displaying it nicely.

share|improve this answer
1  
Nice work. Could you include a screenshot here and also a bit more about the tool? We like answers to be able to stand on their own and not just be links. Great job on the tool BTW. –  slm Dec 28 '13 at 3:15
    
Good job. I've made one myself although much less features. None to be exact :) github.com/mnmnc/cpuchart –  mnmnc Oct 30 at 14:13

Take a look at Glances. I think it might fit your bill.

http://nicolargo.github.com/glances/

share|improve this answer
    
Looks very cool. Will have to wait until it graduates to the Ubuntu package list, though. I could use something from the standard apt-get repository (no addition of a PPA) with less functionality but full support... –  Robottinosino Nov 29 '12 at 13:07
    
No need to wait, just grab the script and run it. It looks like a single script program. If not, use pip to install it. –  livibetter Nov 29 '12 at 13:41
    
It's based on python, pretty standard. –  Mark Cohen Nov 29 '12 at 17:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.