I am running sar (sadc/sadf) to collect CPU/memory/etc statistics on a server. I often want to quickly draw a histogram showing how the data evolved during the day, so that I can visually spot anomalies.

I could export the data and make a graph with LibreOffice/etc, but I can't because:

  • Any data on that server must be considered confidential.
  • The server is accessed via several layers of jump servers, so transferring a file takes a lot of time and typing scp passwords.
  • The firewall does not let Web traffic through either, so a Web UI is not possible.

So, I would love a command-line tool that produces a console ASCII graph:

▄ ▁ █ ▇ ▄ ▆ ▅ ▇ ▇ ▇ ▇ ▇ ▄ ▃ ▃ ▁ ▃ ▂


  6|   o
  5|   o   o
  4|   o   o o
  3|   o o o o   o
  2|   o o o o   o
  1|   o o o o   o                     o       o
  0|   o o o o o o           o     o   o o   o o
   |   o o o o o o           o     o   o o   o o

The sadc data is stored in a strange format that tends to change at major releases, but using the sadf command it can be exported to either CSV or XML. The CSV looks like this:

# hostname;interval;timestamp;CPU;%user;%nice;%system;%iowait;%steal;%idle[...]
MyHost;598;2018-04-02-03:00:01 UTC; -1; 2.08, 0.00; 0.24; 0.28; 0.00; 97.37 
MyHost;599;2018-04-02-03:10:01 UTC; -1; 2.38, 0.00; 0.27; 0.52; 0.00; 95.94 

Ideally it would generate a histogram for CPU, a histogram for %user, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.