Ksar (Unix sar grapher)

Ksar is 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 through cron to created data files in /var/log/sa/saNN.

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
 kSar version: 5.0.6
Usage: 
-version: show kSar version number
-help: show this help
-input <arg>: 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 you want to be outputed
-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
-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
-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: open with unified login popup
-replaceShortcut <xml file>: replace all shortcut with those in the xml file
-addShortcut <xml file>: add shortcut from the xml file
-startup: open window marked for opening at startup

Generating sar text file for Ksar use

http://sebastien.godard.pagesperso-orange.fr/documentation.html
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

(Note that sar will collect disk information 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
DT="12 13 14"	
>/tmp/sar-$(hostname)-multiple.txt	
for i in $DT; do
  LC_ALL=C sar -A  -f /var/log/sa/sa$i >> /tmp/sar-$(hostname)-multiple.txt
done
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

This article is issued from Wikipedia - version of the 3/21/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.