Howto duplicate template?

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Howto duplicate template?

Post by Atreides »

Hello,
I have a graph template(from monitoring temperature) that I want to duplicate, change the OID's and import it again so I can use it for a second device. But if I try to export and import it(after changing OID, even data source name) its modifying the original template. I think it has to do with hash values from the .xml(cdef_id, task_item_id, etc, wich I didnt change since its a long string) ?
Is there a way to export the template and import it ? I have 4 OID's in it wich I modified, but its know enough. Below is the preview from importing the new template :

Cacti would make the following changes if the Template was imported:

GPRINT Preset
[preview] Normal [unchanged]
[preview] Load Average [unchanged]

Data Input Method
[preview] Tenis Puiu [updated]

Table: data_input, Column: name, New Value: Tenis Puiu, Old Value: Tenis Profi
Table: data_input_fields, Column: data_name, New Value: puiu1, Old Value: temp1
Table: data_input_fields, Column: data_name, New Value: puiu2, Old Value: temp2
Table: data_input_fields, Column: data_name, New Value: puiu3, Old Value: temp3
Table: data_input_fields, Column: data_name, New Value: puiu4, Old Value: temp4

Data Template
[preview] Temp Puiu [updated]

Table: data_template, Column: name, New Value: Temp Puiu, Old Value: Temp Tenis
Table: data_template_data, Column: name, New Value: |host_description| - Temp Puiu, Old Value: |host_description| - Temp Tenis
Table: data_template_rrd, Column: data_source_name, New Value: puiu_6, Old Value: temp_6
Table: data_template_rrd, Column: data_source_name, New Value: puiu_5, Old Value: temp_5
Table: data_template_rrd, Column: data_source_name, New Value: puiu_4, Old Value: temp_4
Table: data_template_rrd, Column: data_source_name, New Value: puiu_2, Old Value: temp_2
Table: data_template_rrd, Column: data_source_name, New Value: puiu_3, Old Value: temp_3
Table: data_template_rrd, Column: data_source_name, New Value: puiu_1, Old Value: temp_1

Graph Template
[preview] Temp Puiu [updated]

Table: graph_templates, Column: name, New Value: Temp Puiu, Old Value: Temp Tenis
Table: graph_templates_graph, Column: title, New Value: |host_description| - Temp Puiu, Old Value: |host_description| - Temp Tenis
Table: graph_templates_item, Column: text_format, New Value: Inc Balon1, Old Value: Incalzire Balon1
Table: graph_templates_item, Column: text_format, New Value: Inc Balon2, Old Value: Incalzire Balon2
Table: graph_templates_item, Column: text_format, New Value: Temp Balon1, Old Value: Temperatura Balon1
Table: graph_templates_item, Column: text_format, New Value: Temp Balon2, Old Value: Temperatura Balon2
Table: graph_template_input, Column: name, New Value: Data Source [puiu_3], Old Value: Data Source [temp_3]
Table: graph_template_input, Column: name, New Value: Data Source [puiu_1], Old Value: Data Source [temp_1]
Table: graph_template_input, Column: name, New Value: Data Source [puiu_2], Old Value: Data Source [temp_2]
Table: graph_template_input, Column: name, New Value: Data Source [puiu_4], Old Value: Data Source [temp_4]
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Howto duplicate template?

Post by cigamit »

You should be duplicating it via the UI
Data Inputs, Data Source Templates, and Graph Templates all have a "Duplicate" action.
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: Howto duplicate template?

Post by Atreides »

Ah..yes, thank you. I manage to get what I want by duplicate the graph, then export, modify OID's and re-importing it.
jteixeira
Posts: 1
Joined: Tue Jun 28, 2022 5:42 am

Re: Howto duplicate template?

Post by jteixeira »

Can this be done through cli?
I've looked into the cli scripts and couldn't find an option.

Thank you!
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Howto duplicate template?

Post by TheWitness »

No, there is an api for this, but it's not been requested, and no one has contributed it back to the community to date.
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 0 guests