Giter VIP home page Giter VIP logo

sarstats's Introduction

sarstats

Creates a PDF report out of sar files

Written originally by Ray, I cleaned it up to make it more user-friendly, use less memory and make it multi-processor capable.

converting sa files

To obtain the plain-text sar files given a sysstat sa file you can run:

# LC_TIME=POSIX sar -A -t -f /var/log/sa02 > /tmp/sar02

demo

Here you can see how such a pdf looks like: http://acksyn.org/software/sarstats/sar19.pdf And a more complex example (~60MB): http://acksyn.org/software/sarstats/sar01.pdf

The following creates a report off 'sar01' and adds a graph with three datasets (udpsck, rawsck,tcp-tw):

./sarstats --out sar01.pdf --custom 'foo:udpsck,rawsck,tcp-tw' /var/log/sa/sar01

To list the names of all the possible graphs just run:

./sarstats --list /var/log/sa/sar01

To export a single custom graph in svg format run:

./sarstats --output base --svg 'ldavg-1,ldavg-5,ldavg-15' \
  --label 'peak:2014-02-17 14:30:00' demo/var/log/sa/

This will produce the following output: svg_output

It is also possible to print a single graph in ascii format:

./sarstats --ascii 'tcp/s' tests/sar-files/1/sar19

                           tcp/s - tests/sar-files/1/sar19

   0.01 +++A-+--+--A--+--+--A--+-+--+--+--+--A--+--+-+--+--+--+--+--+--A--+++
        |  * +     *     +  *  +    +     +  *  +    +     +   tcp/s **A*** |
        |  *       *        *                *                         *    |
        |  *       *        *                *                         *    |
  0.008 ++ *       *        *                *                         *   ++
        |  *       *        *                *                         *    |
        |  *       *        *                *                         *    |
  0.006 ++ *       *        *                *                         *   ++
        |  *       *        *                *                         *    |
        |  *       **       **               **                        **   |
        | **       **       **               **                        **   |
  0.004 ++**       **       **               **                        **  ++
        | **       **       **               **                        **   |
        | **       **       **               **                        **   |
  0.002 ++**       **       **               **                        **  ++
        | **       **       **               **                        **   |
        | **       **       **               **                        **   |
        | ** +     **    +  ** +    +     +  ** +    +     +     +     **   |
      0 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
           02:00 04:00 06:00 08:0010:00 12:00 14:0016:00 18:00 20:00 22:00
                                        Time

Q&A

  • Q: Why don't you use 'sadf' instead of doing all that parsing?

  • A: sadf does not parse 'older' SA files. So no RHEL 5 and even RHEL 6 files cannot be parsed on a current (F20) Fedora box.

  • Q: I found a bug, where do I report it?

  • A: Drop me an email or open an issue in github

  • Q: Shouldn't you move to PCP or something more capable anyway?

  • A: Yes, as soon as PCP is more widespread

  • Q: In network graphs with bonding the bond interface is never shown?

  • A: Because, depending on the bonding mode, the underlying ethX interface has the exact same traffic patterns and is drawn afterwards

  • Q: When using --maxgraphs 15 on a big sar file (one with many scsi devices for example) I get a traceback with IOError: Cannot open resource "...."

  • A: You are hitting the file number limit due to the many images that are being opened. Increase the limit per user (https://rtcamp.com/tutorials/linux/increase-open-files-limit/)

Thanks

Luca Miccini, Pablo Iranzo Gomez, Ali Sogukpinar, Freddy Wissinger

sarstats's People

Contributors

mbaldessari avatar iranzo avatar beatrubi avatar lmiccini avatar dependabot[bot] avatar freddyrico avatar

Stargazers

 avatar Masayuki Igawa avatar Toheeb Badru avatar  avatar Cole Phillips avatar Matteo Dal Grande avatar Stephane Jourdan avatar  avatar Patrick Dung avatar  avatar  avatar Madan Kv avatar Jota avatar  avatar  avatar Giuseppe Consoli avatar tiago avatar Anachron avatar Dani avatar Masaki Furuta avatar Mikel Olasagasti Uranga avatar  avatar Stephen Kitt avatar  avatar Ahmed Kamal avatar Peter Portante avatar  avatar

Watchers

 avatar James Cloos avatar Selene Ellinoth avatar Dani avatar  avatar

sarstats's Issues

Create a pypi package

Hi,
Do the basics to create it as pypi package so it can be installed quickly with pip, pipsi and variants :-)

Thanks!
Pablo

RFE: Allow the overlapping of data sets from different hosts

Sometimes it would be nice to have several servers systat data combined together in a graph, for example, when diagnosing a OSP controller issue which affects the performance of the platform.

Actually, sarstats accept several datasets, but complains about duplicated data and also draws some lines in vertical at each data point.

Despite of the 'styling' side, it still can be seen two points on the same 'point-in-time' but there's no way to differenciate where this data came from.

Update requirements.txt

Requirements.txt is empty, but the dependencies required are listed in test-requirements

it should list:

  • reportlab
  • matplotlib

Nonetype object has no attribute '__getitem__'

With the introduction of --start --end a bug was introduced with the default 'None' values:

 iranzo  ⋯  var  log  sa  sarstats sar31
Parsing files: sar31Traceback (most recent call last):
  File "/home/iranzo/.bin/sarstats", line 172, in <module>
    sar_grapher = SarGrapher(args.sar_files, args.starttime[0], args.endtime[0])
TypeError: 'NoneType' object has no attribute '__getitem__'

Now, incorrect dates:

 iranzo  ⋯  var  log  sa  1  sarstats sar31 --start '2014-01-01 13:45:03' --end '2014-01-01 13:45:03'
/usr/lib64/python2.7/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
/usr/lib64/python2.7/site-packages/numpy/core/_methods.py:71: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
Parsing files: sar31
Building graphs: Traceback (most recent call last):
  File "/home/iranzo/.bin/sarstats", line 206, in <module>
    True, args.custom_graphs)
  File "/home/iranzo/GSS/DEVEL/sarstats-mbaldess/sar_stats.py", line 291, in graph
    mins = int(sar_parser.sample_frequency / 60)
ValueError: cannot convert float NaN to integer

Specifying a big period:

 iranzo  ⋯  var  log  sa  1  sarstats sar31 --start '2014-01-01 13:45:03' --end '2016-01-01 13:45:03'
Parsing files: sar31
Building graphs: .....................................................................
Wrote: out.pdf

Python3 issue on fedora 24.

If trying to run this on f24 I get error:
./sarstats --list sar18
Parsing files: sar18

Timespan: 2016-11-18 00:01:01 - 2016-11-18 23:53:01
List of graphs available:
Traceback (most recent call last):
File "./sarstats", line 184, in
sar_stats.list_graphs()
File "/home/markus/Downloads/sarstats-master/sar_stats.py", line 446, in list_graphs
for k, v in sar_parser._categories.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

I had to edit sar_stats.py
and change:
for k, v in sar_parser._categories.iteritems():
to:
for k, v in sar_parser._categories.items():

Works fine after that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.