6

I'm currently writing a cronjob around kSar's command line (non-GUI) options in order generate PDF's. I'm just going to email a PDF of the previous day's activity to a different webmaster (basically just a power user) every day after midnight.

This is the command I'm trying to use:

java -jar /usr/local/ksar/kSar.jar -cpuFixedAxis \ 
      -input /var/log/sa/sa$(date +"%d" -d yesterday) \
      -outputPDF /tmp/SAR-$(date +"%d-%m-%Y" -d yesterday).pdf

The above properly generates a PDF document and I can email it to whomever I want.

Problem is that there's a lot more information on there than I really think he needs and I really see him getting confused and either asking me to help him understand it or just disregarding the email and pinging me personally whenever he has a question about load or performance (which will be a lot).

I'm seeing that kSar has a -graph option for generating only a certain subset of graphs, but I have no idea how to use it, and it's not online anywhere. -help says to feed it a list of the graphs I want to generate but there's no indication of how I'm supposed to figure out what each graph is technically called. I thought -showOnlygraphName was my savior, but that just popped up the regular non-PDF GUI for the relevant SAR and it looks identical to if I had left -showOnlygraphName to begin with.

At this point I'm grasping at straws so any help would be appreciated.

EDIT:

Just so you you can see the syntax I'm using when I say in the comments that I've tried the graph names @derobert suggested:

$ java -jar kSar.jar -graph SWAP -input sar31 -outputPDF out.pdf
time to parse: 695ms number of line: 4073 line/msec: 5.0
jadavis@XXX-R9ZN2ZV /cygdrive/c/Documents and Settings/JADAVIS/Documents/kSar-5.0.6
$ echo $?
0
jadavis@XXX-R9ZN2ZV /cygdrive/c/Documents and Settings/JADAVIS/Documents/kSar-5.0.6
$ ls out.pdf
ls: cannot access out.pdf: No such file or directory
$ java -jar kSar.jar -graph LOAD -input sar31 -outputPDF out.pdf ; ls out.pdf
time to parse: 681ms number of line: 4073 line/msec: 5.0
ls: cannot access out.pdf: No such file or directory

What's directly above is being done in cygwin, but the syntax works (i.e generates PDF output) if I just don't try to restrict which graphs to generate. I've also tried a variety of casings and quotation styles.

EDIT #2:

Partial success in this area. I found this page and following its instructions I was able to generate a PDF that only had CPU activity in it:

jadavis@XXX-R9ZN2ZV /cygdrive/c/Documents and Settings/JADAVIS/Documents/kSa                            r-5.0.6
$ java -jar kSar.jar -input sar31 -outputPDF out.pdf -graph all-cpu; ls -l out.pdf                          time to parse: 712ms number of line: 4073 line/msec: 5.0
-rwx------+ 1 jadavis mkpasswd 112772 Apr  3 18:51 out.pdf
8
  • 2
    This is when you grasp at the source code :-( ... sourceforge.net/p/ksar/code/HEAD/tree/trunk/kSar/src/Linux.xml looks promising. Note all the <graphname>X</graphname> in there... maybe that's the names you're looking for?
    – derobert
    Commented Apr 1, 2014 at 21:54
  • @derobert tried a few of them and it parses correctly with no errors printed, but it doesn't generate a PDF file. I'm assuming that it's not generating it because it would be empty (probably because it's not matching the graph names I'm giving it anything).
    – Bratchley
    Commented Apr 1, 2014 at 22:11
  • I tried the follow with a variety of casings: KMEM, PROC, LOAD, SWAP. I know each of those graphs have information in them (from the full rendering) so it must be that the string I'm giving it isn't matching.
    – Bratchley
    Commented Apr 1, 2014 at 22:13
  • I had a look at the source code, however it seems that the CLI has been removed in the 5.1.x beta versions and this is all that there is code available for on the sourceforge site. Only the .jars are available for the older versions. At a guess you could try all-swap, all-load etc and see what that produces. Or try emailing the developer, he could at least send you source code for the stable version.
    – Graeme
    Commented Apr 4, 2014 at 12:56
  • Do you know if there's a decent java decompiler that runs on RHEL? If I can see how it does a comparison for values given to -graph then I might be able to get a list together.
    – Bratchley
    Commented Apr 4, 2014 at 13:16

2 Answers 2

2

Here's the list of -graph options available in kSar v5.0.6 -

all-cpu
bond0-if1
bond0-if2
eth0-if1
eth0-if2
eth2-if1
eth2-if2
LinuxcswchSar
LinuxioSar
LinuxkbmemSar
LinuxkbmiscSar
LinuxkbswpSar
LinuxloadSar
LinuxnfsdSar
LinuxnfsSar
LinuxpageSar
LinuxpgpSar
LinuxprocSar
LinuxsockSar
LinuxswapSar
lo-if1
lo-if2

Here's an example of how I generate a report -

java -jar kSar.jar -input /apps/kSar-5.0.6/logs/sa01 -showCPUstacked -cpuFixedAxis -graph 'all-cpu bond0-if1 LinuxcswchSar LinuxioSar LinuxkbmemSar LinuxloadSar LinuxpgpSar LinuxprocSar'   -outputPDF /apps/kSar-5.0.6/logs/sa01.pdf
1

The answer that isn't really an answer: For those following along at home, you'll noticed I've had a heck of a time trying to get kSar to do this for me. I don't doubt that there actually is a solution with kSar but I've come to the hard earned conclusion that kSar just kind of sucks. I don't work with non-Linux platforms anymore (used to manage Solaris, not so much now) so any advantage of using SAR data is now negligible if it still exists at all.

My personal solution:

I've since re-focused my energies on getting this to work with collectd and have in the last 30 minutes had much more success than I've had in three days with off-and-on struggles with kSar. This is what I did on my RHEL5 and RHEL6 servers (obviously YMMV):

1. Ensured the EPEL repository is installed on the server.

2. Installed the collectd, collectd-web, collectd-apache, and collectd-mysql packages.

3. Edited the /etc/httpd/conf.d/collectd.conf file as follows:

ScriptAlias /collectd/bin/ /usr/share/collectd/collection3/bin/
Alias /collectd/ /usr/share/collectd/collection3/

<Directory /usr/share/collectd/>
AddHandler cgi-script .cgi
DirectoryIndex bin/index.cgi
Order Deny,Allow
Deny from all
Allow from 192. 10.
</Directory>

4. Ensured the following plugins were enabled in /etc/collectd.conf:

LoadPlugin apache
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin fscache
LoadPlugin interface
LoadPlugin load
LoadPlugin memory

5. Started the collectd service and issued a service httpd reload command.

Waited a short sample period, and access collectd-web (third part web-interface written in perl) by visiting:

  • http://MYHOSTNAME/collectd/bin/index.cgi

Shortly thereafter I was generating all the charts he'd be interested in seeing and none of it would likely confuse him. I'm also seeing that some collectd stats can get detail oriented so it may be useful for my purposes as well.

The collectd-web interface is fully functional but pretty plain looking and hard to customize. Still it's definitely easier to just give him this URL so I'll just play around with different frontends.

Should someone post a kSar specific answer (or if I find one in the mean time) I'll accept that as the answer. But ultimately I think it's time to just place a single black rose on SAR's coffin and finally just let it die.

EDIT:

For the curious here are some sample random charts:

collectd-web generated charts

There are also some charts for queue merges and filesystem utilization for disks, and run queue size and context switches for CPU. It also appears to support notification on threshold violations. So it appears to be a fairly decent tool for general purpose performance monitoring and capacity planning.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .