summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-23 17:49:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-23 17:49:54 +0000
commitc0645878fac0589adbea96f1b82aa28a1f510649 (patch)
tree41413dfd7b1b66c8a5c55b90ed14ee787aa28475
parent456453067d1414c6f4097d6aeaf996624183d72b (diff)
adapt to new two-level sensor sysctl framework; by Constantine A. Murenin
-rw-r--r--etc/sensorsd.conf16
-rw-r--r--lib/libc/gen/sysctl.319
-rw-r--r--sbin/sysctl/sysctl.c157
-rw-r--r--usr.sbin/ntpd/ntpd.h4
-rw-r--r--usr.sbin/ntpd/sensors.c75
-rw-r--r--usr.sbin/sensorsd/sensorsd.c82
-rw-r--r--usr.sbin/sensorsd/sensorsd.conf.530
7 files changed, 281 insertions, 102 deletions
diff --git a/etc/sensorsd.conf b/etc/sensorsd.conf
index 8b400b36ca1..ac4e16d385d 100644
--- a/etc/sensorsd.conf
+++ b/etc/sensorsd.conf
@@ -1,26 +1,26 @@
-# $OpenBSD: sensorsd.conf,v 1.3 2006/08/23 11:32:44 mickey Exp $
+# $OpenBSD: sensorsd.conf,v 1.4 2006/12/23 17:49:53 deraadt Exp $
#
# Sample sensorsd.conf file. See sensorsd.conf(5) for details.
#
# +5 voltage (volts)
-#hw.sensors.3:low=4.8V:high=5.2V
+#hw.sensors.lm0.volt3:low=4.8V:high=5.2V
# +12 voltage (volts)
-#hw.sensors.4:low=11.5V:high=12.5V
+#hw.sensors.lm0.volt4:low=11.5V:high=12.5V
# Chipset temperature (degrees Celsius)
-#hw.sensors.7:high=50C
+#hw.sensors.lm0.temp0:high=50C
# CPU temperature (degrees Celsius)
-#hw.sensors.8:high=60C
+#hw.sensors.lm0.temp1:high=60C
# CPU fan (RPM)
-#hw.sensors.11:low=3000
+#hw.sensors.lm0.fan1:low=3000
# Intrusion detection (on ipmi)
-#hw.sensors.17:
+#hw.sensors.ipmi0.indicator0:
# RAID volume sd0 status
-#hw.sensors.18:
+#hw.sensors.ami0.drive0:
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 34779660330..d8d0c3ce468 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.3,v 1.162 2006/11/21 05:37:32 itojun Exp $
+.\" $OpenBSD: sysctl.3,v 1.163 2006/12/23 17:49:53 deraadt Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -321,9 +321,22 @@ The total physical memory, in bytes.
.It Dv HW_PRODUCT
The product name of the machine.
.It Dv HW_SENSORS
-An array of
+Third level comprises an array of
+.Li struct sensorsdev
+structures containing information about devices
+that may attach hardware monitoring sensors.
+.Pp
+Third, fourth and fifth levels together comprise an array of
.Li struct sensor
-structures containing information from the hardware monitoring sensors.
+structures containing snapshot readings of hardware monitoring sensors.
+In such usage, third level indicates the numerical representation
+of the sensor device name to which the sensor is attached
+(device's xname and number shall be matched with the help of
+.Li struct sensorsdev
+structure above),
+fourth level indicates sensor type and
+fifth level is an ordinal sensor number (unique to
+the specified sensor type on the specified sensor device).
.It Dv HW_SERIALNO
The serial number of the machine.
.It Dv HW_SETPERF
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 9fd22f13423..d7b8d87c82c 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.142 2006/10/19 03:49:26 marco Exp $ */
+/* $OpenBSD: sysctl.c,v 1.143 2006/12/23 17:49:53 deraadt Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95";
#else
-static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.142 2006/10/19 03:49:26 marco Exp $";
+static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.143 2006/12/23 17:49:53 deraadt Exp $";
#endif
#endif /* not lint */
@@ -212,6 +212,7 @@ int sysctl_shminfo(char *, char **, int *, int, int *);
int sysctl_watchdog(char *, char **, int *, int, int *);
int sysctl_tc(char *, char **, int *, int, int *);
int sysctl_sensors(char *, char **, int *, int, int *);
+void print_sensordev(char *, int *, u_int, struct sensordev *);
void print_sensor(struct sensor *);
int sysctl_emul(char *, char *, int);
#ifdef CPU_CHIPSET
@@ -2095,26 +2096,151 @@ sysctl_tc(char *string, char **bufpp, int mib[], int flags,
int
sysctl_sensors(char *string, char **bufpp, int mib[], int flags, int *typep)
{
- char *name;
- int indx;
+ char *devname, *typename;
+ int dev, numt, i;
+ enum sensor_type type;
+ struct sensordev snsrdev;
+ size_t sdlen = sizeof(snsrdev);
if (*bufpp == NULL) {
char buf[BUFSIZ];
- /* scan all sensors */
- for (indx = 0; indx < 256; indx++) {
- snprintf(buf, sizeof(buf), "%s.%u", string, indx);
- parse(buf, 0);
+ /* scan all sensor devices */
+ for (dev = 0; dev < MAXSENSORDEVICES; dev++) {
+ mib[2] = dev;
+ if (sysctl(mib, 3, &snsrdev, &sdlen, NULL, 0) == -1)
+ continue;
+ snprintf(buf, sizeof(buf), "%s.%s",
+ string, snsrdev.xname);
+ print_sensordev(buf, mib, 3, &snsrdev);
}
return (-1);
}
- if ((name = strsep(bufpp, ".")) == NULL) {
+
+ /*
+ * If we get this far, it means that some arguments were
+ * provided below hw.sensors tree.
+ * The first branch of hw.sensors tree is the device name.
+ */
+ if ((devname = strsep(bufpp, ".")) == NULL) {
+ warnx("%s: incomplete specification", string);
+ return (-1);
+ }
+ /* convert sensor device string to an integer */
+ for (dev = 0; dev < MAXSENSORDEVICES; dev++) {
+ mib[2] = dev;
+ if (sysctl(mib, 3, &snsrdev, &sdlen, NULL, 0) == -1)
+ continue;
+ if (strcmp(devname, snsrdev.xname) == 0)
+ break;
+ }
+ if (strcmp(devname, snsrdev.xname) != 0) {
+ warnx("%s: sensor device not found: %s", string, devname);
+ return (-1);
+ }
+ if (*bufpp == NULL) {
+ /* only device name was provided -- let's print all sensors
+ * that are attached to the specified device
+ */
+ print_sensordev(string, mib, 3, &snsrdev);
+ return (-1);
+ }
+
+ /*
+ * At this point we have identified the sensor device,
+ * now let's go further and identify sensor type.
+ */
+ if ((typename = strsep(bufpp, ".")) == NULL) {
warnx("%s: incomplete specification", string);
return (-1);
}
- mib[2] = atoi(name);
+ numt = -1;
+ for (i = 0; typename[i] != '\0'; i++)
+ if (isdigit(typename[i])) {
+ numt = atoi(&typename[i]);
+ typename[i] = '\0';
+ break;
+ }
+ for (type = 0; type < SENSOR_MAX_TYPES; type++)
+ if (strcmp(typename, sensor_type_s[type]) == 0)
+ break;
+ if (type == SENSOR_MAX_TYPES) {
+ warnx("%s: sensor type not recognised: %s", string, typename);
+ return (-1);
+ }
+ mib[3] = type;
+
+ /*
+ * If no integer was provided after sensor_type, let's
+ * print all sensors of the specified type.
+ */
+ if (numt == -1) {
+ print_sensordev(string, mib, 4, &snsrdev);
+ return (-1);
+ }
+
+ /*
+ * At this point we know that we have received a direct request
+ * via command-line for a specific sensor. Let's have the parse()
+ * function deal with it further, and report any errors if such
+ * sensor node does not exist.
+ */
+ mib[4] = numt;
*typep = CTLTYPE_STRUCT;
- return (3);
+ return (5);
+}
+
+/*
+ * Print sensors from the specified device.
+ */
+
+void
+print_sensordev(char *string, int mib[], u_int mlen, struct sensordev *snsrdev)
+{
+ char buf[BUFSIZ];
+ enum sensor_type type;
+
+ if (mlen == 3){
+ for (type = 0; type < SENSOR_MAX_TYPES; type++) {
+ mib[3] = type;
+ snprintf(buf, sizeof(buf), "%s.%s",
+ string, sensor_type_s[type]);
+ print_sensordev(buf, mib, mlen+1, snsrdev);
+ }
+ return;
+ }
+
+ if (mlen == 4) {
+ int numt;
+
+ type = mib[3];
+ for (numt = 0; numt < snsrdev->maxnumt[type]; numt++) {
+ mib[4] = numt;
+ snprintf(buf, sizeof(buf), "%s%u", string, numt);
+ print_sensordev(buf, mib, mlen+1, snsrdev);
+ }
+ return;
+ }
+
+ if (mlen == 5) {
+ struct sensor snsr;
+ size_t slen = sizeof(snsr);
+
+ /* this function is only printing sensors in bulk, so we
+ * do not return any error messages if the requested sensor
+ * is not found by sysctl(3)
+ */
+ if (sysctl(mib, 5, &snsr, &slen, NULL, 0) == -1)
+ return;
+
+ if (slen > 0 && (snsr.flags & SENSOR_FINVALID) == 0) {
+ if (!nflag)
+ printf("%s%s", string, equ);
+ print_sensor(&snsr);
+ printf("\n");
+ }
+ return;
+ }
}
void
@@ -2122,8 +2248,6 @@ print_sensor(struct sensor *s)
{
const char *name;
- printf("%s, %s, ", s->device, s->desc);
-
if (s->flags & SENSOR_FUNKNOWN)
printf("unknown");
else {
@@ -2151,7 +2275,7 @@ print_sensor(struct sensor *s)
printf("%s", s->value ? "On" : "Off");
break;
case SENSOR_INTEGER:
- printf("%lld raw", s->value);
+ printf("%lld", s->value);
break;
case SENSOR_PERCENT:
printf("%.2f%%", s->value / 1000.0);
@@ -2195,7 +2319,7 @@ print_sensor(struct sensor *s)
name = "unknown";
break;
}
- printf("drive %s", name);
+ printf(name);
break;
case SENSOR_TIMEDELTA:
printf("%.2f secs", s->value / 1000000000.0);
@@ -2205,6 +2329,9 @@ print_sensor(struct sensor *s)
}
}
+ if (s->desc[0] != '\0')
+ printf(", (%s)", s->desc);
+
switch (s->status) {
case SENSOR_S_OK:
printf(", OK");
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index 6ceea199a58..e5539e0589b 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.79 2006/11/20 20:58:47 henning Exp $ */
+/* $OpenBSD: ntpd.h,v 1.80 2006/12/23 17:49:53 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -140,7 +140,7 @@ struct ntp_sensor {
time_t next;
time_t last;
char *device;
- int sensorid;
+ int sensordevid;
u_int8_t weight;
u_int8_t shift;
};
diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c
index 612b695e8be..5d7f0558586 100644
--- a/usr.sbin/ntpd/sensors.c
+++ b/usr.sbin/ntpd/sensors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensors.c,v 1.26 2006/11/20 20:58:47 henning Exp $ */
+/* $OpenBSD: sensors.c,v 1.27 2006/12/23 17:49:53 deraadt Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -31,11 +31,11 @@
#include "ntpd.h"
-#define SENSORS_MAX 255
+#define MAXDEVNAMLEN 16
#define _PATH_DEV_HOTPLUG "/dev/hotplug"
-void sensor_probe(int);
-void sensor_add(struct sensor *);
+int sensor_probe(int, char *, struct sensor *);
+void sensor_add(int, char *);
void sensor_remove(struct ntp_sensor *);
void sensor_update(struct ntp_sensor *);
@@ -52,47 +52,59 @@ void
sensor_scan(void)
{
int i;
+ char d[MAXDEVNAMLEN];
+ struct sensor s;
- for (i = 0; i < SENSORS_MAX; i++)
- sensor_probe(i);
+ for (i = 0; i < MAXSENSORDEVICES; i++)
+ if (sensor_probe(i, d, &s))
+ sensor_add(i, d);
}
-void
-sensor_probe(int id)
+int
+sensor_probe(int devid, char *dxname, struct sensor *sensor)
{
- int mib[3];
- size_t len;
- struct sensor sensor;
+ int mib[5];
+ size_t slen, sdlen;
+ struct sensordev sensordev;
mib[0] = CTL_HW;
mib[1] = HW_SENSORS;
- mib[2] = id;
+ mib[2] = devid;
+ mib[3] = SENSOR_TIMEDELTA;
+ mib[4] = 0;
- len = sizeof(sensor);
- if (sysctl(mib, 3, &sensor, &len, NULL, 0) == -1) {
+ sdlen = sizeof(sensordev);
+ if (sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) == -1) {
if (errno != ENOENT)
log_warn("sensor_probe sysctl");
- return;
+ return (0);
+ }
+ strlcpy(dxname, sensordev.xname, MAXDEVNAMLEN);
+
+ slen = sizeof(sensor);
+ if (sysctl(mib, 5, sensor, &slen, NULL, 0) == -1) {
+ if (errno != ENOENT)
+ log_warn("sensor_probe sysctl");
+ return (0);
}
- if (sensor.type == SENSOR_TIMEDELTA)
- sensor_add(&sensor);
+ return (1);
}
void
-sensor_add(struct sensor *sensor)
+sensor_add(int sensordev, char *dxname)
{
struct ntp_sensor *s;
struct ntp_conf_sensor *cs;
/* check wether it is already there */
TAILQ_FOREACH(s, &conf->ntp_sensors, entry)
- if (!strcmp(s->device, sensor->device))
+ if (!strcmp(s->device, dxname))
return;
/* check wether it is requested in the config file */
for (cs = TAILQ_FIRST(&conf->ntp_conf_sensors); cs != NULL &&
- strcmp(cs->device, sensor->device) && strcmp(cs->device, "*");
+ strcmp(cs->device, dxname) && strcmp(cs->device, "*");
cs = TAILQ_NEXT(cs, entry))
; /* nothing */
if (cs == NULL)
@@ -103,9 +115,9 @@ sensor_add(struct sensor *sensor)
s->next = getmonotime();
s->weight = cs->weight;
- if ((s->device = strdup(sensor->device)) == NULL)
+ if ((s->device = strdup(dxname)) == NULL)
fatal("sensor_add strdup");
- s->sensorid = sensor->num;
+ s->sensordevid = sensordev;
TAILQ_INSERT_TAIL(&conf->ntp_sensors, s, entry);
@@ -123,10 +135,9 @@ sensor_remove(struct ntp_sensor *s)
void
sensor_query(struct ntp_sensor *s)
{
+ char dxname[MAXDEVNAMLEN];
struct sensor sensor;
u_int32_t refid;
- int mib[3];
- size_t len;
s->next = getmonotime() + SENSOR_QUERY_INTERVAL;
@@ -134,15 +145,8 @@ sensor_query(struct ntp_sensor *s)
if (s->update.rcvd < time(NULL) - SENSOR_DATA_MAXAGE)
s->update.good = 0;
- mib[0] = CTL_HW;
- mib[1] = HW_SENSORS;
- mib[2] = s->sensorid;
- len = sizeof(sensor);
- if (sysctl(mib, 3, &sensor, &len, NULL, 0) == -1) {
- if (errno == ENOENT)
- sensor_remove(s);
- else
- log_warn("sensor_query sysctl");
+ if (!sensor_probe(s->sensordevid, dxname, &sensor)) {
+ sensor_remove(s);
return;
}
@@ -150,8 +154,7 @@ sensor_query(struct ntp_sensor *s)
sensor.status != SENSOR_S_OK)
return;
- if (sensor.type != SENSOR_TIMEDELTA ||
- strcmp(sensor.device, s->device)) {
+ if (strcmp(dxname, s->device)) {
sensor_remove(s);
return;
}
@@ -249,7 +252,7 @@ sensor_hotplugevent(int fd)
switch (he.he_type) {
case HOTPLUG_DEVAT:
if (he.he_devclass == DV_DULL &&
- !strcmp(he.he_devname, "sensor"))
+ !strcmp(he.he_devname, "sensordev"))
sensor_scan();
break;
default: /* ignore */
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c
index 4a56ba1c9bb..db8d9fc4aba 100644
--- a/usr.sbin/sensorsd/sensorsd.c
+++ b/usr.sbin/sensorsd/sensorsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensorsd.c,v 1.25 2006/12/18 14:13:15 mickey Exp $ */
+/* $OpenBSD: sensorsd.c,v 1.26 2006/12/23 17:49:53 deraadt Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -47,15 +47,17 @@ void reparse_cfg(int);
struct limits_t {
TAILQ_ENTRY(limits_t) entries;
+ char dxname[16]; /* device unix name */
+ int dev; /* device number */
+ enum sensor_type type; /* sensor type */
+ int numt; /* sensor number */
int64_t last_val;
int64_t lower; /* lower limit */
int64_t upper; /* upper limit */
char *command; /* failure command */
time_t status_changed;
- enum sensor_type type; /* sensor type */
enum sensor_status status; /* last status */
enum sensor_status status2;
- int num; /* sensor number */
int count; /* stat change counter */
u_int8_t watch;
};
@@ -78,10 +80,13 @@ int
main(int argc, char *argv[])
{
struct sensor sensor;
+ struct sensordev sensordev;
struct limits_t *limit;
- size_t len;
+ size_t slen, sdlen;
time_t next_report, last_report = 0, next_check;
- int mib[3], i, sleeptime, sensor_cnt, watch_cnt, ch;
+ int mib[5], dev, numt;
+ enum sensor_type type;
+ int sleeptime, sensor_cnt, watch_cnt, ch;
while ((ch = getopt(argc, argv, "d")) != -1) {
switch (ch) {
@@ -95,24 +100,40 @@ main(int argc, char *argv[])
mib[0] = CTL_HW;
mib[1] = HW_SENSORS;
- len = sizeof(sensor);
+ slen = sizeof(sensor);
+ sdlen = sizeof(sensordev);
sensor_cnt = 0;
- for (i = 0; i < 256; i++) {
- mib[2] = i;
- if (sysctl(mib, 3, &sensor, &len, NULL, 0) == -1) {
+ for (dev = 0; dev < MAXSENSORDEVICES; dev++) {
+ mib[2] = dev;
+ if (sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) == -1) {
if (errno != ENOENT)
warn("sysctl");
continue;
}
- if (sensor.flags & SENSOR_FINVALID)
- continue;
- if ((limit = calloc(1, sizeof(struct limits_t))) == NULL)
- err(1, "calloc");
- limit->num = i;
- limit->type = sensor.type;
- TAILQ_INSERT_TAIL(&limits, limit, entries);
- sensor_cnt++;
+ for (type = 0; type < SENSOR_MAX_TYPES; type++) {
+ mib[3] = type;
+ for (numt = 0; numt < sensordev.maxnumt[type]; numt++) {
+ mib[4] = numt;
+ if (sysctl(mib, 5, &sensor, &slen, NULL, 0) == -1) {
+ if (errno != ENOENT)
+ warn("sysctl");
+ continue;
+ }
+ if (sensor.flags & SENSOR_FINVALID)
+ continue;
+ if ((limit = calloc(1, sizeof(struct limits_t)))
+ == NULL)
+ err(1, "calloc");
+ strlcpy(limit->dxname, sensordev.xname,
+ sizeof(limit->dxname));
+ limit->dev = dev;
+ limit->type = type;
+ limit->numt = numt;
+ TAILQ_INSERT_TAIL(&limits, limit, entries);
+ sensor_cnt++;
+ }
+ }
}
if (sensor_cnt == 0)
@@ -175,7 +196,7 @@ check_sensors(void)
struct sensor sensor;
struct limits_t *limit;
size_t len;
- int mib[3];
+ int mib[5];
enum sensor_status newstatus;
mib[0] = CTL_HW;
@@ -184,8 +205,10 @@ check_sensors(void)
TAILQ_FOREACH(limit, &limits, entries)
if (limit->watch) {
- mib[2] = limit->num;
- if (sysctl(mib, 3, &sensor, &len, NULL, 0) == -1)
+ mib[2] = limit->dev;
+ mib[3] = limit->type;
+ mib[4] = limit->numt;
+ if (sysctl(mib, 5, &sensor, &len, NULL, 0) == -1)
err(1, "sysctl");
limit->last_val = sensor.value;
@@ -246,8 +269,8 @@ report(time_t last_report)
if (limit->status_changed <= last_report)
continue;
- syslog(LOG_ALERT, "hw.sensors.%d: %s limits, value: %s",
- limit->num,
+ syslog(LOG_ALERT, "hw.sensors.%s.%s%d: %s limits, value: %s",
+ limit->dxname, sensor_type_s[limit->type], limit->numt,
(limit->status != SENSOR_S_OK) ? "exceed" : "within",
print_sensor(limit->type, limit->last_val));
if (limit->command) {
@@ -273,9 +296,17 @@ report(time_t last_report)
}
switch (cmd[i]) {
- case '1':
+ case 'x':
+ r = snprintf(&buf[n], len - n, "%s",
+ limit->dxname);
+ break;
+ case 't':
+ r = snprintf(&buf[n], len - n, "%s",
+ sensor_type_s[limit->type]);
+ break;
+ case 'n':
r = snprintf(&buf[n], len - n, "%d",
- limit->num);
+ limit->numt);
break;
case '2':
r = snprintf(&buf[n], len - n, "%s",
@@ -382,7 +413,8 @@ parse_config(char *cf)
for (p = TAILQ_FIRST(&limits); p != NULL; p = next) {
next = TAILQ_NEXT(p, entries);
- snprintf(node, sizeof(node), "hw.sensors.%d", p->num);
+ snprintf(node, sizeof(node), "hw.sensors.%s.%s%d",
+ p->dxname, sensor_type_s[p->type], p->numt);
if (cgetent(&buf, cfa, node) != 0)
p->watch = 0;
else {
diff --git a/usr.sbin/sensorsd/sensorsd.conf.5 b/usr.sbin/sensorsd/sensorsd.conf.5
index 64717ed7d6a..f811a8e22c6 100644
--- a/usr.sbin/sensorsd/sensorsd.conf.5
+++ b/usr.sbin/sensorsd/sensorsd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sensorsd.conf.5,v 1.8 2006/08/23 14:30:27 jmc Exp $
+.\" $OpenBSD: sensorsd.conf.5,v 1.9 2006/12/23 17:49:53 deraadt Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\" Copyright (c) 2005 Matthew Gream <matthew.gream@pobox.com>
@@ -65,7 +65,11 @@ The command is executed on transitions out of, and back into, given limits.
Tokens in the command are substituted as follows:
.Pp
.Bl -tag -width Ds -offset indent -compact
-.It %1
+.It %x
+the xname of the device sensor sits on
+.It %t
+the type of the sensor
+.It %n
the sensor number
.It %2
the sensor's current value
@@ -82,26 +86,26 @@ Configuration file for
.El
.Sh EXAMPLES
In the following configuration file,
-if hw.sensors.0 goes above 80C, the command
+if hw.sensors.ipmi0.temp0 goes above 80C, the command
.Pa /etc/sensorsd/log_warning
will be executed,
-with the sensor number and current value passed to it.
-Alerts will be sent if hw.sensors.1 goes above 170F;
-if hw.sensors.2 goes below 4.8V or above 5.2V;
-if the speed of the fan attached to hw.sensors.3
+with the sensor type, number and current value passed to it.
+Alerts will be sent if hw.sensors.ipmi0.temp1 goes above 170F;
+if hw.sensors.lm0.volt3 goes below 4.8V or above 5.2V;
+if the speed of the fan attached to hw.sensors.lm0.fan1
goes below 1000RPM or above 8000RPM;
-or if hw.sensors.4,
+or if hw.sensors.ami0.drive0,
attached to raid volume sd0,
goes into a state other than
.Dq OK ,
such as drive failure, rebuild, or a complete failure.
.Bd -literal -offset indent
# Comments are allowed
-hw.sensors.0:high=80C:command=/etc/sensorsd/log_warning %1 %2
-hw.sensors.1:high=170F
-hw.sensors.2:low=4.8V:high=5.2V
-hw.sensors.3:low=1000:high=8000
-hw.sensors.4: # raid volume status changes
+hw.sensors.ipmi0.temp0:high=80C:command=/etc/sensorsd/log_warning %t %n %2
+hw.sensors.ipmi0.temp1:high=170F
+hw.sensors.lm0.volt3:low=4.8V:high=5.2V
+hw.sensors.lm0.fan1:low=1000:high=8000
+hw.sensors.ami0.drive0: # raid volume status changes
.Ed
.Sh SEE ALSO
.Xr getcap 3 ,