PIA 2.0 issues - HELP !

Support for the Plugin Architecture

Moderators: Developers, Moderators

jofficer
Posts: 35
Joined: Mon Feb 04, 2008 9:16 am

Post by jofficer »

srossen wrote:
sepp wrote:hr... any idea on this one?

Code: Select all

Fatal error: Call to undefined function api_plugin_hook() in /usr/share/cacti/site/include/global_arrays.php on line 620
I applied the sql file...
I got around to looking at this and used the pre-patched files and did not have this issue. I did have to change the path to adodb but now up and running fine on 0.8.7b and PIA 2.0
How did you change the adodb path, I seem to be having a similar error:

Code: Select all

Warning: include(/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php) [function.include]: failed to open stream: No such file or directory in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Warning: include() [function.include]: Failed opening '/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php' for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Fatal error: Call to undefined function NewADOConnection() in /usr/share/webapps/cacti/0.8.7b/htdocs/lib/database.php on line 38
Hellever
Posts: 1
Joined: Fri Apr 11, 2008 3:48 pm

Post by Hellever »

Hello!!!

I have a solution of this error. I installed cacti 0.8.7b-2 with plugin 2.2 and also this error has appeard:

Warning: include(/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php) [function.include]: failed to open stream: No such file or directory in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Warning: include() [function.include]: Failed opening '/usr/share/webapps/cacti/0.8.7b/htdocs/lib/adodb/adodb.inc.php' for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in /usr/share/webapps/cacti/0.8.7b/htdocs/include/global.php on line 201

Fatal error: Call to undefined function NewADOConnection() in /usr/share/webapps/cacti/0.8.7b/htdocs/lib/database.php on line 38

You have to copy adodb directory to cacti/site/lib/. This removes error. This folder you can download from kola.pl.pl
In global.php check your url path and rra path. In my case $config["rra_path"] = '/var/lib/cacti/rra';

Regards
Dyr
Posts: 23
Joined: Mon Sep 10, 2007 5:21 am

Post by Dyr »

Check rejected patch.
I have global.php.rej after patching with this text:

Code: Select all

***************
*** 179,196 ****
  /* display ALL errors */
  error_reporting(E_ALL);

  /* include base modules */
  include($config["library_path"] . "/adodb/adodb.inc.php");
  include($config["library_path"] . "/database.php");
- include_once($config["library_path"] . "/functions.php");
- include_once($config["include_path"] . "/global_constants.php");
- include_once($config["include_path"] . "/global_arrays.php");
- include_once($config["include_path"] . "/global_settings.php");

  /* connect to the database server */
  db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);

  /* include additional modules */
  include_once($config["include_path"] . "/global_form.php");
  include_once($config["library_path"] . "/html.php");
  include_once($config["library_path"] . "/html_form.php");
--- 194,217 ----
  /* display ALL errors */
  error_reporting(E_ALL);

+ /* current cacti version */
+ $config["cacti_version"] = "0.8.7b";
+
  /* include base modules */
  include($config["library_path"] . "/adodb/adodb.inc.php");
  include($config["library_path"] . "/database.php");

  /* connect to the database server */
  db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port);

  /* include additional modules */
+
+ include_once($config["library_path"] . "/functions.php");
+ include_once($config["include_path"] . "/global_constants.php");
+ include_once($config["library_path"] . "/plugins.php");
+ include_once($config["include_path"] . "/plugins.php");
+ include_once($config["include_path"] . "/global_arrays.php");
+ include_once($config["include_path"] . "/global_settings.php");
  include_once($config["include_path"] . "/global_form.php");
  include_once($config["library_path"] . "/html.php");
  include_once($config["library_path"] . "/html_form.php");
After I inspected code, I manually add and remove neccessary strings and it works!
Hezoq
Posts: 1
Joined: Fri May 30, 2008 2:47 am

Post by Hezoq »

I have the same matter but I think I found where it seems to be defined.

I know nothing about the php but in the file "/cacti/site/lib/plugin.php" there is this whitch seems to be au definition :

