Hi Michele,
----- Original Message -----
> Hi all,
>
> sometime ago I co-wrote a tool that created a pdf report of
> all the metrics contained in a sar file [1]. I've now done
> the same for PCP archives:
> https://github.com/mbaldessari/pcpstats
Neat idea!
> It's still in its very early stages and the code is littered
> with FIXMEs, but it does create half-decent pdf [2] files already,
> so I thought I'd share this.
>
> Feedback or suggestions are welcome.
Sure - some initial thoughts:
- There's a comment somewhere about generating a table for string
metrics like filesys.mountdir - sounds a good plan, you might also
be able to cluster together within the table metrics that share an
indom (pmDesc.indom)
- I think the SKIP_GRAPHS array might more generically be described
as "all metrics with pmDesc.type == PM_TYPE_STRING or pmDesc.sem ==
PM_SEM_DISCRETE"? (then, no need to hard-code a list of names that
will get out-of-date)
- Values of counter semantics metrics (PM_SEM_COUNTER) are commonly
reported after rate conversion (requires successive samples, and
the value plotted is the value-delta divided by the time-delta), so
that MB/sec, or utilizations, are reported instead of raw values.
- Consider using pmOptions class for command line processing - it'll
automate some stuff for you (and add common, missing options - $TZ
handling, interval, #samples, -A/-O/-S/-T - parsing them the same
way all the other PCP tools do. e.g. the start/end parsing here uses
dateutil.parser.parse whereas PCP tools use libpcp magic which allows
several alternative types of syntax (absolute times, relative times,
and recently free-form times like "yesterday, 10am"). Its also all
done below the option-processing API, so you don't have to manually
handle it.
- The options stuff also ties into context creation, so you can take
your pmOptions object and pass it to pmapi.ctx.fromOptions() and you
get back a pmContext class all correctly setup and ready to go (it'll
open the archive(s) passed in).
- There is a plan to add a mode to libpcp on archive context creation
where it will open a directory (like code here wishes to) and produce
a context which sources data from all archives in that directory.
When that work is tackled, it may simplify the mode you have here
(planned?) where it scans a directory for pcp archives.
- More future work that might help (less distant though :) - there's
a current effort underway to make the Convenience Class python module
work and take on alot more of the effort that python client tools are
still having to do (as you've found here). Things like converting
counters to rates, improved caching (pmDesc, indoms/inst names, etc,
etc), things like that. ... pmAtomValue -> python type conversions
too, the sorts of things you needed to do in PcpArchive.get_values()
... any things you've discovered in your hacking so far as "nice to
have" from such a module, please point 'em out (and feel free to help
scox & I out with hacking in that module too :) - this is "pcp.pmcc"
in the tree at src/python/pcp/pmcc.py).
cheers.
--
Nathan
|