mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-25 12:14:33 +00:00
Added RRD support to sensord; can automatically create
/configure database based on detected/configured sensors, logs libsensors-processed readings to the database, has a command-line option for generating a basic rrdcgi script. Removed sensord from all target because it has an external dependency on librrd. This just makes using RRD with sensors easier; you don't need to figure out what sensors are available and configure the database with computations that are already in sensors.conf. To install: make install-prog-sensord To create and start logging to database: sensord --rrd-file /var/log/sensord.rrd To create a CGI script: sensord --rrd-file /var/log/sensord.rrd \ --rrd-cgi /var/www/sensord \ > /usr/lib/cgi-bin/sensord.cgi man sensord for more details. Kudos to Mark for doing the hard work ;} -- merlin git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1357 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
79b3f359cc
commit
da09ec0eba
9 files changed
+862
-213
No files matched your search
@@ -27,17 +27,17 @@ PROGSENSORDMAN1FILES := $(MODULE_DIR)/sensord.8
|
||||
# Regrettably, even 'simply expanded variables' will not put their currently
|
||||
# defined value verbatim into the command-list of rules...
|
||||
PROGSENSORDTARGETS := $(MODULE_DIR)/sensord
|
||||
PROGSENSORDSOURCES := $(MODULE_DIR)/args.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/lib.c $(MODULE_DIR)/sense.c $(MODULE_DIR)/sensord.c
|
||||
PROGSENSORDSOURCES := $(MODULE_DIR)/args.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/lib.c $(MODULE_DIR)/rrd.c $(MODULE_DIR)/sense.c $(MODULE_DIR)/sensord.c
|
||||
|
||||
# Include all dependency files. We use '.rd' to indicate this will create
|
||||
# executables.
|
||||
INCLUDEFILES += $(PROGSENSORDSOURCES:.c=.rd)
|
||||
|
||||
$(PROGSENSORDTARGETS): $(PROGSENSORDSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
|
||||
$(CC) -o $@ $(PROGSENSORDSOURCES:.c=.ro) -Llib -lsensors
|
||||
$(CC) -o $@ $(PROGSENSORDSOURCES:.c=.ro) -Llib -lsensors -lrrd
|
||||
|
||||
all-prog-sensord: $(PROGSENSORDTARGETS)
|
||||
all :: all-prog-sensord
|
||||
# all :: all-prog-sensord
|
||||
|
||||
install-prog-sensord: all-prog-sensord
|
||||
$(MKDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(PROGSENSORDMAN1DIR)
|
||||
|
||||
+57
-8
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -34,11 +34,15 @@
|
||||
int isDaemon = 0;
|
||||
const char *sensorsCfgFile = "sensors.conf";
|
||||
const char *pidFile = "/var/run/sensord.pid";
|
||||
const char *rrdFile = NULL;
|
||||
const char *cgiDir = NULL;
|
||||
int scanTime = 60;
|
||||
int logTime = 30 * 60;
|
||||
int rrdTime = 5 * 60;
|
||||
int syslogFacility = LOG_LOCAL4;
|
||||
int doScan = 0;
|
||||
int doSet = 0;
|
||||
int doCGI = 0;
|
||||
int debug = 0;
|
||||
sensors_chip_name chipNames[MAX_CHIP_NAMES];
|
||||
int numChipNames = 0;
|
||||
@@ -92,24 +96,32 @@ parseFacility
|
||||
static const char *daemonSyntax =
|
||||
" -i, --interval <time> -- interval between scanning alarms (default 60s)\n"
|
||||
" -l, --log-interval <time> -- interval between logging sensors (default 30m)\n"
|
||||
" -f, --syslog-facility <f> -- syslog facility to use (default local4)\n"
|
||||
" -t, --rrd-interval <time> -- interval between updating RRD file (default 5m)\n"
|
||||
" -r, --rrd-file <file> -- RRD file (default <none>)\n"
|
||||
" -c, --config-file <file> -- configuration file (default sensors.conf)\n"
|
||||
" -p, --pid-file <file> -- PID file (default /var/run/sensord.pid)\n"
|
||||
" -f, --syslog-facility <f> -- syslog facility to use (default local4)\n"
|
||||
" -g, --rrd-cgi <img-dir> -- output an RRD CGI script and exit\n"
|
||||
" -d, --debug -- display some debug information\n"
|
||||
" -v, --version -- display version and exit\n"
|
||||
" -h, --help -- display help and exit\n"
|
||||
"\n"
|
||||
"Specify a value of 0 for either interval to disable that operation;\n"
|
||||
"Specify a value of 0 for any interval to disable that operation;\n"
|
||||
"for example, specify --log-interval 0 to only scan for alarms."
|
||||
"\n"
|
||||
"If no path is specified, a list of directories is examined for the config file;\n"
|
||||
"specify the filename `-' to read the config file from stdin.\n"
|
||||
"\n"
|
||||
"If no chips are specified, all chip info will be printed.\n";
|
||||
"If no chips are specified, all chip info will be printed.\n"
|
||||
"\n"
|
||||
"If unspecified, no RRD (round robin database) is used. If specified and the\n"
|
||||
"file does not exist, it will be created. For RRD updates to be successful,\n"
|
||||
"the RRD file configuration must EXACTLY match the sensors that are used.\n";
|
||||
|
||||
static const char *appSyntax =
|
||||
" -a, --alarm-scan -- only scan for alarms\n"
|
||||
" -s, --set -- execute set statements too (root only)\n"
|
||||
" -r, --rrd-file <file> -- only update RRD file\n"
|
||||
" -c, --config-file <file> -- configuration file (default sensors.conf)\n"
|
||||
" -d, --debug -- display some debug information\n"
|
||||
" -v, --version -- display version and exit\n"
|
||||
@@ -120,25 +132,29 @@ static const char *appSyntax =
|
||||
"\n"
|
||||
"If no chips are specified, all chip info will be printed.\n";
|
||||
|
||||
static const char *daemonShortOptions = "i:l:f:c:p:dvh";
|
||||
static const char *daemonShortOptions = "i:l:t:f:r:c:p:dvhg:";
|
||||
|
||||
static const struct option daemonLongOptions[] = {
|
||||
{ "interval", required_argument, NULL, 'i' },
|
||||
{ "log-interval", required_argument, NULL, 'l' },
|
||||
{ "rrd-interval", required_argument, NULL, 't' },
|
||||
{ "syslog-facility", required_argument, NULL, 'f' },
|
||||
{ "rrd-file", required_argument, NULL, 'r' },
|
||||
{ "config-file", required_argument, NULL, 'c' },
|
||||
{ "pid-file", required_argument, NULL, 'p' },
|
||||
{ "rrd-cgi", required_argument, NULL, 'g' },
|
||||
{ "debug", no_argument, NULL, 'd' },
|
||||
{ "version", no_argument, NULL, 'v' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
static const char *appShortOptions = "asc:dvh";
|
||||
static const char *appShortOptions = "asr:c:dvh";
|
||||
|
||||
static const struct option appLongOptions[] = {
|
||||
{ "alarm-scan", no_argument, NULL, 'a' },
|
||||
{ "set", no_argument, NULL, 's' },
|
||||
{ "rrd-file", required_argument, NULL, 'r' },
|
||||
{ "config-file", required_argument, NULL, 'c' },
|
||||
{ "debug", no_argument, NULL, 'd' },
|
||||
{ "version", no_argument, NULL, 'v' },
|
||||
@@ -167,6 +183,10 @@ parseArgs
|
||||
if ((logTime = parseTime (optarg)) < 0)
|
||||
return -1;
|
||||
break;
|
||||
case 't':
|
||||
if ((rrdTime = parseTime (optarg)) < 0)
|
||||
return -1;
|
||||
break;
|
||||
case 'f':
|
||||
if ((syslogFacility = parseFacility (optarg)) < 0)
|
||||
return -1;
|
||||
@@ -185,9 +205,18 @@ parseArgs
|
||||
if ((pidFile = strdup (optarg)) == NULL)
|
||||
return -1;
|
||||
break;
|
||||
case 'r':
|
||||
if ((rrdFile = strdup (optarg)) == NULL)
|
||||
return -1;
|
||||
break;
|
||||
case 'd':
|
||||
debug = 1;
|
||||
break;
|
||||
case 'g':
|
||||
doCGI = 1;
|
||||
if ((cgiDir = strdup (optarg)) == NULL)
|
||||
return -1;
|
||||
break;
|
||||
case 'v':
|
||||
printf ("sensord version %s\n", version);
|
||||
exit (EXIT_SUCCESS);
|
||||
@@ -213,8 +242,28 @@ parseArgs
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!logTime && !scanTime) {
|
||||
fprintf (stderr, "Error: No logging or alarm scanning.\n");
|
||||
if (rrdFile && doSet) {
|
||||
fprintf (stderr, "Error: Incompatible --set and --rrd-file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (doScan && rrdFile) {
|
||||
fprintf (stderr, "Error: Incompatible --rrd-file and --alarm-scan.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (doCGI && !rrdFile) {
|
||||
fprintf (stderr, "Error: Incompatible --rrd-cgi without --rrd-file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rrdFile && !rrdTime) {
|
||||
fprintf (stderr, "Error: Incompatible --rrd-file without --rrd-interval.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!logTime && !scanTime && !rrdFile) {
|
||||
fprintf (stderr, "Error: No logging, alarm or RRD scanning.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+202
-144
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -134,6 +134,27 @@ fmtIntDashInt
|
||||
return fmtExtra (alarm, beep);
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdF0
|
||||
(const double values[]) {
|
||||
sprintf (buff, "%.0f", values[0]);
|
||||
return buff;
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdF1
|
||||
(const double values[]) {
|
||||
sprintf (buff, "%.1f", values[0]);
|
||||
return buff;
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdF2
|
||||
(const double values[]) {
|
||||
sprintf (buff, "%.2f", values[0]);
|
||||
return buff;
|
||||
}
|
||||
|
||||
/** LM75 **/
|
||||
|
||||
static const char *lm75_names[] = {
|
||||
@@ -141,7 +162,7 @@ static const char *lm75_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor lm75_features[] = {
|
||||
{ fmtTemps_1, 0, 0,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, 0, 0,
|
||||
{ SENSORS_LM75_TEMP, SENSORS_LM75_TEMP_HYST, SENSORS_LM75_TEMP_OVER, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -157,11 +178,11 @@ static const char *adm1021_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor adm1021_features[] = {
|
||||
{ fmtTemps_0, ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW, 0, /* TODO!! */
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW, 0, /* TODO!! */
|
||||
{ SENSORS_ADM1021_TEMP, SENSORS_ADM1021_TEMP_OVER, SENSORS_ADM1021_TEMP_HYST, -1 } },
|
||||
{ fmtTemps_0, ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | ADM1021_ALARM_RTEMP_NA, 0, /* TODO!! */
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | ADM1021_ALARM_RTEMP_NA, 0, /* TODO!! */
|
||||
{ SENSORS_ADM1021_REMOTE_TEMP, SENSORS_ADM1021_REMOTE_TEMP_OVER, SENSORS_ADM1021_REMOTE_TEMP_HYST, -1 } },
|
||||
{ fmtValu_0, 0, 0,
|
||||
{ fmtValu_0, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_ADM1021_DIE_CODE, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -177,9 +198,9 @@ static const char *max1617_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor max1617_features[] = {
|
||||
{ fmtTemps_0, ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW, 0, /* TODO!! */
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW, 0, /* TODO!! */
|
||||
{ SENSORS_MAX1617_TEMP, SENSORS_MAX1617_TEMP_OVER, SENSORS_MAX1617_TEMP_HYST, -1 } },
|
||||
{ fmtTemps_0, ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | ADM1021_ALARM_RTEMP_NA, 0, /* TODO!! */
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | ADM1021_ALARM_RTEMP_NA, 0, /* TODO!! */
|
||||
{ SENSORS_MAX1617_REMOTE_TEMP, SENSORS_MAX1617_REMOTE_TEMP_OVER, SENSORS_MAX1617_REMOTE_TEMP_HYST, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -195,27 +216,27 @@ static const char *adm9240_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor adm9240_features[] = {
|
||||
{ fmtVolts_2, ADM9240_ALARM_IN0, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN0, 0,
|
||||
{ SENSORS_ADM9240_IN0, SENSORS_ADM9240_IN0_MIN, SENSORS_ADM9240_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM9240_ALARM_IN1, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN1, 0,
|
||||
{ SENSORS_ADM9240_IN1, SENSORS_ADM9240_IN1_MIN, SENSORS_ADM9240_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM9240_ALARM_IN2, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN2, 0,
|
||||
{ SENSORS_ADM9240_IN2, SENSORS_ADM9240_IN2_MIN, SENSORS_ADM9240_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM9240_ALARM_IN3, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN3, 0,
|
||||
{ SENSORS_ADM9240_IN3, SENSORS_ADM9240_IN3_MIN, SENSORS_ADM9240_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM9240_ALARM_IN4, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN4, 0,
|
||||
{ SENSORS_ADM9240_IN4, SENSORS_ADM9240_IN4_MIN, SENSORS_ADM9240_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM9240_ALARM_IN5, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN5, 0,
|
||||
{ SENSORS_ADM9240_IN5, SENSORS_ADM9240_IN5_MIN, SENSORS_ADM9240_IN5_MAX, -1 } },
|
||||
{ fmtFans_0, ADM9240_ALARM_FAN1, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, ADM9240_ALARM_FAN1, 0,
|
||||
{ SENSORS_ADM9240_FAN1, SENSORS_ADM9240_FAN1_MIN, SENSORS_ADM9240_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, ADM9240_ALARM_FAN2, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, ADM9240_ALARM_FAN2, 0,
|
||||
{ SENSORS_ADM9240_FAN2, SENSORS_ADM9240_FAN2_MIN, SENSORS_ADM9240_FAN2_DIV, -1 } },
|
||||
{ fmtTemps_0, ADM9240_ALARM_TEMP, 0,
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, ADM9240_ALARM_TEMP, 0,
|
||||
{ SENSORS_ADM9240_TEMP, SENSORS_ADM9240_TEMP_OVER, SENSORS_ADM9240_TEMP_HYST, -1 } },
|
||||
{ fmtVolt_2, 0, 0,
|
||||
{ fmtVolt_2, rrdF2, DataType_voltage, 0, 0,
|
||||
{ SENSORS_ADM9240_VID, -1 } },
|
||||
{ fmtChassisIntrusionDetection, ADM9240_ALARM_CHAS, 0,
|
||||
{ fmtChassisIntrusionDetection, NULL, DataType_other, ADM9240_ALARM_CHAS, 0,
|
||||
{ SENSORS_ADM9240_ALARMS, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -231,33 +252,33 @@ static const char *lm78_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor lm78_features[] = {
|
||||
{ fmtVolts_2, LM78_ALARM_IN0, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN0, 0,
|
||||
{ SENSORS_LM78_IN0, SENSORS_LM78_IN0_MIN, SENSORS_LM78_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, LM78_ALARM_IN1, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN1, 0,
|
||||
{ SENSORS_LM78_IN1, SENSORS_LM78_IN1_MIN, SENSORS_LM78_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, LM78_ALARM_IN2, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN2, 0,
|
||||
{ SENSORS_LM78_IN2, SENSORS_LM78_IN2_MIN, SENSORS_LM78_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, LM78_ALARM_IN3, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN3, 0,
|
||||
{ SENSORS_LM78_IN3, SENSORS_LM78_IN3_MIN, SENSORS_LM78_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, LM78_ALARM_IN4, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN4, 0,
|
||||
{ SENSORS_LM78_IN4, SENSORS_LM78_IN4_MIN, SENSORS_LM78_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, LM78_ALARM_IN5, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN5, 0,
|
||||
{ SENSORS_LM78_IN5, SENSORS_LM78_IN5_MIN, SENSORS_LM78_IN5_MAX, -1 } },
|
||||
{ fmtVolts_2, LM78_ALARM_IN6, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN6, 0,
|
||||
{ SENSORS_LM78_IN6, SENSORS_LM78_IN6_MIN, SENSORS_LM78_IN6_MAX, -1 } },
|
||||
{ fmtFans_0, LM78_ALARM_FAN1, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, LM78_ALARM_FAN1, 0,
|
||||
{ SENSORS_LM78_FAN1, SENSORS_LM78_FAN1_MIN, SENSORS_LM78_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, LM78_ALARM_FAN2, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, LM78_ALARM_FAN2, 0,
|
||||
{ SENSORS_LM78_FAN2, SENSORS_LM78_FAN2_MIN, SENSORS_LM78_FAN2_DIV, -1 } },
|
||||
{ fmtFans_0, LM78_ALARM_FAN3, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, LM78_ALARM_FAN3, 0,
|
||||
{ SENSORS_LM78_FAN3, SENSORS_LM78_FAN3_MIN, SENSORS_LM78_FAN3_DIV, -1 } },
|
||||
{ fmtTemps_0, LM78_ALARM_TEMP, 0,
|
||||
{ fmtTemps_0, rrdF0, DataType_rpm, LM78_ALARM_TEMP, 0,
|
||||
{ SENSORS_LM78_TEMP, SENSORS_LM78_TEMP_OVER, SENSORS_LM78_TEMP_HYST, -1 } },
|
||||
{ fmtBoardTemperatureInput, LM78_ALARM_BTI, 0,
|
||||
{ fmtBoardTemperatureInput, NULL, DataType_other, LM78_ALARM_BTI, 0,
|
||||
{ SENSORS_LM78_ALARMS, -1 } },
|
||||
{ fmtChassisIntrusionDetection, LM78_ALARM_CHAS, 0,
|
||||
{ fmtChassisIntrusionDetection, NULL, DataType_other, LM78_ALARM_CHAS, 0,
|
||||
{ SENSORS_LM78_ALARMS, -1 } },
|
||||
{ fmtVolt_2, 0, 0,
|
||||
{ fmtVolt_2, rrdF2, DataType_voltage, 0, 0,
|
||||
{ SENSORS_LM78_VID, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -273,21 +294,21 @@ static const char *sis5595_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor sis5595_features[] = {
|
||||
{ fmtVolts_2, SIS5595_ALARM_IN0, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN0, 0,
|
||||
{ SENSORS_SIS5595_IN0, SENSORS_SIS5595_IN0_MIN, SENSORS_SIS5595_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, SIS5595_ALARM_IN1, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN1, 0,
|
||||
{ SENSORS_SIS5595_IN1, SENSORS_SIS5595_IN1_MIN, SENSORS_SIS5595_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, SIS5595_ALARM_IN2, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN2, 0,
|
||||
{ SENSORS_SIS5595_IN2, SENSORS_SIS5595_IN2_MIN, SENSORS_SIS5595_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, SIS5595_ALARM_IN3, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN3, 0,
|
||||
{ SENSORS_SIS5595_IN3, SENSORS_SIS5595_IN3_MIN, SENSORS_SIS5595_IN3_MAX, -1 } },
|
||||
{ fmtFans_0, SIS5595_ALARM_FAN1, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, SIS5595_ALARM_FAN1, 0,
|
||||
{ SENSORS_SIS5595_FAN1, SENSORS_SIS5595_FAN1_MIN, SENSORS_SIS5595_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, SIS5595_ALARM_FAN2, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, SIS5595_ALARM_FAN2, 0,
|
||||
{ SENSORS_SIS5595_FAN2, SENSORS_SIS5595_FAN2_MIN, SENSORS_SIS5595_FAN2_DIV, -1 } },
|
||||
{ fmtTemps_0, SIS5595_ALARM_TEMP, 0,
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, SIS5595_ALARM_TEMP, 0,
|
||||
{ SENSORS_SIS5595_TEMP, SENSORS_SIS5595_TEMP_OVER, SENSORS_SIS5595_TEMP_HYST, -1 } },
|
||||
{ fmtBoardTemperatureInput, SIS5595_ALARM_BTI, 0,
|
||||
{ fmtBoardTemperatureInput, NULL, DataType_other, SIS5595_ALARM_BTI, 0,
|
||||
{ SENSORS_SIS5595_ALARMS, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -303,25 +324,25 @@ static const char *via686a_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor via686a_features[] = {
|
||||
{ fmtVolts_2, VIA686A_ALARM_IN0, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN0, 0,
|
||||
{ SENSORS_VIA686A_IN0, SENSORS_VIA686A_IN0_MIN, SENSORS_VIA686A_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, VIA686A_ALARM_IN1, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN1, 0,
|
||||
{ SENSORS_VIA686A_IN1, SENSORS_VIA686A_IN1_MIN, SENSORS_VIA686A_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, VIA686A_ALARM_IN2, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN2, 0,
|
||||
{ SENSORS_VIA686A_IN2, SENSORS_VIA686A_IN2_MIN, SENSORS_VIA686A_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, VIA686A_ALARM_IN3, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN3, 0,
|
||||
{ SENSORS_VIA686A_IN3, SENSORS_VIA686A_IN3_MIN, SENSORS_VIA686A_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, VIA686A_ALARM_IN4, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN4, 0,
|
||||
{ SENSORS_VIA686A_IN4, SENSORS_VIA686A_IN4_MIN, SENSORS_VIA686A_IN4_MAX, -1 } },
|
||||
{ fmtFans_0, VIA686A_ALARM_FAN1, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, VIA686A_ALARM_FAN1, 0,
|
||||
{ SENSORS_VIA686A_FAN1, SENSORS_VIA686A_FAN1_MIN, SENSORS_VIA686A_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, VIA686A_ALARM_FAN2, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, VIA686A_ALARM_FAN2, 0,
|
||||
{ SENSORS_VIA686A_FAN2, SENSORS_VIA686A_FAN2_MIN, SENSORS_VIA686A_FAN2_DIV, -1 } },
|
||||
{ fmtTemps_1, VIA686A_ALARM_TEMP, 0,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, VIA686A_ALARM_TEMP, 0,
|
||||
{ SENSORS_VIA686A_TEMP, SENSORS_VIA686A_TEMP_OVER, SENSORS_VIA686A_TEMP_HYST, -1 } },
|
||||
{ fmtTemps_1, VIA686A_ALARM_TEMP2, 0,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, VIA686A_ALARM_TEMP2, 0,
|
||||
{ SENSORS_VIA686A_TEMP2, SENSORS_VIA686A_TEMP2_OVER, SENSORS_VIA686A_TEMP2_HYST, -1 } },
|
||||
{ fmtTemps_1, VIA686A_ALARM_TEMP3, 0,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, VIA686A_ALARM_TEMP3, 0,
|
||||
{ SENSORS_VIA686A_TEMP3, SENSORS_VIA686A_TEMP3_OVER, SENSORS_VIA686A_TEMP3_HYST, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -344,29 +365,29 @@ static const char *lm80_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor lm80_features[] = {
|
||||
{ fmtVolts_2, LM80_ALARM_IN0, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN0, 0,
|
||||
{ SENSORS_LM80_IN0, SENSORS_LM80_IN0_MIN, SENSORS_LM80_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, LM80_ALARM_IN1, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN1, 0,
|
||||
{ SENSORS_LM80_IN1, SENSORS_LM80_IN1_MIN, SENSORS_LM80_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, LM80_ALARM_IN2, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN2, 0,
|
||||
{ SENSORS_LM80_IN2, SENSORS_LM80_IN2_MIN, SENSORS_LM80_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, LM80_ALARM_IN3, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN3, 0,
|
||||
{ SENSORS_LM80_IN3, SENSORS_LM80_IN3_MIN, SENSORS_LM80_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, LM80_ALARM_IN4, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN4, 0,
|
||||
{ SENSORS_LM80_IN4, SENSORS_LM80_IN4_MIN, SENSORS_LM80_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, LM80_ALARM_IN5, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN5, 0,
|
||||
{ SENSORS_LM80_IN5, SENSORS_LM80_IN5_MIN, SENSORS_LM80_IN5_MAX, -1 } },
|
||||
{ fmtVolts_2, LM80_ALARM_IN6, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN6, 0,
|
||||
{ SENSORS_LM80_IN6, SENSORS_LM80_IN6_MIN, SENSORS_LM80_IN6_MAX, -1 } },
|
||||
{ fmtFans_0, LM80_ALARM_FAN1, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, LM80_ALARM_FAN1, 0,
|
||||
{ SENSORS_LM80_FAN1, SENSORS_LM80_FAN1_MIN, SENSORS_LM80_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, LM80_ALARM_FAN2, 0,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, LM80_ALARM_FAN2, 0,
|
||||
{ SENSORS_LM80_FAN2, SENSORS_LM80_FAN2_MIN, SENSORS_LM80_FAN2_DIV, -1 } },
|
||||
{ fmtTemps_LM80, LM80_ALARM_TEMP_HOT, 0,
|
||||
{ fmtTemps_LM80, rrdF2, DataType_temperature, LM80_ALARM_TEMP_HOT, 0,
|
||||
{ SENSORS_LM80_TEMP, SENSORS_LM80_TEMP_HOT_MAX, SENSORS_LM80_TEMP_HOT_HYST, SENSORS_LM80_TEMP_OS_MAX, SENSORS_LM80_TEMP_OS_HYST, -1 } },
|
||||
{ fmtBoardTemperatureInput, LM80_ALARM_BTI, 0,
|
||||
{ fmtBoardTemperatureInput, NULL, DataType_other, LM80_ALARM_BTI, 0,
|
||||
{ SENSORS_LM80_ALARMS, -1 } },
|
||||
{ fmtChassisIntrusionDetection, LM80_ALARM_CHAS, 0,
|
||||
{ fmtChassisIntrusionDetection, NULL, DataType_other, LM80_ALARM_CHAS, 0,
|
||||
{ SENSORS_LM80_ALARMS, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -394,21 +415,21 @@ static const char *gl518_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor gl518_features[] = {
|
||||
{ fmtVolts_2, GL518_ALARM_VDD, GL518_ALARM_VDD,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VDD, GL518_ALARM_VDD,
|
||||
{ SENSORS_GL518_VDD, SENSORS_GL518_VDD_MIN, SENSORS_GL518_VDD_MAX, -1 } },
|
||||
{ fmtVolts_2, GL518_ALARM_VIN1, GL518_ALARM_VIN1,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VIN1, GL518_ALARM_VIN1,
|
||||
{ SENSORS_GL518_VIN1, SENSORS_GL518_VIN1_MIN, SENSORS_GL518_VIN1_MAX, -1 } },
|
||||
{ fmtVolts_2, GL518_ALARM_VIN2, GL518_ALARM_VIN2,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VIN2, GL518_ALARM_VIN2,
|
||||
{ SENSORS_GL518_VIN2, SENSORS_GL518_VIN2_MIN, SENSORS_GL518_VIN2_MAX, -1 } },
|
||||
{ fmtVolts_2, GL518_ALARM_VIN3, GL518_ALARM_VIN3,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VIN3, GL518_ALARM_VIN3,
|
||||
{ SENSORS_GL518_VIN3, SENSORS_GL518_VIN3_MIN, SENSORS_GL518_VIN3_MAX, -1 } },
|
||||
{ fmtFans_0, GL518_ALARM_FAN1, GL518_ALARM_FAN1,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, GL518_ALARM_FAN1, GL518_ALARM_FAN1,
|
||||
{ SENSORS_GL518_FAN1, SENSORS_GL518_FAN1_MIN, SENSORS_GL518_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, GL518_ALARM_FAN2, GL518_ALARM_FAN2,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, GL518_ALARM_FAN2, GL518_ALARM_FAN2,
|
||||
{ SENSORS_GL518_FAN2, SENSORS_GL518_FAN2_MIN, SENSORS_GL518_FAN2_DIV, -1 } },
|
||||
{ fmtTemps_0, GL518_ALARM_TEMP, GL518_ALARM_TEMP,
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, GL518_ALARM_TEMP, GL518_ALARM_TEMP,
|
||||
{ SENSORS_GL518_TEMP, SENSORS_GL518_TEMP_OVER, SENSORS_GL518_TEMP_HYST, -1 } },
|
||||
{ fmtSoundAlarm, 0, 0,
|
||||
{ fmtSoundAlarm, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_GL518_BEEP_ENABLE, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -424,19 +445,19 @@ static const char *adm1025_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor adm1025_features[] = {
|
||||
{ fmtVolts_2, ADM1025_ALARM_IN0, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN0, 0,
|
||||
{ SENSORS_ADM1025_IN0, SENSORS_ADM1025_IN0_MIN, SENSORS_ADM1025_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM1025_ALARM_IN1, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN1, 0,
|
||||
{ SENSORS_ADM1025_IN1, SENSORS_ADM1025_IN1_MIN, SENSORS_ADM1025_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM1025_ALARM_IN2, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN2, 0,
|
||||
{ SENSORS_ADM1025_IN2, SENSORS_ADM1025_IN2_MIN, SENSORS_ADM1025_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM1025_ALARM_IN3, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN3, 0,
|
||||
{ SENSORS_ADM1025_IN3, SENSORS_ADM1025_IN3_MIN, SENSORS_ADM1025_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM1025_ALARM_IN4, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN4, 0,
|
||||
{ SENSORS_ADM1025_IN4, SENSORS_ADM1025_IN4_MIN, SENSORS_ADM1025_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, ADM1025_ALARM_IN5, 0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN5, 0,
|
||||
{ SENSORS_ADM1025_IN5, SENSORS_ADM1025_IN5_MIN, SENSORS_ADM1025_IN5_MAX, -1 } },
|
||||
{ fmtTemps_1, ADM1025_ALARM_TEMP, 0,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, ADM1025_ALARM_TEMP, 0,
|
||||
{ SENSORS_ADM1025_TEMP1, SENSORS_ADM1025_TEMP1_OVER, SENSORS_ADM1025_TEMP1_HYST, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -453,37 +474,37 @@ static const char *w83781d_names[] = {
|
||||
|
||||
/* TODO: flags inverted for as99127f */
|
||||
static const FeatureDescriptor w83781d_features[] = {
|
||||
{ fmtVolts_2, W83781D_ALARM_IN0, W83781D_ALARM_IN0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0,
|
||||
{ SENSORS_W83781D_IN0, SENSORS_W83781D_IN0_MIN, SENSORS_W83781D_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN1, W83781D_ALARM_IN1,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1,
|
||||
{ SENSORS_W83781D_IN1, SENSORS_W83781D_IN1_MIN, SENSORS_W83781D_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN2, W83781D_ALARM_IN2,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2,
|
||||
{ SENSORS_W83781D_IN2, SENSORS_W83781D_IN2_MIN, SENSORS_W83781D_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN3, W83781D_ALARM_IN3,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3,
|
||||
{ SENSORS_W83781D_IN3, SENSORS_W83781D_IN3_MIN, SENSORS_W83781D_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN4, W83781D_ALARM_IN4,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4,
|
||||
{ SENSORS_W83781D_IN4, SENSORS_W83781D_IN4_MIN, SENSORS_W83781D_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN5, W83781D_ALARM_IN5,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5,
|
||||
{ SENSORS_W83781D_IN5, SENSORS_W83781D_IN5_MIN, SENSORS_W83781D_IN5_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN6, W83781D_ALARM_IN6,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6,
|
||||
{ SENSORS_W83781D_IN6, SENSORS_W83781D_IN6_MIN, SENSORS_W83781D_IN6_MAX, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1,
|
||||
{ SENSORS_W83781D_FAN1, SENSORS_W83781D_FAN1_MIN, SENSORS_W83781D_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2,
|
||||
{ SENSORS_W83781D_FAN2, SENSORS_W83781D_FAN2_MIN, SENSORS_W83781D_FAN2_DIV, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3,
|
||||
{ SENSORS_W83781D_FAN3, SENSORS_W83781D_FAN3_MIN, SENSORS_W83781D_FAN3_DIV, -1 } },
|
||||
{ fmtTemps_0, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1,
|
||||
{ fmtTemps_0, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1,
|
||||
{ SENSORS_W83781D_TEMP1, SENSORS_W83781D_TEMP1_OVER, SENSORS_W83781D_TEMP1_HYST, -1 } },
|
||||
{ fmtTemps_1, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2,
|
||||
{ SENSORS_W83781D_TEMP2, SENSORS_W83781D_TEMP2_OVER, SENSORS_W83781D_TEMP2_HYST, -1 } },
|
||||
{ fmtTemps_1, W83781D_ALARM_TEMP3, W83781D_ALARM_TEMP3,
|
||||
{ fmtTemps_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP3, W83781D_ALARM_TEMP3,
|
||||
{ SENSORS_W83781D_TEMP3, SENSORS_W83781D_TEMP3_OVER, SENSORS_W83781D_TEMP3_HYST, -1 } },
|
||||
{ fmtVolt_2, 0, 0,
|
||||
{ fmtVolt_2, rrdF2, DataType_voltage, 0, 0,
|
||||
{ SENSORS_W83781D_VID, -1 } },
|
||||
{ fmtChassisIntrusionDetection, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS,
|
||||
{ fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS,
|
||||
{ SENSORS_W83781D_ALARMS, -1 } },
|
||||
{ fmtSoundAlarm, 0, 0,
|
||||
{ fmtSoundAlarm, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_W83781D_BEEP_ENABLE, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -523,41 +544,41 @@ static const char *w83782d_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor w83782d_features[] = {
|
||||
{ fmtVolts_2, W83781D_ALARM_IN0, W83781D_ALARM_IN0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0,
|
||||
{ SENSORS_W83782D_IN0, SENSORS_W83782D_IN0_MIN, SENSORS_W83782D_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN1, W83781D_ALARM_IN1,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1,
|
||||
{ SENSORS_W83782D_IN1, SENSORS_W83782D_IN1_MIN, SENSORS_W83782D_IN1_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN2, W83781D_ALARM_IN2,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2,
|
||||
{ SENSORS_W83782D_IN2, SENSORS_W83782D_IN2_MIN, SENSORS_W83782D_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN3, W83781D_ALARM_IN3,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3,
|
||||
{ SENSORS_W83782D_IN3, SENSORS_W83782D_IN3_MIN, SENSORS_W83782D_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN4, W83781D_ALARM_IN4,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4,
|
||||
{ SENSORS_W83782D_IN4, SENSORS_W83782D_IN4_MIN, SENSORS_W83782D_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN5, W83781D_ALARM_IN5,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5,
|
||||
{ SENSORS_W83782D_IN5, SENSORS_W83782D_IN5_MIN, SENSORS_W83782D_IN5_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN6, W83781D_ALARM_IN6,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6,
|
||||
{ SENSORS_W83782D_IN6, SENSORS_W83782D_IN6_MIN, SENSORS_W83782D_IN6_MAX, -1 } },
|
||||
{ fmtVolts_2, W83782D_ALARM_IN7, W83782D_ALARM_IN7,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83782D_ALARM_IN7, W83782D_ALARM_IN7,
|
||||
{ SENSORS_W83782D_IN7, SENSORS_W83782D_IN7_MIN, SENSORS_W83782D_IN7_MAX, -1 } },
|
||||
{ fmtVolts_2, W83782D_ALARM_IN8, W83782D_ALARM_IN8,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83782D_ALARM_IN8, W83782D_ALARM_IN8,
|
||||
{ SENSORS_W83782D_IN8, SENSORS_W83782D_IN8_MIN, SENSORS_W83782D_IN8_MAX, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1,
|
||||
{ SENSORS_W83782D_FAN1, SENSORS_W83782D_FAN1_MIN, SENSORS_W83782D_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2,
|
||||
{ SENSORS_W83782D_FAN2, SENSORS_W83782D_FAN2_MIN, SENSORS_W83782D_FAN2_DIV, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3,
|
||||
{ SENSORS_W83782D_FAN3, SENSORS_W83782D_FAN3_MIN, SENSORS_W83782D_FAN3_DIV, -1 } },
|
||||
{ fmtTemps_W8378x_0, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1,
|
||||
{ fmtTemps_W8378x_0, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1,
|
||||
{ SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1_OVER, SENSORS_W83782D_TEMP1_HYST, SENSORS_W83782D_SENS1, -1 } },
|
||||
{ fmtTemps_W8378x_1, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2,
|
||||
{ fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2,
|
||||
{ SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2_OVER, SENSORS_W83782D_TEMP2_HYST, SENSORS_W83782D_SENS2, -1 } },
|
||||
{ fmtTemps_W8378x_1, W83781D_ALARM_TEMP3, W83781D_ALARM_TEMP3,
|
||||
{ fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP3, W83781D_ALARM_TEMP3,
|
||||
{ SENSORS_W83782D_TEMP3, SENSORS_W83782D_TEMP3_OVER, SENSORS_W83782D_TEMP3_HYST, SENSORS_W83782D_SENS3, -1 } },
|
||||
{ fmtVolt_2, 0, 0,
|
||||
{ fmtVolt_2, rrdF2, DataType_voltage, 0, 0,
|
||||
{ SENSORS_W83782D_VID, -1 } },
|
||||
{ fmtChassisIntrusionDetection, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS,
|
||||
{ fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS,
|
||||
{ SENSORS_W83781D_ALARMS, -1 } },
|
||||
{ fmtSoundAlarm, 0, 0,
|
||||
{ fmtSoundAlarm, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_W83781D_BEEP_ENABLE, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -573,31 +594,31 @@ static const char *w83783s_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor w83783s_features[] = {
|
||||
{ fmtVolts_2, W83781D_ALARM_IN0, W83781D_ALARM_IN0,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0,
|
||||
{ SENSORS_W83783S_IN0, SENSORS_W83783S_IN0_MIN, SENSORS_W83783S_IN0_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN2, W83781D_ALARM_IN2,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2,
|
||||
{ SENSORS_W83783S_IN2, SENSORS_W83783S_IN2_MIN, SENSORS_W83783S_IN2_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN3, W83781D_ALARM_IN3,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3,
|
||||
{ SENSORS_W83783S_IN3, SENSORS_W83783S_IN3_MIN, SENSORS_W83783S_IN3_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN4, W83781D_ALARM_IN4,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4,
|
||||
{ SENSORS_W83783S_IN4, SENSORS_W83783S_IN4_MIN, SENSORS_W83783S_IN4_MAX, -1 } },
|
||||
{ fmtVolts_2, W83781D_ALARM_IN5, W83781D_ALARM_IN5,
|
||||
{ fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5,
|
||||
{ SENSORS_W83783S_IN5, SENSORS_W83783S_IN5_MIN, SENSORS_W83783S_IN5_MAX, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1,
|
||||
{ SENSORS_W83783S_FAN1, SENSORS_W83783S_FAN1_MIN, SENSORS_W83783S_FAN1_DIV, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2,
|
||||
{ SENSORS_W83783S_FAN2, SENSORS_W83783S_FAN2_MIN, SENSORS_W83783S_FAN2_DIV, -1 } },
|
||||
{ fmtFans_0, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3,
|
||||
{ fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3,
|
||||
{ SENSORS_W83783S_FAN3, SENSORS_W83783S_FAN3_MIN, SENSORS_W83783S_FAN3_DIV, -1 } },
|
||||
{ fmtTemps_W8378x_0, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1,
|
||||
{ fmtTemps_W8378x_0, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1,
|
||||
{ SENSORS_W83783S_TEMP1, SENSORS_W83783S_TEMP1_OVER, SENSORS_W83783S_TEMP1_HYST, SENSORS_W83783S_SENS1, -1 } },
|
||||
{ fmtTemps_W8378x_1, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2,
|
||||
{ fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2,
|
||||
{ SENSORS_W83783S_TEMP2, SENSORS_W83783S_TEMP2_OVER, SENSORS_W83783S_TEMP2_HYST, SENSORS_W83783S_SENS2, -1 } },
|
||||
{ fmtVolt_2, 0, 0,
|
||||
{ fmtVolt_2, rrdF2, DataType_voltage, 0, 0,
|
||||
{ SENSORS_W83783S_VID, -1 } },
|
||||
{ fmtChassisIntrusionDetection, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS,
|
||||
{ fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS,
|
||||
{ SENSORS_W83781D_ALARMS, -1 } },
|
||||
{ fmtSoundAlarm, 0, 0,
|
||||
{ fmtSoundAlarm, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_W83781D_BEEP_ENABLE, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -616,6 +637,14 @@ fmtTemps_Maxilife
|
||||
return fmtTemps_1 (values, alarm, beep);
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdTemps_Maxilife
|
||||
(const double values[]) {
|
||||
if (!values[0] && !values[1] && !values[2])
|
||||
return NULL;
|
||||
return rrdF1 (values);
|
||||
}
|
||||
|
||||
static const char *
|
||||
fmtFans_Maxilife
|
||||
(const double values[], int alarm, int beep) {
|
||||
@@ -629,6 +658,19 @@ fmtFans_Maxilife
|
||||
return fmtExtra (alarm, beep);
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdFans_Maxilife
|
||||
(const double values[]) {
|
||||
if (!values[0] && !values[1] && !values[2])
|
||||
return NULL;
|
||||
if (values[0] < 0) {
|
||||
return NULL;
|
||||
} else {
|
||||
sprintf (buff, "%.0f", values[0] / values[2]);
|
||||
return buff;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
fmtMHz_Maxilife
|
||||
(const double values[], int alarm, int beep) {
|
||||
@@ -637,6 +679,14 @@ fmtMHz_Maxilife
|
||||
return fmtMHz_2 (values, alarm, beep);
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdMHz_Maxilife
|
||||
(const double values[]) {
|
||||
if (!values[0] && !values[1] && !values[2])
|
||||
return NULL;
|
||||
return rrdF2 (values);
|
||||
}
|
||||
|
||||
static const char *
|
||||
fmtVolts_Maxilife
|
||||
(const double values[], int alarm, int beep) {
|
||||
@@ -645,36 +695,44 @@ fmtVolts_Maxilife
|
||||
return fmtVolts_2 (values, alarm, beep);
|
||||
}
|
||||
|
||||
static const char *
|
||||
rrdVolts_Maxilife
|
||||
(const double values[]) {
|
||||
if (!values[0] && !values[1] && !values[2])
|
||||
return NULL;
|
||||
return rrdF2 (values);
|
||||
}
|
||||
|
||||
static const char *maxilife_names[] = {
|
||||
SENSORS_MAXI_CG_PREFIX, SENSORS_MAXI_CO_PREFIX, SENSORS_MAXI_AS_PREFIX, NULL
|
||||
};
|
||||
|
||||
static const FeatureDescriptor maxilife_features[] = {
|
||||
{ fmtTemps_Maxilife, 0, 0,
|
||||
{ fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, 0, 0,
|
||||
{ SENSORS_MAXI_CG_TEMP1, SENSORS_MAXI_CG_TEMP1_MAX, SENSORS_MAXI_CG_TEMP1_HYST, -1 } },
|
||||
{ fmtTemps_Maxilife, MAXI_ALARM_TEMP2, 0,
|
||||
{ fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, MAXI_ALARM_TEMP2, 0,
|
||||
{ SENSORS_MAXI_CG_TEMP2, SENSORS_MAXI_CG_TEMP2_MAX, SENSORS_MAXI_CG_TEMP2_HYST, -1 } },
|
||||
{ fmtTemps_Maxilife, 0, 0,
|
||||
{ fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, 0, 0,
|
||||
{ SENSORS_MAXI_CG_TEMP3, SENSORS_MAXI_CG_TEMP3_MAX, SENSORS_MAXI_CG_TEMP3_HYST, -1 } },
|
||||
{ fmtTemps_Maxilife, MAXI_ALARM_TEMP4, 0,
|
||||
{ fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, MAXI_ALARM_TEMP4, 0,
|
||||
{ SENSORS_MAXI_CG_TEMP4, SENSORS_MAXI_CG_TEMP4_MAX, SENSORS_MAXI_CG_TEMP4_HYST, -1 } },
|
||||
{ fmtTemps_Maxilife, MAXI_ALARM_TEMP5, 0,
|
||||
{ fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, MAXI_ALARM_TEMP5, 0,
|
||||
{ SENSORS_MAXI_CG_TEMP5, SENSORS_MAXI_CG_TEMP5_MAX, SENSORS_MAXI_CG_TEMP4_HYST, -1 } },
|
||||
{ fmtFans_Maxilife, MAXI_ALARM_FAN1, 0,
|
||||
{ fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN1, 0,
|
||||
{ SENSORS_MAXI_CG_FAN1, SENSORS_MAXI_CG_FAN1_MIN, SENSORS_MAXI_CG_FAN1_DIV, -1 } },
|
||||
{ fmtFans_Maxilife, MAXI_ALARM_FAN2, 0,
|
||||
{ fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN2, 0,
|
||||
{ SENSORS_MAXI_CG_FAN2, SENSORS_MAXI_CG_FAN2_MIN, SENSORS_MAXI_CG_FAN2_DIV, -1 } },
|
||||
{ fmtFans_Maxilife, MAXI_ALARM_FAN3, 0,
|
||||
{ fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN3, 0,
|
||||
{ SENSORS_MAXI_CG_FAN3, SENSORS_MAXI_CG_FAN3_MIN, SENSORS_MAXI_CG_FAN3_DIV, -1 } },
|
||||
{ fmtMHz_Maxilife, MAXI_ALARM_PLL, 0,
|
||||
{ fmtMHz_Maxilife, rrdMHz_Maxilife, DataType_mhz, MAXI_ALARM_PLL, 0,
|
||||
{ SENSORS_MAXI_CG_PLL, SENSORS_MAXI_CG_PLL_MIN, SENSORS_MAXI_CG_PLL_MAX, -1 } },
|
||||
{ fmtVolts_Maxilife, MAXI_ALARM_VID1, 0,
|
||||
{ fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID1, 0,
|
||||
{ SENSORS_MAXI_CG_VID1, SENSORS_MAXI_CG_VID1_MIN, SENSORS_MAXI_CG_VID1_MAX, -1 } },
|
||||
{ fmtVolts_Maxilife, MAXI_ALARM_VID2, 0,
|
||||
{ fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID2, 0,
|
||||
{ SENSORS_MAXI_CG_VID2, SENSORS_MAXI_CG_VID2_MIN, SENSORS_MAXI_CG_VID2_MAX, -1 } },
|
||||
{ fmtVolts_Maxilife, MAXI_ALARM_VID3, 0,
|
||||
{ fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID3, 0,
|
||||
{ SENSORS_MAXI_CG_VID3, SENSORS_MAXI_CG_VID3_MIN, SENSORS_MAXI_CG_VID3_MAX, -1 } },
|
||||
{ fmtVolts_Maxilife, MAXI_ALARM_VID4, 0,
|
||||
{ fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID4, 0,
|
||||
{ SENSORS_MAXI_CG_VID4, SENSORS_MAXI_CG_VID4_MIN, SENSORS_MAXI_CG_VID4_MAX, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -714,9 +772,9 @@ static const char *eeprom_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor eeprom_features[] = {
|
||||
{ fmtType_EEPROM, 0, 0,
|
||||
{ fmtType_EEPROM, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_EEPROM_TYPE, -1 } },
|
||||
{ fmtRowCol_EEPROM, 0, 0,
|
||||
{ fmtRowCol_EEPROM, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_EEPROM_ROWADDR, SENSORS_EEPROM_COLADDR, SENSORS_EEPROM_NUMROWS, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -747,15 +805,15 @@ static const char *ddcmon_names[] = {
|
||||
};
|
||||
|
||||
static const FeatureDescriptor ddcmon_features[] = {
|
||||
{ fmtID_DDCMON, 0, 0,
|
||||
{ fmtID_DDCMON, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_DDCMON_ID, -1 } },
|
||||
{ fmtInt, 0, 0,
|
||||
{ fmtInt, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_DDCMON_SERIAL, -1 } },
|
||||
{ fmtIntCrossInt, 0, 0,
|
||||
{ fmtIntCrossInt, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_DDCMON_VERSIZE, SENSORS_DDCMON_HORSIZE, -1 } },
|
||||
{ fmtIntDashInt, 0, 0,
|
||||
{ fmtIntDashInt, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_DDCMON_VERSYNCMIN, SENSORS_DDCMON_VERSYNCMAX, -1 } },
|
||||
{ fmtIntDashInt, 0, 0,
|
||||
{ fmtIntDashInt, NULL, DataType_other, 0, 0,
|
||||
{ SENSORS_DDCMON_HORSYNCMIN, SENSORS_DDCMON_HORSYNCMAX, -1 } },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* sensord
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* RRD is the Round Robin Database
|
||||
*
|
||||
* Get this package from:
|
||||
* http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool
|
||||
*
|
||||
* For compilation you need the development libraries;
|
||||
* for execution you need the runtime libraries; for
|
||||
* Web-based graph access you need the binary rrdtool.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <rrd.h>
|
||||
|
||||
#include "sensord.h"
|
||||
#include "lib/error.h"
|
||||
|
||||
#define DO_READ 0
|
||||
#define DO_SCAN 1
|
||||
#define DO_SET 2
|
||||
#define DO_RRD 3
|
||||
|
||||
/* one integer */
|
||||
#define STEP_BUFF 64
|
||||
/* RRA:AVERAGE:0.5:1:12345 */
|
||||
#define RRA_BUFF 256
|
||||
/* weak: max sensors for RRD .. TODO: fix */
|
||||
#define MAX_RRD_SENSORS 256
|
||||
/* DS:label:GAUGE:900:U:U | :3000 */
|
||||
#define RRD_BUFF 64
|
||||
|
||||
char rrdBuff[MAX_RRD_SENSORS * RRD_BUFF];
|
||||
|
||||
typedef int (*FeatureFN) (void *data, const char *rawLabel, char *label, const FeatureDescriptor *feature);
|
||||
|
||||
static int
|
||||
applyToFeatures
|
||||
(FeatureFN fn, void *data) {
|
||||
const sensors_chip_name *chip;
|
||||
int i = 0, j, ret = 0, num = 0;
|
||||
|
||||
while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) {
|
||||
for (j = 0; (ret == 0) && (j < numChipNames); ++ j) {
|
||||
if (sensors_match_chip (*chip, chipNames[j])) {
|
||||
int index0, subindex, chipindex = -1;
|
||||
for (index0 = 0; knownChips[index0]; ++ index0)
|
||||
for (subindex = 0; knownChips[index0]->names[subindex]; ++ subindex)
|
||||
if (!strcmp (chip->prefix, knownChips[index0]->names[subindex]))
|
||||
chipindex = index0;
|
||||
if (chipindex >= 0) {
|
||||
const ChipDescriptor *descriptor = knownChips[chipindex];
|
||||
const FeatureDescriptor *features = descriptor->features;
|
||||
|
||||
for (index0 = 0; (ret == 0) && features[index0].format; ++ index0) {
|
||||
const FeatureDescriptor *feature = features + index0;
|
||||
int labelNumber = feature->dataNumbers[0];
|
||||
const char *rawLabel = NULL;
|
||||
char *label = NULL;
|
||||
int valid = 0;
|
||||
if (getValid (*chip, labelNumber, &valid)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber);
|
||||
ret = -1;
|
||||
} else if (getRawLabel (*chip, labelNumber, &rawLabel)) {
|
||||
sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber);
|
||||
ret = -1;
|
||||
} else if (getLabel (*chip, labelNumber, &label)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber);
|
||||
ret = -1;
|
||||
} else if (valid) {
|
||||
ret = fn (data, rawLabel, label, feature);
|
||||
}
|
||||
if (label)
|
||||
free (label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct ds {
|
||||
int num;
|
||||
const char **argv;
|
||||
};
|
||||
|
||||
static int
|
||||
rrdGetSensors_DS
|
||||
(void *_data, const char *rawLabel, char *label, const FeatureDescriptor *feature) {
|
||||
if (feature->rrd) {
|
||||
struct ds *data = (struct ds *) _data;
|
||||
char *ptr = rrdBuff + data->num * RRD_BUFF;
|
||||
data->argv[data->num ++] = ptr;
|
||||
sprintf (ptr, "DS:%s:GAUGE:%d:U:U", rawLabel, /* number of seconds downtime during which average be used instead of unknown */ 5 * rrdTime);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rrdGetSensors
|
||||
(const char **argv) {
|
||||
int ret = 0;
|
||||
struct ds data = { 0, argv};
|
||||
ret = applyToFeatures (rrdGetSensors_DS, &data);
|
||||
return ret ? -1 : data.num;
|
||||
}
|
||||
|
||||
int
|
||||
rrdInit
|
||||
(void) {
|
||||
int ret = 0;
|
||||
struct stat tmp;
|
||||
|
||||
sensorLog (LOG_DEBUG, "sensor RRD init");
|
||||
if (stat (rrdFile, &tmp)) {
|
||||
if (errno == ENOENT) {
|
||||
char stepBuff[STEP_BUFF], rraBuff[RRA_BUFF];
|
||||
int argc = 4, num;
|
||||
const char *argv[6 + MAX_RRD_SENSORS] = {
|
||||
"sensord", rrdFile, "-s", stepBuff
|
||||
};
|
||||
|
||||
sensorLog (LOG_INFO, "creating round robin database");
|
||||
num = rrdGetSensors (argv + argc);
|
||||
if (num == 0) {
|
||||
sensorLog (LOG_ERR, "Error creating RRD: %s: %s", rrdFile, "No sensors detected");
|
||||
ret = 2;
|
||||
} else if (num < 0) {
|
||||
ret = -num;
|
||||
} else {
|
||||
sprintf (stepBuff, "%d", rrdTime);
|
||||
sprintf (rraBuff, "RRA:AVERAGE:%f:%d:%d", 0.5 /* fraction of non-unknown samples needed per entry */, 1 /* samples per entry */, 7 * 24 * 60 * 60 / rrdTime /* 1 week */);
|
||||
argc += num;
|
||||
argv[argc ++] = rraBuff;
|
||||
argv[argc] = NULL;
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
optopt = '?';
|
||||
optarg = NULL;
|
||||
if ((ret = rrd_create (argc, (char **) /* WEAK */ argv))) {
|
||||
sensorLog (LOG_ERR, "Error creating RRD file: %s: %s", rrdFile, rrd_get_error ());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sensorLog (LOG_ERR, "Error stat()ing RRD: %s: %s", rrdFile, strerror (errno));
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
sensorLog (LOG_DEBUG, "sensor RRD inited");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define RRDCGI "/usr/bin/rrdcgi"
|
||||
#define WWWDIR "/sensord"
|
||||
|
||||
struct gr {
|
||||
DataType type;
|
||||
char *h2;
|
||||
char *image;
|
||||
char *title;
|
||||
char *axisTitle;
|
||||
char *axisDefn;
|
||||
char *options;
|
||||
};
|
||||
|
||||
static int
|
||||
rrdCGI_DEF
|
||||
(void *_data, const char *rawLabel, char *label, const FeatureDescriptor *feature) {
|
||||
struct gr *data = (struct gr *) _data;
|
||||
if (feature->rrd && (feature->type == data->type))
|
||||
printf ("\n\tDEF:%s=%s:%s:AVERAGE", rawLabel, rrdFile, rawLabel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rrdCGI_LINE
|
||||
(void *_data, const char *rawLabel, char *label, const FeatureDescriptor *feature) {
|
||||
struct gr *data = (struct gr *) _data;
|
||||
if (feature->rrd && (feature->type == data->type))
|
||||
printf ("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel, random () & 0xffffff, label);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct gr graphs[] = {
|
||||
{
|
||||
DataType_temperature,
|
||||
"Daily Temperature Summary",
|
||||
"daily-temperature",
|
||||
"Temperature",
|
||||
"Temperature (C)",
|
||||
"HOUR:1:HOUR:3:HOUR:3:0:%b %d %H:00",
|
||||
"-s -1d -l 0"
|
||||
}, {
|
||||
DataType_rpm,
|
||||
"Daily Fan Speed Summary",
|
||||
"daily-rpm",
|
||||
"Fan Speed",
|
||||
"Speed (RPM)",
|
||||
"HOUR:1:HOUR:3:HOUR:3:0:%b %d %H:00",
|
||||
"-s -1d -l 0"
|
||||
}, {
|
||||
DataType_voltage,
|
||||
"Daily Voltage Summary",
|
||||
"daily-voltage",
|
||||
"Power Supply",
|
||||
"Voltage (V)",
|
||||
"HOUR:1:HOUR:3:HOUR:3:0:%b %d %H:00",
|
||||
"-s -1d --alt-autoscale"
|
||||
}, {
|
||||
DataType_temperature,
|
||||
"Weekly Temperature Summary",
|
||||
"weekly-temperature",
|
||||
"Temperature",
|
||||
"Temperature (C)",
|
||||
"HOUR:6:DAY:1:DAY:1:86400:%a %b %d",
|
||||
"-s -1w -l 0"
|
||||
}, {
|
||||
DataType_rpm,
|
||||
"Weekly Fan Speed Summary",
|
||||
"weekly-rpm",
|
||||
"Fan Speed",
|
||||
"Speed (RPM)",
|
||||
"HOUR:6:DAY:1:DAY:1:86400:%a %b %d",
|
||||
"-s -1w -l 0"
|
||||
}, {
|
||||
DataType_voltage,
|
||||
"Weekly Voltage Summary",
|
||||
"weekly-voltage",
|
||||
"Power Supply",
|
||||
"Voltage (V)",
|
||||
"HOUR:6:DAY:1:DAY:1:86400:%a %b %d",
|
||||
"-s -1w --alt-autoscale"
|
||||
}, {
|
||||
DataType_other
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
rrdUpdate
|
||||
(void) {
|
||||
int ret = rrdChips ();
|
||||
|
||||
if (!ret) {
|
||||
const char *argv[] = {
|
||||
"sensord", rrdFile, rrdBuff, NULL
|
||||
};
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
optopt = '?';
|
||||
optarg = NULL;
|
||||
if ((ret = rrd_update (3, (char **) /* WEAK */ argv))) {
|
||||
sensorLog (LOG_ERR, "Error updating RRD file: %s: %s", rrdFile, rrd_get_error ());
|
||||
}
|
||||
}
|
||||
sensorLog (LOG_DEBUG, "sensor rrd updated");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
rrdCGI
|
||||
(void) {
|
||||
int ret = 0;
|
||||
struct gr *graph = graphs;
|
||||
|
||||
printf ("#!" RRDCGI "\n\n<HTML>\n<HEAD>\n<TITLE>sensord</TITLE>\n</HEAD>\n<BODY>\n<H1>sensord</H1>\n");
|
||||
while (graph->type != DataType_other) {
|
||||
printf ("<H2>%s</H2>\n", graph->h2);
|
||||
printf ("<P>\n<RRD::GRAPH %s/%s.png\n\t--imginfo '<IMG SRC=" WWWDIR "/%%s WIDTH=%%lu HEIGHT=%%lu>'\n\t-a PNG\n\t-h 200 -w 800\n", cgiDir, graph->image);
|
||||
printf ("\t--lazy\n\t-v '%s'\n\t-t '%s'\n\t-x '%s'\n\t%s", graph->axisTitle, graph->title, graph->axisDefn, graph->options);
|
||||
if (!ret)
|
||||
ret = applyToFeatures (rrdCGI_DEF, graph);
|
||||
if (!ret)
|
||||
ret = applyToFeatures (rrdCGI_LINE, graph);
|
||||
printf (">\n</P>\n");
|
||||
++ graph;
|
||||
}
|
||||
printf ("<p>\n<small><b>sensord</b> by <a href=\"mailto:merlin@merlin.org\">Merlin Hughes</a>, all credit to the <a href=\"http://www.lm-sensors.nu/\">lm_sensors</a> crew.</small>\n</p>\n");
|
||||
printf ("</BODY>\n</HTML>\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
+71
-20
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,14 +31,13 @@
|
||||
#define DO_READ 0
|
||||
#define DO_SCAN 1
|
||||
#define DO_SET 2
|
||||
#define DO_RRD 3
|
||||
|
||||
static int
|
||||
getLabelAndValid
|
||||
(sensors_chip_name name, int feature, char **label, int *valid) {
|
||||
int
|
||||
getValid
|
||||
(sensors_chip_name name, int feature, int *valid) {
|
||||
int err;
|
||||
err = sensors_get_label (name, feature, label);
|
||||
if (!err)
|
||||
err = sensors_get_ignored (name, feature);
|
||||
err = sensors_get_ignored (name, feature);
|
||||
if (err >= 0) {
|
||||
*valid = err;
|
||||
err = 0;
|
||||
@@ -46,6 +45,31 @@ getLabelAndValid
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
getLabel
|
||||
(sensors_chip_name name, int feature, char **label) {
|
||||
int err;
|
||||
err = sensors_get_label (name, feature, label);
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
getRawLabel
|
||||
(sensors_chip_name name, int feature, const char **label) {
|
||||
const sensors_feature_data *rawFeature;
|
||||
int nr1 = 0, nr2 = 0, err = 0;
|
||||
do {
|
||||
rawFeature = sensors_get_all_features (name, &nr1, &nr2);
|
||||
} while (rawFeature && (rawFeature->number != feature));
|
||||
/* TODO: Ensure labels match RRD construct and are not repeated! */
|
||||
if (!rawFeature) {
|
||||
err = -1;
|
||||
} else {
|
||||
*label = rawFeature->name;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static const char *
|
||||
chipName
|
||||
(const sensors_chip_name *chip) {
|
||||
@@ -88,16 +112,19 @@ readUnknownChip
|
||||
int valid = 0;
|
||||
double value;
|
||||
|
||||
if (getLabelAndValid (*chip, sensor->number, &label, &valid)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name);
|
||||
if (getValid (*chip, sensor->number, &valid)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor validity: %s/%s", chip->prefix, sensor->name);
|
||||
ret = 20;
|
||||
} else if (getLabel (*chip, sensor->number, &label)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name);
|
||||
ret = 21;
|
||||
} else if (!valid) {
|
||||
/* skip invalid */
|
||||
} else if (!(sensor->mode & SENSORS_MODE_R)) {
|
||||
sensorLog (LOG_INFO, "%s: %s", sensor->name, label);
|
||||
} else if ((ret = sensors_get_feature (*chip, sensor->number, &value))) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor data: %s/%s: %s", chip->prefix, sensor->name, sensors_strerror (ret));
|
||||
ret = 21;
|
||||
ret = 22;
|
||||
} else {
|
||||
sensorLog (LOG_INFO, " %s%s: %.2f", (sensor->mapping == SENSORS_NO_MAPPING) ? "" : "-", label, value);
|
||||
}
|
||||
@@ -145,7 +172,10 @@ doKnownChip
|
||||
|
||||
if ((action == DO_SCAN) && !alarm) {
|
||||
continue;
|
||||
} else if (getLabelAndValid (*chip, labelNumber, &label, &valid)) {
|
||||
} else if (getValid (*chip, labelNumber, &valid)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber);
|
||||
ret = 22;
|
||||
} else if (getLabel (*chip, labelNumber, &label)) {
|
||||
sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber);
|
||||
ret = 22;
|
||||
} else if (valid) {
|
||||
@@ -158,12 +188,19 @@ doKnownChip
|
||||
}
|
||||
}
|
||||
if (ret == 0) {
|
||||
const char *formatted = feature->format (values, alarm, beep);
|
||||
if (formatted) {
|
||||
if (action == DO_READ) {
|
||||
sensorLog (LOG_INFO, " %s: %s", label, formatted);
|
||||
} else {
|
||||
sensorLog (LOG_ALERT, "Sensor alarm: Chip %s: %s: %s", chipName (chip), label, formatted);
|
||||
if (action == DO_RRD) { // arse = "N:"
|
||||
if (feature->rrd) {
|
||||
const char *rrded = feature->rrd (values);
|
||||
strcat (strcat (rrdBuff, ":"), rrded ? rrded : "U");
|
||||
}
|
||||
} else {
|
||||
const char *formatted = feature->format (values, alarm, beep);
|
||||
if (formatted) {
|
||||
if (action == DO_READ) {
|
||||
sensorLog (LOG_INFO, " %s: %s", label, formatted);
|
||||
} else {
|
||||
sensorLog (LOG_ALERT, "Sensor alarm: Chip %s: %s: %s", chipName (chip), label, formatted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,10 +253,9 @@ doChips
|
||||
int i = 0, j, ret = 0;
|
||||
|
||||
while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) {
|
||||
for (j = 0; j < numChipNames; ++ j) {
|
||||
for (j = 0; (ret == 0) && (j < numChipNames); ++ j) {
|
||||
if (sensors_match_chip (*chip, chipNames[j])) {
|
||||
ret = doChip (chip, action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +280,7 @@ scanChips
|
||||
(void) {
|
||||
int ret = 0;
|
||||
|
||||
sensorLog (LOG_DEBUG, "sensor sweeep started");
|
||||
sensorLog (LOG_DEBUG, "sensor sweep started"); /* only logged in debug mode */
|
||||
ret = doChips (DO_SCAN);
|
||||
sensorLog (LOG_DEBUG, "sensor sweep finished");
|
||||
|
||||
@@ -263,3 +299,18 @@ setChips
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* TODO: loadavg entry */
|
||||
|
||||
int
|
||||
rrdChips
|
||||
(void) {
|
||||
int ret = 0;
|
||||
|
||||
strcpy (rrdBuff, "N");
|
||||
|
||||
sensorLog (LOG_DEBUG, "sensor rrd started");
|
||||
ret = doChips (DO_RRD);
|
||||
sensorLog (LOG_DEBUG, "sensor rrd finished");
|
||||
|
||||
return ret;
|
||||
}
|
||||
+152
-19
@@ -1,4 +1,4 @@
|
||||
.\" Copyright 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
.\" Copyright 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
.\" sensord is distributed under the GPL
|
||||
.\"
|
||||
.\" Permission is granted to make and distribute verbatim copies of this
|
||||
@@ -21,7 +21,7 @@
|
||||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
.\" the source, must acknowledge the copyright and authors of this work.
|
||||
.\"
|
||||
.TH sensord 8 "February 11, 2001" "Version 0.5.0" "Linux System Administration"
|
||||
.TH sensord 8 "April 27, 2002" "Version 0.6.0" "Linux System Administration"
|
||||
.SH NAME
|
||||
sensord \- Sensor information logging daemon.
|
||||
.SH SYNOPSIS
|
||||
@@ -36,6 +36,7 @@ sensord \- Sensor information logging daemon.
|
||||
is a daemon that can be used to periodically log sensor readings from
|
||||
hardware health-monitoring chips to
|
||||
.BR syslog (3)
|
||||
or a round-robin database (RRD)
|
||||
and to alert when a sensor alarm is signalled; for example, if a
|
||||
fan fails, a temperature limit is exceeded, etc.
|
||||
|
||||
@@ -62,6 +63,34 @@ The time is specified as before; e.g., `30m'.
|
||||
|
||||
Specify an interval of zero to suppress logging of regular sensor
|
||||
readings.
|
||||
.IP "-t, --rrd-interval time"
|
||||
Specify the interval between logging all sensor readings to a round-robin
|
||||
database; the default is to log all readings every five minutes
|
||||
.B if
|
||||
a round-robin database is configured.
|
||||
|
||||
The time is specified as before; e.g., `5m'.
|
||||
.IP "-r, --rrd-file file"
|
||||
Specify a round-robin database into which to log all sensor readings;
|
||||
e.g., `/var/log/sensord.rrd'. This database will be created if it does
|
||||
not exist. By default, no round-robin database is used.
|
||||
|
||||
See the section
|
||||
.B ROUND ROBIN DATABASES
|
||||
below for more details.
|
||||
.IP "-c, --config-file file"
|
||||
Specify a
|
||||
.BR libsensors (3)
|
||||
configuration file. If no file is specified, the name `sensors.conf'
|
||||
is used.
|
||||
|
||||
If the sensors configuration name does not contain a directory separator,
|
||||
the following paths are searched for the file:
|
||||
`/etc', `/usr/lib/sensors', `/usr/local/lib/sensors', `/usr/lib', `/usr/local/lib'.
|
||||
.IP "-p, --pid-file file"
|
||||
Specify what PID file to write; the default is to write the file
|
||||
`/var/run/sensord.pid'. You should always specify an absolute path
|
||||
here. The file is removed when the daemon exits.
|
||||
.IP "-f, --syslog-facility facility"
|
||||
Specify the
|
||||
.BR syslog (3)
|
||||
@@ -76,19 +105,16 @@ through
|
||||
.IR daemon
|
||||
or
|
||||
.IR user .
|
||||
.IP "-c, --config-file file"
|
||||
Specify a
|
||||
.BR libsensors (3)
|
||||
configuration file. If no file is specified, the name `sensors.conf'
|
||||
is used.
|
||||
|
||||
If the sensors configuration name does not contain a directory separator,
|
||||
the following paths are searched for the file:
|
||||
`/etc', `/usr/lib/sensors', `/usr/local/lib/sensors', `/usr/lib', `/usr/local/lib'.
|
||||
.IP "-p, --pid-file file"
|
||||
Specify what PID file to write; the default is to write the file
|
||||
`/var/run/sensord.pid'. You should always specify an absolute path
|
||||
here. The file is removed when the daemon exits.
|
||||
.IP "-g, --rrd-cgi directory"
|
||||
Prints out a sample
|
||||
.BR rrdcgi (1)
|
||||
CGI script that can be used to display graphs of recent sensor information
|
||||
in a Web page, and exits. You must specify the world-writable, Web-accessible
|
||||
directory where the graphs should be stored; the CGI script assumes that
|
||||
this will be accessed under the `/sensord/' directory on the Webserver. See
|
||||
the section
|
||||
.B ROUND ROBIN DATABASES
|
||||
below for more details.
|
||||
.IP "-d, --debug"
|
||||
Prints a small amount of additional debugging information.
|
||||
.IP "-h, --help"
|
||||
@@ -206,6 +232,113 @@ BIOS.
|
||||
If you see `(beep)' beside any sensor reading, that just means that
|
||||
your system is configured to issue an audio warning from the
|
||||
motherboard if an alarm is signalled on that sensor.
|
||||
.SH ROUND ROBIN DATABASES
|
||||
.BR Sensord (8)
|
||||
provides support for storing sensor readings in a round-robin
|
||||
database. This may be a useful alternative to the use of
|
||||
.BR syslog (3).
|
||||
|
||||
Round-robin databases are
|
||||
constant-size databases that can be used to store, for example,
|
||||
a week's worth of sensor readings. Subsequent readings stored
|
||||
in the database will overwrite readings that are over a week
|
||||
old. This capability is extremely useful because it allows
|
||||
useful information to be stored in an easily-accessible
|
||||
manner for a useful length of time, without the burden of
|
||||
ever-growing log files.
|
||||
|
||||
The
|
||||
.BR rrdtool (1)
|
||||
utility and its associated library provide the basic framework for
|
||||
the round-robin database beneath
|
||||
.BR sensord (8).
|
||||
In addition, the
|
||||
.BR rrdcgi (1)
|
||||
and
|
||||
.BR rrdgraph (1)
|
||||
utilities provide support for generating graphs of these data for
|
||||
display in a Web page.
|
||||
|
||||
If you wish to use the default configuration of round-robin
|
||||
database, which holds one week of sensor readings at five-minute
|
||||
intervals, then simply start
|
||||
.BR sensord (8)
|
||||
and specify where you want the database stored. It will automatically
|
||||
be created and configured using these default parameters.
|
||||
|
||||
If you wish readings to be stored for a longer period, or want multiple
|
||||
readings to be averaged into each database entry, then you must
|
||||
manually create and configure the database before starting
|
||||
.BR sensord (8).
|
||||
Consult the
|
||||
.BR rrdcreate (1)
|
||||
manual for details. Note that the database must match exactly the
|
||||
names and order of sensors read by
|
||||
.BR sensord (8).
|
||||
It is recommended that you create the default database and then use
|
||||
.BR rrdinfo (1)
|
||||
to obtain this information.
|
||||
|
||||
After creating the round-robin database, you must then configure
|
||||
your Web server to display the sensor information. This assumes that
|
||||
you have a Web server preconfigured and functioning on your machine.
|
||||
.BR Sensord (8)
|
||||
provides a command-line option
|
||||
.BR --rrd-cgi
|
||||
to generate a basic CGI script to
|
||||
display these graphs; you can then customize this script as desired.
|
||||
Consult the
|
||||
.BR rrdcgi (1)
|
||||
manual for details. This CGI script requires a world-writable, Web-accessible
|
||||
directory into which to write the graphs that it generates.
|
||||
|
||||
An example of how to set up Web-accessible graphs of recent sensor readings
|
||||
follows:
|
||||
.IP
|
||||
.nf
|
||||
sensord -i 0 -r /var/log/sensord.rrd
|
||||
.fi
|
||||
.PP
|
||||
Here, we start
|
||||
.BR sensord (8)
|
||||
and configure it to store readings in a round-robin database; note
|
||||
that we disable logging of sensor readings to
|
||||
.BR syslog (3).
|
||||
.IP
|
||||
.nf
|
||||
mkdir /var/www/sensord
|
||||
chown www-data:staff /var/www/sensord
|
||||
chmod a=rwxs /var/www/sensord
|
||||
.fi
|
||||
.PP
|
||||
Here, we create a world-writable, Web-accessible directory in which
|
||||
graphs will be stored; we set the ownership and permissions on this
|
||||
directory appropriately. You will have to determine the location and
|
||||
ownership that is appropriate for your machine.
|
||||
.IP
|
||||
.nf
|
||||
sensord --rrd-file /var/log/sensord.rrd \\
|
||||
--rrd-cgi /var/www/sensord \\
|
||||
> /usr/lib/cgi-bin/sensord.cgi
|
||||
chmod a+rx /usr/lib/cgi-bin/sensord.cgi
|
||||
.fi
|
||||
.PP
|
||||
Here, we create
|
||||
a CGI script that will display sensor readings from the database.
|
||||
You must specify the location of the round-robin database and the
|
||||
location of the directory where the images should be stored. The
|
||||
.BR --rrd-cgi
|
||||
command-line parameter causes
|
||||
.BR sensord (8)
|
||||
to display a suitable CGI script on
|
||||
.BR stdout
|
||||
and then to exit. You will need to write this script to the CGI
|
||||
bin directory of your Web server,
|
||||
and edit the script if the image directory you chose is not the
|
||||
`/sensord/' directory of your Web server.
|
||||
|
||||
Finally, you should be able to view your sensor readings from
|
||||
the URL `http://localhost/cgi-bin/sensord.cgi'.
|
||||
.SH MODULES
|
||||
It is expected that all required sensor modules are loaded prior to
|
||||
this daemon being started. This can either be achieved with a system
|
||||
@@ -240,7 +373,8 @@ after which the daemon will exit.
|
||||
.B Sensord
|
||||
doesn't yet cope with the flipped alarm bits on
|
||||
.IR AS99127F
|
||||
chips.
|
||||
chips. Round-robin database support doesn't cope with
|
||||
multiple sensor chips having duplicate sensor labels.
|
||||
.SH FILES
|
||||
.I /etc/sensors.conf
|
||||
.RS
|
||||
@@ -269,8 +403,7 @@ sensors.conf(5)
|
||||
was written by Merlin Hughes <merlin@merlin.org>. Chip-specific formatting
|
||||
code was ripped from
|
||||
.BR sensors
|
||||
which was written by Frodo Looijaard <frodol@dds.nl>.
|
||||
|
||||
|
||||
which was written by Frodo Looijaard <frodol@dds.nl>. Basics of round-robin
|
||||
databases were misappropriated from Mark D. Studebaker <mdsxyz123@yahoo.com>.
|
||||
|
||||
|
||||
+31
-16
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
@@ -74,14 +75,14 @@ static int
|
||||
sensord
|
||||
(void) {
|
||||
int ret = 0;
|
||||
int scanValue = 0, logValue = 0;
|
||||
int scanValue = 0, logValue = 0, rrdValue = 0;
|
||||
|
||||
sensorLog (LOG_INFO, "sensord started");
|
||||
|
||||
while (!done && (ret == 0)) {
|
||||
if (ret == 0)
|
||||
ret = reloadLib ();
|
||||
if ((ret == 0) && scanTime) {
|
||||
if ((ret == 0) && scanTime) { /* should I scan on the read cycle? */
|
||||
ret = scanChips ();
|
||||
if (scanValue <= 0)
|
||||
scanValue += scanTime;
|
||||
@@ -90,18 +91,19 @@ sensord
|
||||
ret = readChips ();
|
||||
logValue += logTime;
|
||||
}
|
||||
if ((ret == 0) && rrdTime && rrdFile && (rrdValue <= 0)) {
|
||||
ret = rrdUpdate ();
|
||||
rrdValue += rrdTime;
|
||||
}
|
||||
if (!done && (ret == 0)) {
|
||||
int sleepTime;
|
||||
if (!logTime) {
|
||||
sleepTime = scanValue;
|
||||
} else if (!scanTime) {
|
||||
sleepTime = logValue;
|
||||
} else {
|
||||
sleepTime = (scanValue < logValue) ? scanValue : logValue;
|
||||
}
|
||||
int a = logTime ? logValue : INT_MAX;
|
||||
int b = scanTime ? scanValue : INT_MAX;
|
||||
int c = (rrdTime && rrdFile) ? rrdValue : INT_MAX;
|
||||
int sleepTime = (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
|
||||
sleep (sleepTime);
|
||||
scanValue -= sleepTime;
|
||||
logValue -= sleepTime;
|
||||
rrdValue -= sleepTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +112,13 @@ sensord
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
openLog
|
||||
(void) {
|
||||
openlog ("sensord", 0, syslogFacility);
|
||||
logOpened = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
daemonize
|
||||
(void) {
|
||||
@@ -117,10 +126,6 @@ daemonize
|
||||
struct stat fileStat;
|
||||
FILE *file;
|
||||
|
||||
openlog ("sensord", 0, syslogFacility);
|
||||
|
||||
logOpened = 1;
|
||||
|
||||
if (chdir ("/") < 0) {
|
||||
perror ("chdir()");
|
||||
exit (EXIT_FAILURE);
|
||||
@@ -182,8 +187,16 @@ main
|
||||
if (initLib () ||
|
||||
loadLib ())
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (isDaemon)
|
||||
openLog ();
|
||||
if (rrdFile)
|
||||
ret = rrdInit ();
|
||||
|
||||
if (isDaemon) {
|
||||
if (ret) {
|
||||
} else if (doCGI) {
|
||||
ret = rrdCGI ();
|
||||
} else if (isDaemon) {
|
||||
daemonize ();
|
||||
ret = sensord ();
|
||||
undaemonize ();
|
||||
@@ -192,6 +205,8 @@ main
|
||||
ret = setChips ();
|
||||
else if (doScan)
|
||||
ret = scanChips ();
|
||||
else if (rrdFile)
|
||||
ret = rrdUpdate ();
|
||||
else
|
||||
ret = readChips ();
|
||||
}
|
||||
|
||||
+30
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* A daemon that periodically logs sensor information to syslog.
|
||||
*
|
||||
* Copyright (c) 1999-2001 Merlin Hughes <merlin@merlin.org>
|
||||
* Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +20,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define version "0.5.0"
|
||||
#define version "0.6.0"
|
||||
|
||||
#include "lib/sensors.h"
|
||||
|
||||
@@ -31,11 +31,15 @@ extern void sensorLog (int priority, const char *fmt, ...);
|
||||
extern int isDaemon;
|
||||
extern const char *sensorsCfgFile;
|
||||
extern const char *pidFile;
|
||||
extern const char *rrdFile;
|
||||
extern const char *cgiDir;
|
||||
extern int scanTime;
|
||||
extern int logTime;
|
||||
extern int rrdTime;
|
||||
extern int syslogFacility;
|
||||
extern int doScan;
|
||||
extern int doSet;
|
||||
extern int doCGI;
|
||||
extern int debug;
|
||||
extern sensors_chip_name chipNames[];
|
||||
extern int numChipNames;
|
||||
@@ -52,9 +56,21 @@ extern int unloadLib (void);
|
||||
|
||||
/* from sense.c */
|
||||
|
||||
extern int getValid (sensors_chip_name name, int feature, int *valid);
|
||||
extern int getLabel (sensors_chip_name name, int feature, char **label);
|
||||
extern int getRawLabel (sensors_chip_name name, int feature, const char **label);
|
||||
|
||||
extern int readChips (void);
|
||||
extern int scanChips (void);
|
||||
extern int setChips (void);
|
||||
extern int rrdChips (void);
|
||||
|
||||
/* from rrd.c */
|
||||
|
||||
extern char rrdBuff[];
|
||||
extern int rrdInit (void);
|
||||
extern int rrdUpdate (void);
|
||||
extern int rrdCGI (void);
|
||||
|
||||
/* from chips.c */
|
||||
|
||||
@@ -62,8 +78,20 @@ extern int setChips (void);
|
||||
|
||||
typedef const char * (*FormatterFN) (const double values[], int alarm, int beep);
|
||||
|
||||
typedef const char * (*RRDFN) (const double values[]);
|
||||
|
||||
typedef enum {
|
||||
DataType_voltage = 0,
|
||||
DataType_rpm,
|
||||
DataType_temperature,
|
||||
DataType_mhz,
|
||||
DataType_other = -1
|
||||
} DataType;
|
||||
|
||||
typedef struct {
|
||||
FormatterFN format;
|
||||
RRDFN rrd;
|
||||
DataType type;
|
||||
int alarmMask;
|
||||
int beepMask;
|
||||
const int dataNumbers[MAX_DATA + 1]; /* First entry is used for the label */
|
||||
|
||||
Reference in new issue
Block a user