From: Michael Tremer Date: Mon, 25 May 2015 21:08:11 +0000 (+0000) Subject: disk: Convert temperatures to Kelvin X-Git-Tag: 003~20 X-Git-Url: http://git.ipfire.org/?p=collecty.git;a=commitdiff_plain;h=6f04ea33d6a74cec1af7f9d6dd450f73a3d212c3 disk: Convert temperatures to Kelvin --- diff --git a/src/_collectymodule.c b/src/_collectymodule.c index 38ade7d..e57970e 100644 --- a/src/_collectymodule.c +++ b/src/_collectymodule.c @@ -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[] = { diff --git a/src/collecty/plugins/disk.py b/src/collecty/plugins/disk.py index 759156c..b0f40a2 100644 --- a/src/collecty/plugins/disk.py +++ b/src/collecty/plugins/disk.py @@ -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",