[SOLVED] Value in rrd file do not correspond to expected one

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

Moderators: Developers, Moderators

Post Reply
Dolphin
Posts: 4
Joined: Fri Jul 16, 2010 2:51 am
Location: SPb, RU

[SOLVED] Value in rrd file do not correspond to expected one

Post by Dolphin »

Hello, all. I'm trying to gather statistics from mysql with php script running on cacti box. Script returns values in correct form and cacti understand it properly and push it into rrd file. But graphs are totally wrong and I can't understand why.

Data source type is COUNTER i.e. it is always increasing. I'm acquiring data with cacti every minute. So imo in rrd file I should have last received value as "last_ds" field and the difference between this and the previous one in "value". But what I see on graph it is not corresponding to what it should be at all. The same for RRD file.

I've snapshoted several points with 1 minute period to see what do I have in RRD:

Fri Jul 16 00:45:42 PDT 2010
filename = "box_select_1672.rrd"
ds[select].type = "COUNTER"
ds[select].minimal_heartbeat = 120
ds[select].min = 0.0000000000e+00
ds[select].max = NaN
ds[select].last_ds = "323477685"
ds[select].value = 2.2713333333e+02
ds[select].unknown_sec = 0

Fri Jul 16 00:46:42 PDT 2010
filename = "box_select_1672.rrd"
ds[select].last_ds = "323480510"
ds[select].value = 1.8833333333e+02

I supposed the difference should be 323480510-323477685=2825 but not 2.2713333333e+02 ~ 227

Fri Jul 16 00:47:42 PDT 2010
filename = "box_select_1672.rrd"
ds[select].last_ds = "323482756"
ds[select].value = 1.4973333333e+02

The same here: 323482756-323480510=2246 but not 149

Fri Jul 16 00:48:42 PDT 2010
filename = "box_select_1672.rrd"
ds[select].last_ds = "323486653"
ds[select].value = 1.9815254237e+02

Fri Jul 16 00:49:43 PDT 2010
filename = "box_select_1672.rrd"
ds[select].last_ds = "323489436"
ds[select].value = 1.8249180328e+02

Does anybody have thoughts what I am doing wrong?

I'll appreciate any idea because I'm almost out of ammo.
Thanks in advance.

UPD: For those who don't want to read all of available info about RRD or just have no sufficient time I'll answer on my own question by this excerpt:

Quote:
COUNTER The input is an ever increasing number, e.g. an octet counter in a router. RRDtool should compute the difference between the last update and the current one, and divide it by the amount of time lapsed.
Last edited by Dolphin on Fri Jul 16, 2010 3:39 pm, edited 2 times in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

http://www.vandenbogaerdt.nl/rrdtool/ is a great page for understanding how rrdtool works in depth.
Dolphin
Posts: 4
Joined: Fri Jul 16, 2010 2:51 am
Location: SPb, RU

Post by Dolphin »

BSOD2600 wrote:http://www.vandenbogaerdt.nl/rrdtool/ is a great page for understanding how rrdtool works in depth.
Thank you. Not what it is what I was expecting to get here, but maybe it's even better =)

For those who don't want to read all of available info about RRD or just have no sufficient time I'll answer on my own question by this excerpt:
COUNTER The input is an ever increasing number, e.g. an octet counter in a router. RRDtool should compute the difference between the last update and the current one, and divide it by the amount of time lapsed.
So now I have another question, which I have no answer on. How to make it store data dividing it by 1, but not 60 seconds. Looks like I will have to find this answer by myself once more =) Anyway thanks again, BSOD2600
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

In case you want to store computed data, you will have to use the COMPUTE data source. It accepts CDEFs to compute. COMPUTE will be supported with Cacti 088.

In many cases, it is sufficient to peform the calculation at graphing time. The same CDEF may be applied to any data source item to achieve this. This feature is available since ages with Cacti.

R.
Dolphin
Posts: 4
Joined: Fri Jul 16, 2010 2:51 am
Location: SPb, RU

Post by Dolphin »

gandalf wrote:In many cases, it is sufficient to peform the calculation at graphing time. The same CDEF may be applied to any data source item to achieve this. This feature is available since ages with Cacti.

R.
Yes, I know about CDEFs, but wanted to store data without dividing it just to decrease inaccuracy, which appears when we dividing integer values by 60 and put this data into db and then multiplying real values by 60 to graph. Now I've come to conclusion that I can live with such insignificant deviation and multiply on graphing stage.
Thanks all for your answers.
Post Reply

Who is online

Users browsing this forum: anwaraahmad1 and 1 guest