Subject: Re: envsys version 2 API
To: Bill Stouder-Studenmund <wrstuden@netbsd.org>
From: Juan RP <juan@xtrarom.org>
List: tech-kern
Date: 05/08/2007 20:01:56
On Tue, 8 May 2007 10:49:00 -0700
Bill Stouder-Studenmund <wrstuden@netbsd.org> wrote:

> On Sat, May 05, 2007 at 12:29:01PM +0200, Juan RP wrote:
> > > On Fri, 4 May 2007 22:19:01 -0700
> > > Jason Thorpe <thorpej@shagadelic.org> wrote:
> > > 
> > > > Agreed.  And why add another daemon -- extend powerd(8) (and maybe  
> > > > make powerd(8) use a dictionary-based communication channel, while  
> > > > you're at it...)
> > 
> > Can you explain some more (in detail if possible) how sysmon_power.c
> > should use a dictionary-based communication channel? do you mean
> > that communication between sysmon_power and the drivers should be
> > made via proplib?
> 
> I'm not Jason, so I can only guess what exactly he had in mind. But my
> take on what was being discussed when this came up was to make powerd(8)
> the main monitoring daemon. Other things that want to monitor the system
> (snmp, CIM, other stuff)  talk to it as opposed to talking directly to the
> kernel. That way we can offer notifiction-based services w/o needing 
> polling in the kernel.
> 
> So other tools would issue requests in the form of dictionaries, and get 
> dictionaries as answers.

Ok... I know how to add support for handling the critical events in powerd.

My idea is, that with envstat you'll be able to set the high/low critical
value in a sensor and then if the current value in the driver has exceeded
it, a PSWITCH_EVENT_CRITICAL event will be sent to powerd.

I added some different PSWITH types as well:

	PSWITCH_TYPE_ETEMPERATURE
	PSWITCH_TYPE_EFAN
	PSWITCH_TYPE_EVOLTAGE
	PSWITCH_TYPE_EBATTERY
	PSWITCH_TYPE_EDISK

And the scripts for them will be something like:

	/etc/powerd/scripts/sensor_temperature
	/etc/powerd/scripts/sensor_fan
	/etc/powerd/scripts/sensor_voltage
	/etc/powerd/scripts/sensor_battery
	/etc/powerd/scripts/sensor_disk

And all them will understand the critical argument. I still have to think
some more about the disk event (it will require more arguments).

I think that's going to rock when I have it finished :-)

-- 
http://plog.xtrarom.org/
Juan RP's blog - NetBSD/pkgsrc news in Spanish