Help on creating

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

Moderators: Developers, Moderators

Post Reply
sanmoi
Posts: 6
Joined: Mon Mar 12, 2012 3:33 am

Help on creating

Post by sanmoi »

Hello;

I have been looking through the forums for hours and I didn't manage to find my answer.

I am trying to create a graph from a CSV file. The file is uploaded on once a day and contains the CDR for mobile phones using 3G.
As the CDR are issued each time 1MB is consummed I must take the timestamp from the file. Each line is a CDR. I managed to write a php script to extract the data and an Input method to handle it. The output is like:
day:2/29/2012 time:04:34:46.0 kbps:900
I would like to graph the kbps value while using the date and hour as the x-axis values. Is there a way to do that?

Another problem might be that I could want to run the script once a day to avoid importing the same data several times.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Help on creating

Post by phalek »

yes, that's doable, i suggest you start by reading this chapter:

http://docs.cacti.net/manual:087:8_rrdt ... dated_rrds
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sanmoi
Posts: 6
Joined: Mon Mar 12, 2012 3:33 am

Re: Help on creating

Post by sanmoi »

Thanks for this very helpful hint.
I think I'm able to create a rrd file with the rrdtool create option then modify my script to issue rrdtool updates to that rrdfile.

One more question:
My CSV file is uploaded once a day. It contains all the CDR for the day. if I parse the CSV en generate chained rrdtool updates (one for each CDR in the file) will this work?
I think that only the last one is retained in the rrdfile. Will the database be updated this way?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Help on creating

Post by phalek »

I had a project with a customer with exactly your requirements.

Basically, you just need to make sure that you're doing the rrd updates in sequence.

E.g.

00:00
00:01
00:02
..
23:59

As you cannot do any updates prior to the last update. There's no issue with doing this only once a day.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sanmoi
Posts: 6
Joined: Mon Mar 12, 2012 3:33 am

Re: Help on creating

Post by sanmoi »

Done but I'm still doing something wrong. The graph is showing but is empty whatever the time period considered.

I modified my script and pointed the data source to the externaly updated rrd file.
I ran the script on a test CSV and it updated the rrdfile fine (to make sure a ran it a second time and all the updates where rejected because of the identical timestamps ).
My problem is my ds value stays to NaN while last_ds is updated...

Here is the last rrdtool info:
filename = "537003134_ds_8.rrd"
rrd_version = "0003"
step = 300
last_update = 1331576237
header_size = 592
ds[kbps].index = 0
ds[kbps].type = "GAUGE"
ds[kbps].minimal_heartbeat = 300
ds[kbps].min = NaN
ds[kbps].max = NaN
ds[kbps].last_ds = "400"
ds[kbps].value = NaN
ds[kbps].unknown_sec = 137
rra[0].cf = "AVERAGE"
rra[0].rows = 10
rra[0].cur_row = 6
rra[0].pdp_per_row = 1
rra[0].xff = 0.0000000000e+00
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0

Why are not the values updated? Something's wrong in my fiile definition?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Help on creating

Post by phalek »

Can you provide an example CSV file ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sanmoi
Posts: 6
Joined: Mon Mar 12, 2012 3:33 am

Re: Help on creating

Post by sanmoi »

Here is a sample file.

What might be of interest is that I don't take directly the values here. I calculate an average in the php script before calling rrd tool with shell_exec.
test.rar
(13.45 KiB) Downloaded 49 times
sanmoi
Posts: 6
Joined: Mon Mar 12, 2012 3:33 am

Re: Help on creating

Post by sanmoi »

It seems that the problem was not the data used to update the rrd. Instead the steps and number of ppd involved are more likely to have caused this.

No the rrd is updated but the graphe is still empty. The default RRAs in cacti are differents of those I used when I build my rrd. Can this be the cause? If yes can I solve the pb by creating new rra in cacti and apply them to my graph template? (I tried but it doesn't seem to work).
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Help on creating

Post by gandalf »

sanmoi wrote:The default RRAs in cacti are differents of those I used when I build my rrd. Can this be the cause?
No. When updating an rrd file, the inherent structure is of no importance
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests