Software:Ksar (Unix sar grapher): Difference between revisions

From HandWiki
(update)
 
(import)
 
Line 1: Line 1:
{{Short description|Application to create graphs for Unix utilities}}
{{Infobox software
{{Infobox software
| name = Ksar
| name = Ksar
Line 20: Line 19:
| repo = {{URL|https://github.com/vlsi/ksar}}
| repo = {{URL|https://github.com/vlsi/ksar}}
| programming language =  
| programming language =  
| operating system = cross-platform
| operating system = [[Cross-platform|cross-platform]]
| platform =  
| platform =  
| size =  
| size =  
Line 34: Line 33:
}}
}}


'''Ksar''' is a [[Software:BSD licenses|BSD-licensed]] [[Java (programming language)|Java]]-based application that creates graphs of all parameters from [[Data|data]] collected by [[Software:Sar (Unix)|Unix sar]] utilities. Usually, Unix sar is part of [[Software:Unix|Unix]]' Sysstat package, and runs sa1, sa2, and sadc through [[Software:Cron|cron]] to created [[Data file|data file]]s in /var/log/sa/saNN. Characteristics include:
'''Ksar''' is a [[Software:BSD licenses|BSD-licensed]] [[Java (programming language)|Java]]-based application that creates graphs of all parameters from [[Data|data]] collected by [[Software:Sar (Unix)|Unix sar]] utilities. Usually, Unix sar is part of [[Software:Unix|Unix]]' [[Software:Sysstat|Sysstat]] package, and runs sa1, sa2, and sadc through [[Software:Cron|cron]] to created [[Data file|data file]]s in /var/log/sa/saNN. Characteristics include:


* Images can be zoomed by dragging the mouse on an image to pinpoint problems
* Images can be zoomed by dragging the mouse on an image to pinpoint problems
* Results can be exported to PDF or [[JPEG]] format
* Results can be exported to [[Portable Document Format|PDF]] or [[JPEG]] format


==Syntax and options==
==Syntax and options==
Below is the list of [[Command-line interface|CLI]] options supported by Ksar. Ksar's -help option will list all supported options of the applicable Ksar version.
Below is the list of [[Command-line interface|CLI]] options supported by Ksar. Ksar's -help option will list all supported options of the applicable Ksar version.


<source lang="console">
<syntaxhighlight lang="console">
$ java -jar kSar.jar -help
$ java -jar kSar.jar -help
kSar version: 5.0.6
kSar version: 5.0.6
Line 73: Line 72:
-addShortcut <xml file>: add shortcut from the xml file
-addShortcut <xml file>: add shortcut from the xml file
-startup: open window marked for opening at [[Booting|startup]]
-startup: open window marked for opening at [[Booting|startup]]
</source>
</syntaxhighlight>


==Generating SAR Text Files for Ksar Use==
==Generating SAR Text Files for Ksar Use==
* 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 [http://sebastien.godard.pagesperso-orange.fr/documentation.html the systat web site].
* 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 [http://sebastien.godard.pagesperso-orange.fr/documentation.html the systat web site].
* Generating sar text file with all system resources information
* Generating sar text file with all system resources information
*:<source lang="sh">
*:<syntaxhighlight lang="sh">
  DT="10"
  DT="10"
  LC_ALL=C sar -A -f /var/log/sa/sa$DT > /tmp/sar-$(hostname)-$DT.txt
  LC_ALL=C sar -A -f /var/log/sa/sa$DT > /tmp/sar-$(hostname)-$DT.txt
  ls -l /tmp/sar-$(hostname)-$DT.txt
  ls -l /tmp/sar-$(hostname)-$DT.txt
</source>
</syntaxhighlight>
* Generating only disk information from a sar data file
* 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)
*:(Note that sar will collect disk information only if sadc is running with -d option thru cron)
*:<source lang="sh">
*:<syntaxhighlight lang="sh">
  DT="10"
  DT="10"
  LC_ALL=C sar -d -p -f /var/log/sa/sa$DT > /tmp/sar-$(hostname)-$DT.txt
  LC_ALL=C sar -d -p -f /var/log/sa/sa$DT > /tmp/sar-$(hostname)-$DT.txt
  ls -l /tmp/sar-$(hostname)-$DT.txt
  ls -l /tmp/sar-$(hostname)-$DT.txt
</source>
</syntaxhighlight>
* Generating a text file for multiple days
* Generating a text file for multiple days
*:<source lang="sh">
*:<syntaxhighlight lang="sh">
  DT="12 13 14"
  DT="12 13 14"
  >/tmp/sar-$(hostname)-multiple.txt
  >/tmp/sar-$(hostname)-multiple.txt
Line 98: Line 97:
  done
  done
  ls -l /tmp/sar-$(hostname)-multiple.txt
  ls -l /tmp/sar-$(hostname)-multiple.txt
</source>
</syntaxhighlight>
For getting all the days in the default folder, you can replace the hardcoded DT variable with:
For getting all the days in the default folder, you can replace the hardcoded DT variable with:
<source lang="sh">
<syntaxhighlight lang="sh">
  DT=$(ls /var/log/sa/sa[0-9][0-9] | sed 's_/var/log/sa/sa_ _g' | xargs)
  DT=$(ls /var/log/sa/sa[0-9][0-9] | sed 's_/var/log/sa/sa_ _g' | xargs)
</source>
</syntaxhighlight>


==See also==
==See also==

Latest revision as of 17:29, 21 June 2024

Ksar
Stable release
5.2.3 / 30 May 2017; 7 years ago (2017-05-30)
Repositorygithub.com/vlsi/ksar
Operating systemcross-platform
Available injava

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

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
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 to be output
-showCPUstacked: will make the CPU used graph as stacked
-showMEMstacked: will make the memory graph as stacked ([[Software:Linux|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 outputting 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|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

  • 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
    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 hardcoded DT variable with:

DT=$(ls /var/log/sa/sa[0-9][0-9] | sed 's_/var/log/sa/sa_ _g' | xargs)

See also

External links