Ksar (unix sar grapher)

A BSD licensed java based application to create graph of all parameters from the data collected by unix sar utilities. Usually unix sar is part of unix sysstat package and run sa1,sa2,sadc thry cron to created data files in /var/log/sa/saNN

  • Image cab be zoomed by dragging mouse on image to pin point problems
  • It can be ported to pdf or jpg formate

Getting Ksar

Latest version (5.0.6) of ksar can be downloaded from the ksar project page.

http://sourceforge.net/projects/ksar/

Syntax and Options

Below are the list of CLI option supported by ksar. Ksar's -help option will list all supported option of used ksar version.

# java -jar kSar.jar -help

Basic Options
-version: show kSar version number
-help: show this help
-input 
  argument must be either 
       ssh://user@host/command or 
       cmd://command or
       file://path/to/file or 
       just /path/to/file

Data Related Optiona
-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)
-noEmptyDisk: will not export disk with no data


Output File Types Options
-outputPDF  : output the pdf report to the pdf file
-outputPNG  : output the graphs to PNG file using argument as base filename
-outputJPG  : output the graphs to JPG file using argument as base filename
-outputCSV  : output the CSV file

Image Related Options
-graph : space separated list of graph you want to be outputed
-width  : make JPG/PNG with specified width size (default: 800)
-height  : make JPG/PNG with specified height size (default: 600)
-startdate  : will graph the range beginning at that time
-enddate  : will graph the range until that date

Misc Options
-tile: will tile 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
-solarisPagesize : will set solaris pagesize
-wizard: open with unified login popup
-startup: open window marked for opening at startup

ShortCut Options
-ClearAllPrefs : Clear all the preferences
-replaceShortcut : replace all shortcut with those in the xml file
-addShortcut : add shortcut from the xml file

Generating sar text file for Ksar use

  • To begin gathering sysstat history information for use of sar command, systat should be confugured to run thru cron (preferably in every minute). More instruction on systat web site.

http://sebastien.godard.pagesperso-orange.fr/documentation.html

  • Generating sar text file with all system resources info

DT="10"
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 sar data file

(Note that sar will collect disk inforamtion only if sadc is running with -d option thru cron)

DT="10"
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 text file for multiple days

DT="12 13 14"  
>/tmp/sar-$(hostname)-multiple.txt 
for i in $DT; do
  LC_ALL=C sar -A  -f /var/log/sa/sa$DT >> /tmp/sar-$(hostname)-multiple.txt
done
ls -l /tmp/sar-$(hostname)-multiple.txt

Generating Graph

  • To just open the ksar (data file can be loaded by selecting menu option)

java -jar kSar.jar

  • To generate graph from a sar text file

java -jar kSar.jar  -input sar-$(hostname)-$DT.txt

  • Generate graph but exclude disks information having no I/O

java -jar kSar.jar  -noEmptyDisk -input sar-$(hostname)-$DT.txt

  • Generate Graph and show ThreshHold Trigger

java -jar kSar.jar -showTrigger -noEmptyDisk -input sar-$(hostname)-$DT.txt

  • Save graphs in pdf file

java -jar kSar.jar -noEmptyDisk -input sar-$(hostname)-$DT.txt -outputPDF sar-$(hostname)-$DT.pdf

Known Issue

Sometime due to unknown reason multiple day graph is not being generated.

See Alo

Sar in UNIX