On Thu, 2007-09-20 at 11:46 +0200, Software Forums wrote:
> I'm using the VMSTAT function as a template for the sensors function I
> want to write.
> I reckon It is simple and functionally close to it.
Yes, it is pretty close. However, I'd suggest you take a look at
"solswap". The difference is that vmstat bases on CommandWatchRequester
which is good for things like vmstat or sar, which need to run some time
in order to gather data. CommandWatchRequester will start a command in
a cycle and reaps the results in the next cycle only.
The SlowRequester class solswap is based on however expects the
requester to deliver data within a shorter time (usually a few seconds).
The real work in your case is to parse the output of the sensors
command line by line in do() (NOTE that you must be prepared for do()
to be called multiple times as soon as output is ready for parsing and
should return if no output is left - like solswap does) and fill the
data into the "info" hash.
The info hash looks quite strange on the first spot but isn't that
difficult to understand. The keys are always an index (as in
get lmsensors.somegroup.somevar.0
where the index is "0"), the value another hash with the keys being
names (like the "somegroup.somevar") and the values the actual figures.
So, in order to provide figures for the above "get" you would set
$info->{0}->{'somegroup.somevar'} = 1234;
I hope this gave you some hints.
Best regards,
Tom
--
----------------------------------------------------------------------------
Thomas Aeby, Kirchweg 52, 1735 Giffers, Switzerland, Tel: (+41)264180040
Internet: suppressed PGP public key available
----------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bigsister-general mailing list
suppressed
https://lists.sourceforge.net/lists/listinfo/bigsister-general
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.