Ksar (Unix sar grapher)
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)(Learn how and when to remove this template message)
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.
- Image can be zoomed by dragging mouse on image to pin point problems
- Results can be exported to PDF or JPEG format
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
- To begin gathering sysstat history information for use of sar command, systat should be configured to run through cron (preferably every minute). More instruction are available on systat web site.
- Generating sar text file with all system resources information
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 a sar data file
(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
- Generating a 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$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')