sensorsd configuration

2006-07-13 Thread Daniel A. Ramaley
Hello. I have not used sensorsd on OpenBSD before, but am trying to 
learn. I have read sensorsd(8) and sensorsd.conf(5) from OpenBSD 3.9 
and the configuration looks very simple. However, i have a couple quick 
questions:

The lines in sensorsd.conf start with hw.sensors.N (where N is a small 
natural number). How do i determine N for each sensor? Is there a list 
somewhere that tells what is what? Or is there a command i can run to 
generate a list?

Secondly, is it possible to read the current values of sensors? For 
example, say i have configured a sensor to monitor the CPU temperature. 
Is there a way to find out what the current temperature is?


Dan RamaleyDial Center 118, Drake University
Network Programmer/Analyst 2407 Carpenter Ave
+1 515 271-4540Des Moines IA 50311 USA



Re: sensorsd configuration

2006-07-13 Thread Antoine Jacoutot

On Thu, 13 Jul 2006, Daniel A. Ramaley wrote:

The lines in sensorsd.conf start with hw.sensors.N (where N is a small
natural number). How do i determine N for each sensor? Is there a list


You can retrieve sensors information using the sysctl command:

$ sysctl hw.sensors
hw.sensors.0=viaenv0, TSENS1, temp, 50.50 degC / 122.90 degF
hw.sensors.1=viaenv0, TSENS2, temp, 52.00 degC / 125.60 degF
hw.sensors.2=viaenv0, TSENS3, temp, 26.82 degC / 80.28 degF
hw.sensors.3=viaenv0, FAN1, fanrpm, 0 RPM
hw.sensors.4=viaenv0, FAN2, fanrpm, 0 RPM
hw.sensors.5=viaenv0, VSENS1, volts_dc, 1.20 V
hw.sensors.6=viaenv0, VSENS2, volts_dc, 2.51 V
hw.sensors.7=viaenv0, Vcore, volts_dc, 3.26 V
hw.sensors.8=viaenv0, VSENS3, volts_dc, 4.95 V
hw.sensors.9=viaenv0, VSENS4, volts_dc, 11.83 V

Now, to know what hw.sensors.0 is, you have a loot at the man page 
corresponding to your sensor (here viaenv):


$ man viaenv
(...)
 The device has 10 sensors:

   SensorUnitsTypical Use
   TSENS1uK   CPU temperature
   TSENS2uK   System temperature
   TSENS3uK   Unknown
   FAN1  RPM  CPU fan
   FAN2  RPM  System fan
   VSENS1uV DCCPU core voltage (2.0V)
   VSENS2uV DCNorth Bridge core voltage (2.5V)
   Vcore uV DCInternal core voltage (3.3V)
   VSENS3uV DC+5V
   VSENS4uV DC+12V
(...)

Let's say you want to monitor your CPU temperature, in your 
/etc/sensorsd.conf file, you could put something like:


hw.sensors.0:high=60C:\
 :command=echo %2 \(high=%4\) | mail -s [`hostname`] sensorsd WARNING \(CPU 
Temp.\) root

Regards,

--
Antoine



Re: sensorsd configuration

2006-07-13 Thread Weldon Goree
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Daniel A. Ramaley wrote:
 The lines in sensorsd.conf start with hw.sensors.N (where N is a small 
 natural number). How do i determine N for each sensor? Is there a list 
 somewhere that tells what is what? Or is there a command i can run to 
 generate a list?

`sysctl hw.sensors` will show you the list of all the sensors and their
appropriate number (and current value). As I found out a couple of days
ago, sysctl(8) does this by just trying all possible N's for 1 to 256
and then checks what each sensor is. AFAICT, that's the only facility
the kernel offers to find them.

 Secondly, is it possible to read the current values of sensors? For 
 example, say i have configured a sensor to monitor the CPU temperature. 
 Is there a way to find out what the current temperature is?

sysctl(8), again. If CPU temp is hw.sensors.4, then sysctl hw.sensors.4
will tell you. Sensorsd is more for watching for threshholds and
boundary readings, rather than a real-time display of the current reading.

If you're programming, you can also use sysctl(3); it would be something
like sysctl({CTL_HW, HW_SENSORS, 4}, 3, some_allocated_buffer,
length_of_that_buffer, NULL, 0);
some_allocated_buffer will then hold the struct sensor containing its
current state.

Weldon Goree
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEtnuvixcispFzVm8RAttkAJ95eFTvJaaqn4R1Tkf1Kpo9c1KtuwCfS5aG
0ET6NQe4/KoC6iUw2w6qipk=
=PTNG
-END PGP SIGNATURE-



Re: sensorsd configuration

2006-07-13 Thread Daniel A. Ramaley
Thank you to those who responded! I can figure out sensorsd.conf now. 
Also thank you to the developers who created such a simple way to 
monitor the sensors. I've configured sensors on other operating systems 
that have been a much greater hassle.


Dan RamaleyDial Center 118, Drake University
Network Programmer/Analyst 2407 Carpenter Ave
+1 515 271-4540Des Moines IA 50311 USA