How to get rra_path from database

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

Moderators: Developers, Moderators

Post Reply
JoeStine
Posts: 2
Joined: Tue Feb 10, 2004 11:01 pm

How to get rra_path from database

Post by JoeStine »

I'm writing a script that needs to work with the raw rrd files, but I need to find out the description associated with each rrd file. Basically, I need to get the graph_templates_graph.title_cache that is associated with each data_input_data_cache.rrd_path. Does anybody know how to do this? I don't seem to have the sql skills to get the query to work, so hopefully somebody has already solved this problem.
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

These questions are always fun... ;-).

Code: Select all

select
graph_templates_graph.title_cache,
data_template_data.data_source_path
from graph_templates_graph,graph_templates_item,data_template_rrd,data_template_data
where graph_templates_graph.local_graph_id=graph_templates_item.local_graph_id
and graph_templates_item.task_item_id=data_template_rrd.id
and data_template_rrd.local_data_id=data_template_data.local_data_id
and graph_templates_graph.local_graph_id > 0
group by data_template_data.local_data_id
-Ian
JoeStine
Posts: 2
Joined: Tue Feb 10, 2004 11:01 pm

Post by JoeStine »

Thanks raX, thats perfect!
jorgeantonio
Posts: 2
Joined: Mon Apr 18, 2005 7:59 am

Post by jorgeantonio »

Hi

I want to find a query script like this but that next to the description display the current percent of utilization.

Example:

DNS1 - CPU: 35%
DNS1 - MEM: 47%
...

Please If somebody know how to do that let me know. Thanx!

--Jorge
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Unfortunately these statistics are not stored the Cacti's database. To display this data, you need to fetch it directly from the .rrd file(s). This can be accomplished with RRDTool's 'fetch' command which basically dumps the data in a .rrd file to the console.

If you are feeling ambitious though, Cacti's rrdtool_function_fetch() function in lib/rrd.php would make this a lot easier. It takes care of executing the fetch command, parses the output, and returns a nice PHP array.

Let me know if you have any questions.

-Ian
jorgeantonio
Posts: 2
Joined: Mon Apr 18, 2005 7:59 am

Post by jorgeantonio »

Thanks Ian,

I can't find the rrdtool_function_fetch() function in lib/rrd.php but I would be study the file to extract some helpfull script.

In summary I only want a lite statistic page to convert to WAP. If you know any about my goal please let me know and Thanx again.

--Jorge
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest