Historical data vs real time data

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
massimilianocasini
Posts: 2
Joined: Fri Jun 27, 2014 4:52 am

Historical data vs real time data

Post by massimilianocasini »

Hi,

the my goal is to do a graph with two line:

the first line is real time value of variable X
the second line is old value (a week ago) of variable X

The value of variable X is stored in one RRD with more data source (X,Y,Z)

Then, with only one data source in RRD, I could use simple script called by data input method:

#!/bin/sh
file_rra=$1
number=0
number=`rrdtool fetch /var/www/html/cacti/rra/$file_rra -r 1800 AVERAGE -s 1w -e 1w`
echo $number


But with more DS I get an output type:

X Y Z 1403269200: 1.3638485000e+04 7.4909105556e+03 3.5318111111e+02


Can I get an output compatible with standard cacti output?


1:x 2:Y 3:Z


Thanks


Regards
massimilianocasini
Posts: 2
Joined: Fri Jun 27, 2014 4:52 am

Re: Historical data vs real time data

Post by massimilianocasini »

Update and resolution:

This is my output when to fetch on rrd file with multiple data source:

rrdtool fetch /var/www/html/cacti/rra/filename.rrd -r 900 AVERAGE -s -1w -e -1w
DS1 DS2 DS3 DS4 DS5

1403624700: 2.7216920000e+04 1.5035210000e+04 8.3893000000e+02 1.4196280000e+04 0.0000000000e+00


Then, with this script I can make an output cacti compatible:

#!/bin/sh
file_rra=$1
start=$2
end=$3
resolution=$4
number=0
number=`rrdtool fetch /var/www/html/cacti/rra/$file_rra -r $resolution AVERAGE -s -$start -e -$end`
echo $number | awk -F' ' '{split ($1 $2 $3 $4 $5 $6 $7 %8 %9 %10 %11, ds, " ")};{print $1":"$7 " " $2":"$8 " " $3":"$9 " " $4":"$10 " " $5":"$11}'


The variable are entered with input method:

/bin/bash <path_cacti>/scripts/script_ago.sh <file_rra> <start> <end> <res>


Then, the output will be:

07/01/2014 05:37:24 PM - SPINE: Poller[0] Host[58] TH[4] DS[3013] SCRIPT: /bin/bash /mnt/ha0/cacti/scripts/script_ago.sh 2158.rrd 1w 1w 900, output: DS1:2.6517576667e+04 DS2:1.4635100000e+04 DS3:8.7188666667e+02 DS4:1.3763213333e+04 DS5:0.0000000000e+00


:lol: :lol: :lol:
Attachments
Example graph.<br />Red live data<br />Black historic data
Example graph.
Red live data
Black historic data
Immagine.png (55.25 KiB) Viewed 1327 times
mikalwanted
Posts: 1
Joined: Sat Apr 11, 2015 5:20 am

Re: Historical data vs real time data

Post by mikalwanted »

Change the filename and any pointers to all lower case and it should find it. One of the other templates from that post has the same problem too.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests