Ksar (Unix sar grapher)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Stable release
5.2.3 / 30 May 2017; 16 months ago (2017-05-30)
Repository github.com/vlsi/ksar
Operating system cross-platform
Available in java

Ksar is a BSD-licensed Java-based application that creates graphs of all parameters from data collected by Unix sar utilities. Usually, Unix sar is part of Unix' Sysstat package, and runs sa1, sa2, and sadc through cron to created data files in /var/log/sa/saNN. Characteristics include:

  • Images can be zoomed by dragging the mouse on an image to pinpoint problems
  • Results can be exported to PDF or JPEG format

Syntax and options[edit]

Below is the list of CLI options supported by Ksar. Ksar's -help option will list all supported options of the applicable Ksar version.

$ java -jar kSar.jar -help
kSar version: 5.0.6
-version: show kSar version number
-help: show this help
-[[input (computing)|input]] <arg>: [[Argument (computer programming)|argument]] must be either ssh://user@host/command or cmd://command or file://path/to/file or just /path/to/file
-graph <graph list>: space separated list of graph to be output
-showCPUstacked: will make the [[CPU]] used graph as stacked
-showMEMstacked: will make the memory graph as stacked ([[Linux]] only)
-cpuFixedAxis:  will graph CPU used with fixed axis from 0% to 100%
-showIntrListstacked : will make the Interrupt List graph as stacked
-showTrigger:  will show trigger on graph (disabled by [[Default (computer science)|default]])
-noEmptyDisk: will not export disk with no data
-tile: will tile [[Window (computing)|window]]
-userPrefs: will use the userPrefs for outputing graphs (last export of this host)
-showOnlygraphName: will only print graph name available for that data (to be use for -graph)
-addHTML: will create an [[HTML]] page with [[PNG]]/[[JPG]] image
-outputPDF <pdf file> : output the pdf report to the pdf file
-outputPNG <base filename> : output the graphs to PNG file using argument as base filename
-outputJPG <base filename> : output the graphs to JPG file using argument as base filename
-outputCSV <CSV file> : output the [[CSV]] file
-width <size> : make JPG/PNG with specified width size (default: 800)
-height <size> : make JPG/PNG with specified height size (default: 600)
-startdate <date> : will graph the range beginning at that time
-enddate <date> : will graph the range until that date
-solarisPagesize <pagesize in B>: will set [[solaris]] pagesize
-[[Wizard (computing)|wizard]]: open with unified [[login]] popup
-replaceShortcut <xml file>: replace all [[shortcut (computing)|shortcuts]] with those in the [[.xml]] file
-addShortcut <xml file>: add shortcut from the xml file
-startup: open window marked for opening at [[booting|startup]]

Generating SAR Text Files for Ksar Use[edit]

  • To begin gathering sysstat history information for use of the sar command, systat should be configured to run through cron (preferably every minute). More instructions are available on the systat web site.
  • Generating sar text file with all system resources information
     LC_ALL=C sar -A -f /var/log/sa/sa$DT > /tmp/sar-$(hostname)-$DT.txt
     ls -l /tmp/sar-$(hostname)-$DT.txt
  • Generating only disk information from a sar data file
    (Note that sar will collect disk information only if sadc is running with -d option thru cron)
     LC_ALL=C sar -d -p -f /var/log/sa/sa$DT > /tmp/sar-$(hostname)-$DT.txt
     ls -l /tmp/sar-$(hostname)-$DT.txt
  • Generating a text file for multiple days
     DT="12 13 14"	
     for i in $DT; do
       LC_ALL=C sar -A  -f /var/log/sa/sa$i >> /tmp/sar-$(hostname)-multiple.txt
     ls -l /tmp/sar-$(hostname)-multiple.txt

For getting all the days in the default folder, you can replace the harcoded DT variable with:

 DT=$(ls /var/log/sa/sa[0-9][0-9] | tr '\n' ' ' | sed 's/\/var\/log\/sa\/sa/ /g')

See also[edit]

External links[edit]