1
diff --git a/agent/mibgroup/ucd-snmp/lmSensors.c b/agent/mibgroup/ucd-snmp/lmSensors.c
2
index d7dbd98..8f9fcd2 100644
3
--- a/agent/mibgroup/ucd-snmp/lmSensors.c
4
+++ b/agent/mibgroup/ucd-snmp/lmSensors.c
5
@@ -390,7 +390,7 @@ static int
1
Index: net-snmp-5.4.3/agent/mibgroup/ucd-snmp/lmSensors.c
2
===================================================================
3
--- net-snmp-5.4.3.orig/agent/mibgroup/ucd-snmp/lmSensors.c 2010-06-04 18:04:58.000000000 +0200
4
+++ net-snmp-5.4.3/agent/mibgroup/ucd-snmp/lmSensors.c 2010-06-04 18:06:48.000000000 +0200
6
#include </usr/platform/sun4u/include/sys/envctrl.h>
8
#include <sensors/sensors.h>
9
- #define CONFIG_FILE_NAME "/etc/sensors.conf"
12
#include "lmSensors.h"
14
size_t * var_len, WriteMethod ** write_method)
17
- static unsigned char string[SPRINT_MAX_LEN];
18
+ static char string[SPRINT_MAX_LEN];
26
- char filename[] = CONFIG_FILE_NAME;
27
time_t t = time(NULL);
28
- FILE *fp = fopen(filename, "r");
31
DEBUGMSG(("ucd-snmp/lmSensors", "=> sensor_init\n"));
33
sensor_array[i].sensor = NULL;
42
- if (sensors_init(fp))
43
+ if (sensors_init(NULL))
12
54
if (t > timestamp + 7) /* this may require some tuning - currently 7 seconds*/
14
@@ -962,77 +962,78 @@ else{
57
#else /* end solaris2 only ie. ifdef everything else */
59
const sensors_chip_name *chip;
60
- const sensors_feature_data *data;
61
+ const sensors_feature *feature;
62
+ const sensors_subfeature *subfeature;
67
sensor_array[i].current_len = DEFAULT_SENSORS;
17
while ((chip = sensors_get_detected_chips(&chip_nr))) {
70
- while ((chip = sensors_get_detected_chips(&chip_nr))) {
23
74
- while ((data = sensors_get_all_features(*chip, &a, &b))) {
24
75
- char *label = NULL;
26
+ while ((data = sensors_get_all_features(*chip, &a, &b))) {
30
78
- if ((data->mode & SENSORS_MODE_R) &&
31
79
- (data->mapping == SENSORS_NO_MAPPING) &&
32
80
- !sensors_get_label(*chip, data->number, &label) &&
36
84
- _sensor_array *array;
37
+ if ((data->mode & SENSORS_MODE_R) &&
38
+ (data->mapping == SENSORS_NO_MAPPING) &&
39
+ !sensors_get_label(*chip, data->number, &label) &&
40
+ !sensors_get_feature(*chip, data->number, &val)) {
43
+ _sensor_array *array;
45
86
- /* The label, as determined for a given chip in sensors.conf,
46
87
- * is used to place each sensor in the appropriate bucket.
47
88
- * Volt, Fan, Temp, and Misc. If the text being looked for below
48
89
- * is not in the label of a given sensor (e.g., the temp1 sensor
49
90
- * has been labeled 'CPU' and not 'CPU temp') it will end up being
50
91
- * lumped in the MISC bucket. */
51
+ /* The label, as determined for a given chip in
52
+ * sensors.conf, is used to place each sensor in the
53
+ * appropriate bucket. Volt, Fan, Temp, and Misc.
54
+ * If the text being looked for below is not in the
55
+ * label of a given sensor (e.g., the temp1 sensor
56
+ * has been labeled 'CPU' and not 'CPU temp') it
57
+ * will end up being lumped in the MISC bucket. */
59
93
- if (strstr(label, "V")) {
60
94
- type = VOLT_TYPE;
72
106
- type = MISC_TYPE;
75
+ if (strstr(label, "V")) {
79
+ if (strstr(label, "fan") || strstr(label, "Fan")) {
83
+ if (strstr(label, "temp") || strstr(label, "Temp")) {
92
110
- array = &sensor_array[type];
93
111
- if ( array->current_len <= array->n) {
94
112
- _sensor* old_buffer = array->sensor;
122
140
- } /* end if label */
123
141
- } /* end while data */
142
+ while ((chip = sensors_get_detected_chips(NULL, &chip_nr))) {
144
+ while ((feature = sensors_get_features(chip, &a))) {
146
+ while ((subfeature = sensors_get_all_subfeatures(chip,
148
+ char *label = NULL;
151
+ if ((subfeature->flags & SENSORS_MODE_R) &&
152
+ (label = sensors_get_label(chip, feature)) &&
153
+ !sensors_get_value(chip, subfeature->number, &val)) {
156
+ _sensor_array *array;
158
+ /* The label, as determined for a given chip in
159
+ * sensors.conf, is used to place each sensor in the
160
+ * appropriate bucket. Volt, Fan, Temp, and Misc.
161
+ * If the text being looked for below is not in the
162
+ * label of a given sensor (e.g., the temp1 sensor
163
+ * has been labeled 'CPU' and not 'CPU temp') it
164
+ * will end up being lumped in the MISC bucket. */
166
+ if (strstr(label, "V")) {
170
+ if (strstr(label, "fan") || strstr(label, "Fan")) {
174
+ if (strstr(label, "temp") || strstr(label, "Temp")) {
124
183
+ array = &sensor_array[type];
125
184
+ if ( array->current_len <= array->n) {
126
185
+ _sensor* old_buffer = array->sensor;
154
213
+ } /* end if label */
155
+ } /* end while data */
156
} /* end while chip */
158
#endif /* end else ie. ifdef everything else */
159
diff --git a/agent/mibgroup/ucd-snmp/lmSensors.c b/agent/mibgroup/ucd-snmp/lmSensors.c
160
index 8f9fcd2..e42e0e2 100644
161
--- a/agent/mibgroup/ucd-snmp/lmSensors.c
162
+++ b/agent/mibgroup/ucd-snmp/lmSensors.c
164
#include </usr/platform/sun4u/include/sys/envctrl.h>
166
#include <sensors/sensors.h>
167
- #define CONFIG_FILE_NAME "/etc/sensors.conf"
170
#include "lmSensors.h"
171
@@ -247,7 +246,7 @@ var_lmSensorsTable(struct variable *vp,
172
size_t * var_len, WriteMethod ** write_method)
174
static long long_ret;
175
- static unsigned char string[SPRINT_MAX_LEN];
176
+ static char string[SPRINT_MAX_LEN];
180
@@ -352,9 +351,7 @@ sensor_init(void)
184
- char filename[] = CONFIG_FILE_NAME;
185
time_t t = time(NULL);
186
- FILE *fp = fopen(filename, "r");
189
DEBUGMSG(("ucd-snmp/lmSensors", "=> sensor_init\n"));
190
@@ -366,13 +363,7 @@ sensor_init(void)
191
sensor_array[i].sensor = NULL;
200
- if (sensors_init(fp))
201
+ if (sensors_init(NULL))
205
@@ -940,7 +931,8 @@ else{
206
#else /* end solaris2 only ie. ifdef everything else */
208
const sensors_chip_name *chip;
209
- const sensors_feature_data *data;
210
+ const sensors_feature *feature;
211
+ const sensors_subfeature *subfeature;
215
@@ -961,18 +953,19 @@ else{
216
sensor_array[i].current_len = DEFAULT_SENSORS;
219
- while ((chip = sensors_get_detected_chips(&chip_nr))) {
220
+ while ((chip = sensors_get_detected_chips(NULL, &chip_nr))) {
222
+ while ((feature = sensors_get_features(chip, &a))) {
225
- while ((data = sensors_get_all_features(*chip, &a, &b))) {
226
+ while ((subfeature = sensors_get_all_subfeatures(chip,
231
- if ((data->mode & SENSORS_MODE_R) &&
232
- (data->mapping == SENSORS_NO_MAPPING) &&
233
- !sensors_get_label(*chip, data->number, &label) &&
234
- !sensors_get_feature(*chip, data->number, &val)) {
235
+ if ((subfeature->flags & SENSORS_MODE_R) &&
236
+ (subfeature->mapping == 0) &&
237
+ (label = sensors_get_label(chip, feature)) &&
238
+ !sensors_get_value(chip, subfeature->number, &val)) {
241
_sensor_array *array;
242
@@ -1033,7 +1026,8 @@ else{
246
- } /* end while data */
247
214
+ } /* end while subfeature */
248
215
+ } /* end while feature */
249
216
} /* end while chip */