From 6f04ea33d6a74cec1af7f9d6dd450f73a3d212c3 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 25 May 2015 21:08:11 +0000 Subject: [PATCH] disk: Convert temperatures to Kelvin --- src/_collectymodule.c | 3 ++- src/collecty/plugins/disk.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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", -- 2.39.2