ncv can´t handle negative values
list Hansi Tesarz
Hi is there an easy way to change the code so that ncv values can handle negative values. Regards - Hansi
list Henrik Størner
▸
On Mon, Feb 19, 2007 at 07:00:48PM +0100, hansi tesarz wrote:
is there an easy way to change the code so that ncv values can handle negative values.
I think there is: In the hobbit-4.2.0/hobbitd/rrd/do_ncv.c file around
line 65 there's this line:
l = val + strspn(val, "0123456789.");
Add a "-" before the numbers so it becomes
l = val + strspn(val, "-0123456789.");
Run "make" and copy the hobbit-4.2.0/hobbitd/hobbitd_rrd binary to your
~hobbit/server/bin/ directory (or just run "make install"), then restart
Hobbit.
Haven't tested it, but I think it should do the trick.
Regards,
Henrik
list Thomas Kern
Just for safety, we should add a plus "+" and a comma "," to the string, in case some source of data provides +9,876.54 as a value. Thomas Kern XXX-XXX-XXXX
▸
----- Original Message -----
From: user-ce4a2c883f75@xymon.invalid <user-ce4a2c883f75@xymon.invalid>
To: user-ae9b8668bcde@xymon.invalid <user-ae9b8668bcde@xymon.invalid>
Sent: Mon Feb 19 17:43:02 2007
Subject: Re: [hobbit] ncv can´t handle negative values
On Mon, Feb 19, 2007 at 07:00:48PM +0100, hansi tesarz wrote:is there an easy way to change the code so that ncv values can handle negative values.
I think there is: In the hobbit-4.2.0/hobbitd/rrd/do_ncv.c file around
line 65 there's this line:
l = val + strspn(val, "0123456789.");
Add a "-" before the numbers so it becomes
l = val + strspn(val, "-0123456789.");
Run "make" and copy the hobbit-4.2.0/hobbitd/hobbitd_rrd binary to your
~hobbit/server/bin/ directory (or just run "make install"), then restart
Hobbit.
Haven't tested it, but I think it should do the trick.
Regards,
Henrik
list Henrik Størner
▸
On Mon, Feb 19, 2007 at 07:00:44PM -0500, Kern, Thomas wrote:
Just for safety, we should add a plus "+" and a comma "," to the string, in case some source of data provides +9,876.54 as a value.
Agree with the '+', and that is already in my source - but the comma won't work. The value data is passed directly to rrdtool, and it doesn't allow for commas. It also depends a lot on where you are. Where I come from, that number would be written as "9.876,54" - ie the dot and comma switches place. Regards, Henrik
list Hansi Tesarz
Hi Thanks, it works. i also changed the dsdef line to -40 instead of zero. sprintf(dsdef, "DS:%s:%s:600:-40:U", dsname, dstype); and recreated the rrd file. Regards - hansi
▸
On 2/20/07, Henrik Stoerner <user-ce4a2c883f75@xymon.invalid> wrote:On Mon, Feb 19, 2007 at 07:00:44PM -0500, Kern, Thomas wrote:Just for safety, we should add a plus "+" and a comma "," to the string, in case some source of data provides +9,876.54 as a value.Agree with the '+', and that is already in my source - but the comma won't work. The value data is passed directly to rrdtool, and it doesn't allow for commas. It also depends a lot on where you are. Where I come from, that number would be written as "9.876,54" - ie the dot and comma switches place. Regards, Henrik
--
Hansi Tesarz
Tjäderstigen 7
142 63 Trångsund
Tel: +XX XXXXXXXXX
Mail: user-69c056db2544@xymon.invalid
Web: www.htk.se
ICQ: 202-468-855
Light Can Twist as Well as Spin
list Henrik Størner
▸
On Tue, Feb 20, 2007 at 06:50:41PM +0100, hansi tesarz wrote:
Thanks, it works. i also changed the dsdef line to -40 instead of zero. sprintf(dsdef, "DS:%s:%s:600:-40:U", dsname, dstype); and recreated the rrd file.
Thanks for noticing that, I'd missed it. Fixed in my code now. Regards, Henrik