disk: Convert temperatures to Kelvin
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 May 2015 21:08:11 +0000 (21:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 May 2015 21:08:11 +0000 (21:08 +0000)
src/_collectymodule.c
src/collecty/plugins/disk.py

index 38ade7d..e57970e 100644 (file)
@@ -254,7 +254,8 @@ static PyObject* BlockDevice_get_temperature(PyObject* self) {
        if (r)
                return NULL;
 
-       return PyLong_FromUnsignedLongLong((unsigned long long)mkelvin);
+       // Convert the temperature to Kelvin
+       return PyFloat_FromDouble((double)mkelvin / 1000.0);
 }
 
 static PyGetSetDef BlockDevice_getsetters[] = {
index 759156c..b0f40a2 100644 (file)
@@ -135,8 +135,8 @@ class GraphTemplateDiskTemperature(base.GraphTemplate):
        name = "disk-temperature"
 
        rrd_graph = [
-               "DEF:mkelvin=%(file)s:temperature:AVERAGE",
-               "CDEF:celsius=mkelvin,1000,/,273.15,-",
+               "DEF:kelvin=%(file)s:temperature:AVERAGE",
+               "CDEF:celsius=kelvin,273.15,-",
 
                "LINE2:celsius#ff0000:%s" % _("Temperature"),
                "VDEF:temp_cur=celsius,LAST",