/**
* This function executes a hook.
* @param string $name Name of hook to fire
* @return mixed $data
*/
function api_plugin_hook($name) {
global $config, $plugin_hooks;
$data = func_get_args();
$ret = '';
$p = array();

$result = db_fetch_assoc("SELECT name, file, function FROM plugin_hooks WHERE status = 1 AND hook = '$name'", false);
if (count($result)) {
foreach ($result as $hdata) {
$p[] = $hdata['name'];
if (file_exists($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file'])) {
include_once($config['base_path'] . '/plugins/' . $hdata['name'] . '/' . $hdata['file']);
}
$function = $hdata['function'];
if (function_exists($function)) {
$function($data);
}
}
}

if (isset($plugin_hooks[$name]) && is_array($plugin_hooks[$name])) {
foreach ($plugin_hooks[$name] as $pname => $function) {
if (function_exists($function) && !function_exists('plugin_' . $pname . '_install') && !in_array($pname, $p)) {
$function($data);
}
}
}

/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $data;
}



so if it could help...
LookUpSeeBlu
Posts: 3
Joined: Thu Nov 19, 2009 11:30 am

Post by LookUpSeeBlu »

@Hellever

Thanks! I stumbled on this post and you solved my problem!

Kevin
soneedu
Posts: 12
Joined: Sun Nov 20, 2005 8:05 pm

Post by soneedu »

I meet the same problem.
Cacti 0.8.7e, PIA 2.6, Debian testing version.

Fatal error: Call to undefined function api_plugin_hook() in /usr/share/cacti/site/include/global_arrays.php on line 654

logs for Patach:
debian:/usr/share/cacti/site# patch -p1 -N <cacti-plugin-arch/cacti-plugin-0.8.7e-PA-v2.6.diff
patching file auth_changepassword.php
patching file auth_login.php
patching file data_sources.php
patching file graph_image.php
patching file graph.php
Hunk #1 succeeded at 98 (offset -2 lines).
Hunk #2 succeeded at 213 (offset -2 lines).
Hunk #3 succeeded at 246 (offset -2 lines).
patching file graphs_new.php
patching file graphs.php
patching file host.php
patching file include/auth.php
patching file include/bottom_footer.php
patching file include/global_arrays.php
patching file include/global_constants.php
patching file include/global_form.php
patching file include/global.php
Hunk #3 FAILED at 195.
1 out of 4 hunks FAILED -- saving rejects to file include/global.php.rej
patching file include/global_settings.php
Hunk #1 succeeded at 1186 (offset 1 line).
patching file include/plugins.php
patching file include/top_graph_header.php
Hunk #2 FAILED at 55.
Hunk #5 FAILED at 128.
Hunk #6 FAILED at 156.
3 out of 6 hunks FAILED -- saving rejects to file include/top_graph_header.php.rej
patching file include/top_header.php
patching file index.php
patching file lib/api_device.php
patching file lib/auth.php
patching file lib/functions.php
patching file lib/html_form.php
Hunk #1 succeeded at 655 (offset -67 lines).
Hunk #2 succeeded at 672 (offset -67 lines).
Hunk #3 succeeded at 693 (offset -67 lines).
patching file lib/html.php
patching file lib/plugins.php
patching file lib/poller.php
patching file lib/rrd.php
patching file lib/variables.php
patching file plugins/index.php
patching file plugins.php
patching file poller.php
patching file user_admin.php
patching file utilities.php
debian:/usr/share/cacti/site#


Question:

1,has the way to roll back or not.
2. is this a bug ? is there somebody can help me.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

It's best to use full files. There is no guarantee that the PIA will patch against someone else's distribution. So far with Cacti on Debian, it's a safe bet to install from source if you want to be successful unless you want to wait on the packager.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
matej_v
Posts: 29
Joined: Thu Feb 12, 2009 3:02 pm
Location: Slovenia

Post by matej_v »

Just to report, maybe some one else will find this useful.

Just today I downloaded cacti-0.8.7e from cacti.net and PA-v2.6 from cactiusers.org. Patching the source failed at file include/top_graph_header.php

After that I first applied the official Cacti patches to the clean Cacti source and then PA. This worked without problems.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests