|
|
| Author |
Message |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Tue Mar 06, 2007 3:17 am Post subject: Hook documentation? |
|
|
| Is there any other source for docs on what all the new hooks are? The Hooks wiki page was last updated in Feb 2006... I think there have been at least 1.0 and 1.1 since then.
|
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5453 Location: Wisconsin, USA
|
Posted: Tue Mar 06, 2007 3:30 pm Post subject: |
|
|
I know that Jimmy is working hard on the Plugin Arch version 2.0. Which is more in line with the design of the plugin system on 0.9.0.
I assume the documentation will be updated, but I will converse with Jimmy on this subject.
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Tue Mar 06, 2007 5:14 pm Post subject: |
|
|
| rony wrote: | I know that Jimmy is working hard on the Plugin Arch version 2.0. Which is more in line with the design of the plugin system on 0.9.0.
I assume the documentation will be updated, but I will converse with Jimmy on this subject. |
No worries. I was mainly just curious if any of the new hooks are interesting, since I keep seeing replies along the lines of "there's a new hook to solve this problem". As far as I can see, the only way to find out at the moment is to grep for do_hook, and try to follow where in the flow of code that gets called.
Doing just that with some perl, I get the following list of hooks out of 0.8.6j with Arch 1.1
(The ones marked * are not in the Wiki)
| Code: |
api_device_save lib/api_device.php
cacti_image auth_login.php
config_arrays include/config_arrays.php
config_form include/config_form.php
config_settings include/config_settings.php
console_after index.php
console_before index.php
data_sources_table data_sources.php
* device_action_array host.php
* device_action_execute host.php
* device_action_prepare host.php
draw_navigation_text lib/functions.php
* graph_buttons graph.php
* graph_buttons lib/html.php
* graph_buttons lib/html.php
* graph_image graph_image.php
* graphs_action_array graphs.php
* graphs_action_execute graphs.php
* graphs_action_prepare graphs.php
graphs_new_top_links graphs_new.php
login_after auth_login.php
login_before auth_login.php
poller_bottom poller.php
* poller_on_demand lib/poller.php
* poller_output lib/poller.php
poller_top poller.php
* prep_graph_array lib/rrd.php
* rrdtool_function_graph_cache_check lib/rrd.php
* rrdtool_function_graph_set_file lib/rrd.php
* substitute_host_data lib/variables.php
top_graph_header_tabs include/top_graph_header.php
top_graph_refresh include/top_graph_header.php
top_header_tabs include/top_header.php
update_host_status lib/functions.php
* user_admin_action user_admin.php
* user_admin_run_action user_admin.php
* user_admin_setup_sql_save user_admin.php
* user_admin_tab user_admin.php
* user_admin_user_save user_admin.php
utilities_action utilities.php
utilities_list utilities.php
* valid_host_fields include/config_form.php
|
It just seems a shame to go to the trouble of having an API, but not documenting it so it's useful to others.
|
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5453 Location: Wisconsin, USA
|
Posted: Tue Mar 06, 2007 5:36 pm Post subject: |
|
|
| Howie wrote: | | It just seems a shame to go to the trouble of having an API, but not documenting it so it's useful to others. |
It's not a shame, it's a travesty!
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
Posted: Tue Mar 06, 2007 8:15 pm Post subject: |
|
|
Ok Mr. I've got a new Avatar. He does have a full time job and is building a new room for his wife at the moment.
TheWitness
Howie,
The way it has been working is this. If you have something that you want Cacti to do and it's not provided out of the box, where must you start to add functionality. So, in the first few cases, I simply sent my code to Jimmy and WHAMO, it came back as a plugin. Pretty cool. Then, once I studied it, I figured out on my own WHEN I needed to have a new hook function.
I will spend a bit of time to document what I know here in the next few days if Jimmy does not beet me to it.
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
Posted: Wed Mar 07, 2007 12:07 am Post subject: |
|
|
Howie,
I have attached a MS Word Document (For you Linux people, don't ask, I know) with a beginning. I am going to ask Jimmy to add to it. If there is something your need, please let either I or Jimmy (preferably both) know. Jimmy should complete this document, but it's a start.
Larry
| Description: |
|
 Download |
| Filename: |
Cacti Hook Documentation.doc |
| Filesize: |
26.5 KB |
| Downloaded: |
362 Time(s) |
|
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 946 Location: B/CS Texas
|
Posted: Wed Mar 07, 2007 12:38 am Post subject: |
|
|
Here is the updated copy, still needs a lot of work and some fleshing out. And of course to be taken out of Word!
| Description: |
|
 Download |
| Filename: |
Cacti Hook Documentation.doc |
| Filesize: |
31.5 KB |
| Downloaded: |
378 Time(s) |
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Wed Mar 07, 2007 3:28 am Post subject: |
|
|
Wow. Thanks guys!
Just to be clear - it's not a particular axe to grind or anything - if anything I've been looking for distractions from writing documentation for my project That said, some time soon I'll need to get going with poller_output, I guess, at least.
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
Posted: Wed Mar 07, 2007 8:02 am Post subject: |
|
|
Great Howie! I also started on the Doc's site now that it's official. I will include a form of this documentation there as well.
And now I see, you could generate the map arrows based upon the contents of the poller_output table. Cool!
Larry
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5453 Location: Wisconsin, USA
|
Posted: Wed Mar 07, 2007 5:28 pm Post subject: |
|
|
This is why I made this section...!
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Wed Mar 07, 2007 5:38 pm Post subject: |
|
|
| TheWitness wrote: |
And now I see, you could generate the map arrows based upon the contents of the poller_output table. Cool! |
Indeed. In fact, with Boost in play, I actually need to use poller_output to get at the current data.
Apart from relying on a newer version of the PA, is there a downside to me running the whole weathermap process in poller_output instead of poller_bottom?
|
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5453 Location: Wisconsin, USA
|
Posted: Wed Mar 07, 2007 5:52 pm Post subject: |
|
|
Yah, Larry loves to change things to make it easier for him...
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9723 Location: MI, USA
|
Posted: Thu Mar 08, 2007 7:57 am Post subject: |
|
|
Howie,
Well, if all you are getting is the "latest" data from the RRDfiles, then poller_output is the fastest way to go. In fact, if you look at the latest version of THold, you will see that Jimmy has moved it to that process. As a result, his polling times for THold have dropped significantly.
So, overall, it's a good thing from if and only if you are interested in the last data. Otherwise, it does add overhead since you have to now do both the fetches and review the poller_output table.
Tony,
??
Regards,
TheWtiness
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Thu Mar 08, 2007 9:09 am Post subject: |
|
|
| TheWitness wrote: | Howie,
Well, if all you are getting is the "latest" data from the RRDfiles, then poller_output is the fastest way to go. In fact, if you look at the latest version of THold, you will see that Jimmy has moved it to that process. As a result, his polling times for THold have dropped significantly.
So, overall, it's a good thing from if and only if you are interested in the last data. Otherwise, it does add overhead since you have to now do both the fetches and review the poller_output table.
|
What I really meant was - is there any issue with a fairly long-running process hooking into poller_output? My plan is just to add an additional data source type called something like cactidata, where you specify the local_data_id instead of the rrd filename. That way, only those who want to use it have to suffer through the change
I will need to have a switch to choose between running in poller_output and running in poller_bottom though (defaulting to the latter), I think.
I agree that if people want to use the history in RRD files, they'll need to do something else, but they'll need to do something funny anyway (like write a new DS plugin), since the standard RRD datasource doesn't let you change the --start and --end anyway.
|
|
| Back to top |
|
 |
|