Finding local_graph_id from data_source_path

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
Anynomous

Finding local_graph_id from data_source_path

Post by Anynomous »

Here is something I am trying to figure out but have not been able to yet. I want to be able to find local_graph_id associated with a particular rra file. The DB field I found that reference the rra file is data_source_path under the data_temploate_data table.

How can I link local_graph_id to data_source_path. I can't find any suitable combination of table/field to do this.

Anybody up for a challenge?

Here is why I am trying to do this. I have written a perl script that poll each rra files every 5 minutes for values above a treshold (real time monitoring function) and generate email alert report when exceeding the treshold. I manually generate and graph the graph associated with the RRA file and would like to link it to the main graph in Cacti.
User avatar
dieter
Cacti User
Posts: 164
Joined: Fri Feb 20, 2004 3:08 pm

Post by dieter »

this is what you could do:

it seems like you know the local_graph_id. Starting from this you can find the local_data_id this way:

in the table graph_templates_item check the value of task_item_id for the local_graph_id that you know.

Now go to the table data_template_rrd and find the id with a value equal to task_item_id. Now you have the value of the local_data_id. With this value go to the table data_input_data_cache and you have your path to the rrd

in SQL language below :wink:

Code: Select all

			select distinct didc.rrd_path
			from data_template_rrd rrd, graph_templates_item gti, data_input_data_cache didc
			where rrd.id = gti.task_item_id
			and rrd.local_data_id = didc.local_data_id
			and gti.local_graph_id = $yourlocalgraphidnumber
User avatar
dieter
Cacti User
Posts: 164
Joined: Fri Feb 20, 2004 3:08 pm

Post by dieter »

oops, your question was given a datasourcepath to know the local_graph_id

well, then just reverse the logic in the post above :lol:
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests