Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
I recently added some graph templates to several host templates.
Afterwards, I had to add all those templates to the list of 'Associated Graph Templates' for each host, and we have about 200 of them.
To automate this task, I developed a patch to graph_templates.php, based on cacti 0.8.6d.
Usage Note:
You will add a graph template to all those host templates as usual.
Now you may select "Graph Templates" on the left.
Check all graph templates you added to a host template
Select 'Insert Associated Graph Templates' from the action dropdown an GO
You will notice a text like this
You are using host templates for several hosts and you just updated one or more host templates to include another graph template. But if you display one of those hosts, you will not have the 'Associated Graph Templates' list updated.
Now you may add each graph manually and error prone.
To ease this burdon, you may even select all those graph templates, that you have added to one or more host templates, and I will do the update for you. Remember:
No graphs are generated automatically!
Only the list of 'Associated Graph Templates' is updated!
Now ALL host templates are searched for a reference to the selected graph template(s). And all hosts that belong to those host templates will have there list of graph templates updated.
People, who are updating there host templates frequently or poll a lot of hosts may find this patch useful.
Reinhard
applesx wrote:I assume this is because I am running 0.8.6c, when your patch was written for 0.8.6d?
Yes, you are right.
You may have a look at the *.patch file itself. It contains changes to the $graph_actions array and two code fragments that have to be added; nothing to be deleted.
I don't have a 0.8.6c version, so I can't deliver an appropriate patch for that version.
applesx wrote:Thanks for your responses. Since I have to upgrade, and 0.8.6e is the latest, will the patch work with it?
Sorry,
but up to the moment, I don't have any experience with 0.8.6e. Just have a try. If the patch does not match, the command will fail and nothing will be modified. To be sure, just save the file graph_template.php; it's the only file that will be changed.
The solution I posted before should work even if "patch ..." fails. If it does not, please post.
patch -p1 < graph_templates.patch
missing header for unified diff at line 3 of patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- graph_templates.php.orig 2005-04-27 02:47:39.000000000 +0200
|+++ graph_templates.php 2005-05-06 19:57:14.104051763 +0200
--------------------------
File to patch: graph_templates.php
patching file graph_templates.php
Hunk #1 succeeded at 34 (offset 2 lines).
Hunk #2 succeeded at 197 with fuzz 1 (offset 4 lines).
Hunk #3 succeeded at 270 (offset 6 lines).
Seems to work for me (and I have patched graph_templates.php to include a filter option ...)
Reinhard
is there any way to create the associated graphs automaticly ?
Yes, I'm following your struggle for automation. But there has been no solution up to now, AFAIK. Please remember, that Data Templates may virtually define "anything" that will be needed to verify/modify when creating a new Data Source (that are those "checked" fields in the Data Template). They may even include input parameters to scripts etc. I cannot think of a generalized way to generate those parms. You will have to provide them as part of some "batch input file"? You may restrict the usage of a "graph generator" to data sources/graph templates which do not need any other input? What about selecting indices when generating graphs for data queries? Which indices should be used, which not?
Seems not to be that kind of simple task.
Reinhard
a simple, that after adding a device you can go to "create graphs" and select the assosiated graph to create .. and it will do that automaticly (includes data sources and graphs).
so how i can emulate this button-press on "create graphs" by the script/command line .. ?
gandalf wrote:I recently added some graph templates to several host templates.
Afterwards, I had to add all those templates to the list of 'Associated Graph Templates' for each host, and we have about 200 of them.
To automate this task, I developed a patch to graph_templates.php, based on cacti 0.8.6d.
Unless I'm missing it, this hasn't made it into Cacti ? I've got the same issue where I want to update both the Associated Graphs and Data templates for a particular host template, not necessarily to add all the graphs. Is there any plans to implement this ? I realise this post was from a long while back but I'd have thought it would be a fairly requested feature.
This should now be part of cacti main SVN branch. But I still have to resolve an issue. This code now accepts even Data Queries.
I can provide you with a patch against 087d, but this works for "simple" Graph Templates only, no Data Queries
Reinhard