[rrd-users] 1 minute RRD + Mysql + php + UnixTimeStamp + headaches

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Sat Aug 10 00:22:41 CEST 2013

> We are a WISP from Argentina and we are trying to get a statistic graph 
> from
> every CPE installed in client location.
> Every CPE is pushing information into a webserver running apache+php. The
> data colleted are store into mysql table.
> To get data consistent, we use UNIXTIMESTAMP generate by php script with
> time() function.
> The function time() is used to generate the rrd file minus 1 sec for the
> date of creation ($now = time() - 1).

Not that this is part of the problem, but I'm just curious. Why -1 sec ?

> We don't really know why traffic graph generated by Mikrotik are TOTALLY
> different from ours.

Are you reasonably confident that those graphs from Mikrotik are correct?

> Data store on rrd file are "perfect", meaning correct.

What are you trying to say here?

> As you can see in graphics, ath0 and eth0 are "mirror interfaces" being 
> ath0
> the Wireless interface and eth0 the one connected to client network.

I see something different.  I see gaps in ath0 that do not match the gaps in 
eth0.  This makes me wonder if the gaps should be there at all. My guess is 
that they should not be there, and then ofcourse all kind of errors occur as 
a result of the missing data.  Please confirm.

How does it happen that data can come in over the air but is not transmitted 
to the ethernet, and later data is not coming in but is transmitted?

> Data collected by sripts are quite equals but inverted (rx -> tx and
> viceversa because of the clause above). Even though, graphics are not 
> equals
> o "related".

If there is a close relation between in and out, then the graphs should 
(almost) be mirror images. They are not.

> Traffic generate by our script are 1 minute average
> http://ctrlv.in/223602

The image is missing an Y-axis, thus a scale, and it is missing parts of the 
X-axis, so it is impossible to verify that the image shows the same amount 
of time as the next one does.

With a different sampling rate (1 minute vs. 5 minutes) it is normal that 
the graphs will not look exactly the same. I would expect the 1-minute graph 
to have more detail, thus higher maximums and lower minimums. The average 
should be more or less the same.

Please debug your scripts. Have a look at the data in your SQL table; are 
the gaps there?  If not, why are you not copying all data to your RRD file? 
If there are gaps in your SQL data also, but Mikrotik does not show those, 
then why does your SQL data have those gaps?

I hope this helps you in debugging your problem.

More information about the rrd-users mailing list