Bulk add external RRD files

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

Moderators: Developers, Moderators

Post Reply
sigurrot
Posts: 2
Joined: Wed Aug 30, 2023 4:41 pm

Bulk add external RRD files

Post by sigurrot »

I have a bunch of rrd files that are being updated outside of cacti that I would like cacti to graph.
I have a functioning data source / graph template that I created via this helpful guide: viewtopic.php?t=12202

I'm toying with the idea of creating the data source / graph with the add_graph.php cli tool, then double back with a database query to update the rrd path of the data source. I'm sure that will work but wondering if anyone else has come up with something less clumsy?

Any insight would be appreciated.
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Bulk add external RRD files

Post by TheWitness »

It's pretty strait forward actually. The trick is to map the two tables:

graph_templates_item => task_item_id

to

data_template_rrd => id

That's your join column from each table.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
sigurrot
Posts: 2
Joined: Wed Aug 30, 2023 4:41 pm

Re: Bulk add external RRD files

Post by sigurrot »

This was great advise thanks!

This is what I landed on:

Code: Select all

SELECT data_template_rrd.local_data_id, graph_templates_item.local_graph_id, graph_templates_graph.title FROM graph_templates_item
INNER JOIN data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
INNER JOIN graph_templates_graph on graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
where graph_templates_item.graph_template_id = '172';
Problem I'm running into now, is that the data source that add_graphs.php is adding is not creating a unique data source name. Is there a replacement variable you'd recommend to create a unique name?
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Bulk add external RRD files

Post by TheWitness »

Well, that's the whole problem. You want to replace the template system, you will have to become familiar with the function create_complete_graph_from_template(), and then determine what you should do once you understand it.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests