[rrd-users] RRD smoothing - please help

Nicolas n.colin at neopost.com
Wed Nov 12 10:36:32 CET 2008


Hi,

I made a script (bash) which convert the returned value into simple integer.

It would be appreciated to add an option to "rrdtool fetch" for getting the
value as an integer :-)

Here's my code :


        if [ "$valeur" != NaN ]
        then

                #  Découpe en mantisse + exposant (Ex : 1.4502200000e+03 =>
1450)

                mant=$(echo $valeur | cut -d '+' -f1 | cut -d 'e' -f1)
                exp=$(echo $valeur | cut -d '+' -f2 | cut -d 'e' -f1)

                for ((i=1; i<=$exp; i=i+1)) ; do
                        mant=$(printf "%s\n" $mant*10 | bc)
                done

                valeur=$(echo $mant | cut -d '.' -f1)

                echo $valeur
        fi


Regard,

-- 
Nicolas COLIN.


PS : Sorry for my poor english, I am french.


-----Message d'origine-----
De : rrd-users-bounces at lists.oetiker.ch
[mailto:rrd-users-bounces at lists.oetiker.ch] De la part de William R. Lorenz
Envoyé : mardi 11 novembre 2008 08:26
À : johan thoren
Cc : rrd-users at lists.oetiker.ch
Objet : Re: [rrd-users] RRD smoothing - please help

Hej Johan,

On Tue, 11 Nov 2008, johan thoren wrote:

> William, thanks for your reply!  I looking to accomplish a five minute 
> graph with integer values like below. The problem is that I cant get 
> rid of the double X.XX values that is produced by RRD.

If you'd like to get rid of any double X.XX values and convert them to
integers, have you considered a Perl or C or Bash or ZSH int/floor/ceil type
of function? :-)  Perhaps there's some intermediate steps that could also
happen between the data returned by rrdtool and your application? 
It should be rather trivial to convert all those mathematical values? :-)

> no.
> 4.                            ____
> 3.                     ____
> 2.       ____
> 1.____       ____
> 0.    300. 600. 900. 1200 time

With regards to your previous email (as you write -- "my goal is to store
data and ONLY display the maximum value"), max values are not necessarily
integer values.  Are you also able to share more about your overall goals?

As a disclaimer, I'm sure there's others on this mailing list that know a
lot more than I do about such things, and I defer to their wise expertise.

Hope this may help, at least a bit.   Take care,

--
William R. Lorenz



More information about the rrd-users mailing list