How can I graph a line with old data?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
misipino
Posts: 8
Joined: Wed Feb 17, 2010 6:41 am

How can I graph a line with old data?

Post by misipino »

I need to compare the values of the current day with the values of the previous days of the week.
Using the command "rrdtool fetch" the answer is a type number:

1266407100: 3.3986666667e +01


This does not seem a valid value for Cacti.

How can I make it a valid number for Cacti?

Anybody know a script that makes the extraction of data from an rrd file and submit it as an integer?

Thx
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Do you only request a single data point?
Or is the SHIFT function the solution? Please see http://www.vandenbogaerdt.nl
R.
misipino
Posts: 8
Joined: Wed Feb 17, 2010 6:41 am

Post by misipino »

the problem is: I can read a value in RRD files and send the result as output?
That way I could import the output in a new RRD
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

misipino wrote:the problem is: I can read a value in RRD files and send the result as output?
That way I could import the output in a new RRD
This is surely possible. But still I do not understand what you want to achive. And I have an ugly feel, that you might not go for the easiest way ...
R.
misipino
Posts: 8
Joined: Wed Feb 17, 2010 6:41 am

Post by misipino »

Thank you for support.
I will try to explain better.

I want to have a graph showing two lines (A and B).
The first line (A) is the data in real time, the second line (B) is the data observed seven days before the same hour.
The value A is detected by a getSnmpdata and recorded in the file lineA.rrd and this works well.
The value B should read the file lineA.rrd for the value recorded 7 days before.

Thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Well, fine. That's the perfect use case for SHIFT. See the explanation at the web site I advertised above. Unfortunately, this is not yet supported by current 087; but this will be supported by 088; the code is already in. 088 is NOT yet in beta state. So if you need a solution now, this turns out to be a problem.
R.
misipino
Posts: 8
Joined: Wed Feb 17, 2010 6:41 am

Post by misipino »

Right, the example given in the link is just my case, of course, all integrated into cacti.
I thought I crare invoked through a script that cacti could give as output the value recorded in a file rrd.
For example:

#/bin/bash!
value_b=0

value_b='rrdtool fetch lineA.rrd AVERAGE -s -7d -e -7d`

echo value_b

But the output 1266407100: 3.3986666667e +01 don't seem valid for cacti.

Wating full integration with cacti and not 'possible, in your opinion, use that or anyone script?

Grazie
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

misipino wrote:But the output 1266407100: 3.3986666667e +01 don't seem valid for cacti.
Simply strip out the "3.3986666667e +01" last number only
R.
misipino
Posts: 8
Joined: Wed Feb 17, 2010 6:41 am

Post by misipino »

This is the script I used.

#!/bin/sh

number=0

number=`rrdtool fetch /var/www/html/cacti/rra/lineA.rrd LAST -s -1d -e -1d`

echo `expr "$number" : '.*\(................\)'`

Output is a value to capture with datasource.

Thanks to Gandalf
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I would so something like:

Code: Select all

echo $number | awk -F: '{print $2}' | tr -d ' '
TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest