Action for create_complete_graph_from_template

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Moderators, Developers

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

Action for create_complete_graph_from_template

#1 Post by lorenplak » Tue Feb 21, 2012 5:17 am

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

Re: Action for create_complete_graph_from_template

#2 Post by gandalf » Tue Feb 21, 2012 4:47 pm

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

#3 Post by lorenplak » Wed Feb 22, 2012 4:07 am

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

Re: Action for create_complete_graph_from_template

#4 Post by gandalf » Wed Feb 22, 2012 12:44 pm

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

#5 Post by lorenplak » Thu Feb 23, 2012 4:11 am

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

Re: Action for create_complete_graph_from_template

#6 Post by gandalf » Thu Feb 23, 2012 3:56 pm

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

Re: Action for create_complete_graph_from_template

#7 Post by gandalf » Thu Feb 23, 2012 4:19 pm

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