X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsensors.c;h=a30549fea5ebf1b8dcbde4447632b9c8261aa3f1;hb=1a7050de376608268d11293d4e5faa3fb8516c5a;hp=e1bc7aafc2100ef2341b990ed7ad9352e2783c30;hpb=011b30ce3a419d543040102bb3d077e7fbd4aa0f;p=collectd.git diff --git a/src/sensors.c b/src/sensors.c index e1bc7aaf..a30549fe 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -36,17 +36,8 @@ #if defined(HAVE_SENSORS_SENSORS_H) # include -#else -# undef HAVE_LIBSENSORS #endif -#if defined(HAVE_LIBSENSORS) -# define SENSORS_HAVE_READ 1 -#else -# define SENSORS_HAVE_READ 0 -#endif - -#if SENSORS_HAVE_READ #define SENSOR_TYPE_VOLTAGE 0 #define SENSOR_TYPE_FANSPEED 1 #define SENSOR_TYPE_TEMPERATURE 2 @@ -347,12 +338,24 @@ static void sensors_submit (const char *plugin_instance, const char *type, const char *type_instance, double val) { + char match_key[1024]; + int status; + value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - if ((sensor_list != NULL) - && (ignorelist_match (sensor_list, type_instance))) + status = snprintf (match_key, sizeof (match_key), "%s/%s-%s", + plugin_instance, type, type_instance); + if ((status < 1) || (status >= sizeof (match_key))) return; + match_key[sizeof (match_key) - 1] = '\0'; + + if (sensor_list != NULL) + { + DEBUG ("sensors plugin: Checking ignorelist for `%s'", match_key); + if (ignorelist_match (sensor_list, match_key)) + return; + } values[0].gauge = val; @@ -421,14 +424,11 @@ static int sensors_read (void) return (0); } /* int sensors_read */ -#endif /* SENSORS_HAVE_READ */ void module_register (void) { -#if SENSORS_HAVE_READ plugin_register_config ("sensors", sensors_config, config_keys, config_keys_num); plugin_register_read ("sensors", sensors_read); plugin_register_shutdown ("sensors", sensors_shutdown); -#endif } /* void module_register */