On Tue 18 Aug 2009 at 11:47AM, Erik O'Shaughnessy wrote:
> I'm curious to see if there is any interest in a python module which
> provides kstat access in the same vein as the current perl support? I
> have a prototype written and if there is sufficient interest I'm
> willing to share it around. I would like to see it mature somewhat in
> the hands of users and then submit it to PSARC for inclusion with
> Solaris/OpenSolaris.
>
> As a tease, a cheap knock off of kstat(1m):
Yes, there surely is; this is needed badly. There is some complexity
in the perl one which you might need to replicate in terms of
being efficient, and handling raw kstats.
When I looked at doing this about a month ago, I did think that the
nested hash approach of the perl implementation was a good thing
to preserve:
Sun::Solaris::Kstat->new();
Sun::Solaris::Kstat->update();
Sun::Solaris::Kstat->{module}{instance}{name}{statistic}
It is a model of simplicity and I think something to be emulated.
And I would suggest a rename to simply "kstat" (since module
names tend to be lower case and singular).
So for example, I think it would be nice to do:
print ks["arp"][0]["NIC_EVENTS"]["events"]
My very *personal* bias is that we should switch utilities like
kstat(1m), psrinfo, etc. over to python, and choose python as our
higher-level systems programming language.
-dp
--
Daniel Price, Solaris Kernel Engineering http://blogs.sun.com/dp