Action for create_complete_graph_from_template

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Developers, Moderators

Post Reply
lorenplak
Posts: 41
Joined: Wed Feb 23, 2011 11:53 am

Action for create_complete_graph_from_template

Post by lorenplak »

Hy,
i want to add an action after creation of graph, so in my own plugin i've created a hook for create_complete_graph_from_template :

Code: Select all

api_plugin_register_hook('addGraph', 'create_complete_graph_from_template', 'addGraph_create_complete_graph_from_template', 'addGraph_actions.php');


and the function is :

Code: Select all

function addGraph_create_complete_graph_from_template($data) {
	global $config;

  cacti_log( __FUNCTION__." : ".serialize($data) );

}
but, when i had a grpah to a device, i have this in the cacti log :

02/21/2012 11:14:02 AM - CMDPHP: Poller[0] addGraph_create_complete_graph_from_template : N;

why only "N;" ?

my system : Win32box, cacti 0.8.7i, automn8 and more plugins
Cacti 0.8.7g - Windows - poller type : spine
php 5.2.14 - MySQL 5.1.47
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Action for create_complete_graph_from_template

Post by gandalf »

Which is the sequence of your plugins? Please make your plugin topmost and retry. In case this works for your plugin, AUTOM8 will break and I will know how to fix that.
R.
lorenplak
Posts: 41
Joined: Wed Feb 23, 2011 11:53 am

Re: Action for create_complete_graph_from_template

Post by lorenplak »

hy,
gandalf wrote:Which is the sequence of your plugins? Please make your plugin topmost and retry. In case this works for your plugin, AUTOM8 will break and I will know how to fix that.
R.
how can i see this sequence, how can i put my plugin topmost ?

Laurent
Cacti 0.8.7g - Windows - poller type : spine
php 5.2.14 - MySQL 5.1.47
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Action for create_complete_graph_from_template

Post by gandalf »

Select "Plugin Management" and select "Load Order" column. Then, move your plugin to the top
R.
lorenplak
Posts: 41
Joined: Wed Feb 23, 2011 11:53 am

Re: Action for create_complete_graph_from_template

Post by lorenplak »

gandalf wrote:Select "Plugin Management" and select "Load Order" column. Then, move your plugin to the top
R.
thanks.

So i've put my plugin on topmost, and modify my code, and now, it's OK.

my code is :

Code: Select all

function addGraph_create_complete_graph_from_template($data) {
	global $config;

  cacti_log( __FUNCTION__." : ".serialize($data) );
  
  return( $data );
}
my new code is the

Code: Select all

return( $data );
without this, i think that other hook for create_complete_graph_from_template won't work.

the function autom8_hook_graph_create_tree($data) doesn't do the same thing, perhaps the pb is here, no ?


Laurent
Cacti 0.8.7g - Windows - poller type : spine
php 5.2.14 - MySQL 5.1.47
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Action for create_complete_graph_from_template

Post by gandalf »

lorenplak wrote:the function autom8_hook_graph_create_tree($data) doesn't do the same thing, perhaps the pb is here, no ?
This is exactly what I wanted to find out. You've got it! And the workaround using the plugin load order will help in the meantime.
R.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Action for create_complete_graph_from_template

Post by gandalf »

gandalf wrote:
lorenplak wrote:the function autom8_hook_graph_create_tree($data) doesn't do the same thing, perhaps the pb is here, no ?
This is exactly what I wanted to find out. You've got it! And the workaround using the plugin load order will help in the meantime.
R.
Patch is in
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests