Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue May 23, 2017 9:39 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Add graph to host template, update Associated Graph Template
PostPosted: Fri May 06, 2005 1:17 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
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
Quote:
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. :o
Reinhard


Attachments:
File comment: graph_templates.patch
graph_templates.patch [2.81 KiB]
Downloaded 1127 times
Top
 Profile  
 
 Post subject: Further Instructions
PostPosted: Tue Jun 21, 2005 10:30 am 
Offline

Joined: Tue Jun 21, 2005 10:29 am
Posts: 8
Can you pass on some more details on how to install this? Do I just paste this code into the existing graph_templates.php? If so, where do I paste it?


Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 21, 2005 10:49 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
You may download the patch to <path_cacti>. Apply this patch using
Code:
patch -p1 < <path_cacti>/graph_templates.patch

Of course you have to
Code:
replace <path_cacti> with your path, e.g. /var/www/html/cacti or so

Tried on Linux, don't know how to do that on windows. Please have a look at http://forums.cacti.net/viewtopic.php?t=5587 for more information.

HTH
Reinhard


Top
 Profile  
 
 Post subject: I am getting this error......
PostPosted: Tue Jun 21, 2005 4:11 pm 
Offline

Joined: Tue Jun 21, 2005 10:29 am
Posts: 8
patch: **** strip count l is not a number



I assume this is because I am running 0.8.6c, when your patch was written for 0.8.6d?


Top
 Profile  
 
 Post subject: Re: I am getting this error......
PostPosted: Wed Jun 22, 2005 2:51 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
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.

Reinhard


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 10:12 am 
Offline

Joined: Tue Jun 21, 2005 10:29 am
Posts: 8
Thanks for your responses. Since I have to upgrade, and 0.8.6e is the latest, will the patch work with it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 10:21 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
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.

Reinhard


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 4:17 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
applesx wrote:
Thanks for your responses. Since I have to upgrade, and 0.8.6e is the latest, will the patch work with it?
Just tried it on cacti 0.8.6g. Results in
Code:
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 07, 2005 3:07 am 
Offline
Cacti User

Joined: Tue Aug 02, 2005 4:12 am
Posts: 85
Hello all,

is there any way to create the associated graphs automaticly ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 5:10 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
kslt wrote:
Hello all,

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 9:53 am 
Offline
Cacti User

Joined: Tue Aug 02, 2005 4:12 am
Posts: 85
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 .. ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 5:59 am 
Offline

Joined: Fri Feb 17, 2006 7:42 am
Posts: 40
kslt wrote:
so how i can emulate this button-press on "create graphs" by the script/command line .. ?


Look at the following thread http://forums.cacti.net/viewtopic.php?t=7683 and use "add_graph.php" script.


Top
 Profile  
 
 Post subject: Re: Add graph to host template, update Associated Graph Temp
PostPosted: Tue May 12, 2009 5:02 am 
Offline

Joined: Mon Dec 10, 2007 10:14 am
Posts: 26
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 14, 2009 2:15 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
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

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 14, 2009 3:16 pm 
Offline

Joined: Mon Dec 10, 2007 10:14 am
Posts: 26
That would be enough for now, I'd appreciate it if you could ! :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group