[collectd] question about implementation details in sensors.c

Scott Harris collectd at webhounds.net
Tue Apr 1 02:59:34 CEST 2008


Howdy again,
	After getting the base functionality working I started
working with the sensors plugin.  It works great for most things
but I noticed it missed all the temperatures!  I started to look
at the code and saw this, starting on line 548n in sensors.c:

                 if (fl->feature->type == SENSORS_FEATURE_IN)
                         type = "voltage";
                 else if (fl->feature->type
                                 == SENSORS_FEATURE_FAN)
                         type = "fanspeed";
                 else if (fl->feature->type
                                 == SENSORS_FEATURE_TEMP)
                         type = "input";
                 else
                         continue;

I added a bunch of debug statements to the code to see what
was actually being detected.  Every occurrence of my discovered
chips with temperatures would print like this:

w83791d-i2c-1-2d/input-temp1
w83791d-i2c-1-2d/input-temp2
w83791d-i2c-1-2d/input-temp3
it8716-isa-0290/input-temp1
it8716-isa-0290/input-temp2
it8716-isa-0290/input-temp3
k8temp-pci-00c3/input-temp1

Obviously this doesn't look right, they should be in the form:

it8716-isa-0290/temperature-temp3
k8temp-pci-00c3/temperature-temp1

If I make some simple code changes I get the expected results.

So, my question is, should the code be modified from this:

                 else if (fl->feature->type
                                 == SENSORS_FEATURE_TEMP)
                         type = "input";

to this:

                 else if (fl->feature->type
                                 == SENSORS_FEATURE_TEMP)
                         type = "temperature";

Thanks,

Scott









More information about the collectd mailing list