Xymon Mailing List Archive search

Little change-request for do_temperature.c ...

1 message in this thread

list Rolf Masfelder · Thu, 27 Dec 2007 09:18:58 +0100 ·
Hallo Henrik,

the last Days were a litle bit cold in germany. So i found that rrd/do_temperature.c dont work correctly on negative values ...

In the part:

			p = bol + strlen(bol) - 1;
			while ((p > bol) && isspace((int)*p)) p--;
			while ((p > bol) && isdigit((int)*p)) p--;
			tmpF = atoi(p);
			while ((p > bol) && isspace((int)*p)) p--;
			while ((p > bol) && isdigit((int)*p)) p--;
			tmpC = atoi(p);

there have be two additional lines of code:

			p = bol + strlen(bol) - 1;
			while ((p > bol) && isspace((int)*p)) p--;
			while ((p > bol) && isdigit((int)*p)) p--;
-->			while ((p > bol) && *p == '-') p--;
			tmpF = atoi(p);
			while ((p > bol) && isspace((int)*p)) p--;
			while ((p > bol) && isdigit((int)*p)) p--;
-->			while ((p > bol) && *p == '-') p--;
			tmpC = atoi(p);

The rrd-File has to bee build with another Minimum for the Values stored. I dont find the code for the creation, but "rrdtool tune temperature.sensor4.rrd -i temperature:-10" did the job for my environment.
 please insert the lines of code into do_temperature.c 
greetings

to All: (after christmas) I wish you a happy new year

Rolf