AGGREGATE Plugin Architecture X Plugin Documentation

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
laedrus
Posts: 27
Joined: Fri Mar 07, 2008 10:28 am

AGGREGATE Plugin Architecture X Plugin Documentation

Post by laedrus »

Hello there,

Just successful installed Plugin architecture for Cacti 0.8.7b (i think it's the version)

so, i tried to install aggregate plugin, following the PIA Documentation i must change the file in this way:

/cacti/include/global.php

//# $plugins = array();
//# //$plugins[] = thold;
//# $plugins[] = aggregate;

fine, and that's what i did, after unpack the plugin on plugins directory, with the very name written on the file.

now, when i see the plugin README i see that:


DO NOT FORGET TO INSTALL THE aggregate.sql

wich don't comes with the package, cool

another curious thing is in the post of the plugin
Installation:
- tar -zxf into ./plugins/aggregate folder
- change ./include/config.php to add the plugins line for "aggregate", as usual
No more need to manually import the table sql
as you see, it asks to alter ./include/config.php instead of ./include/global.php, i think there's some mismatch somewhere.

another important thing, as the wiki documentation says about the PA, i didn't imported pa.sql to my sql schema, although i saw the need of it on some places, all this confuses me, someone who did it before knows what to do?

the main questions;

have i to import pa.sql ? (after the files upgrade everything works fine)

so, what file to alter and include the plugin?

thanks!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: AGGREGATE Plugin Architecture X Plugin Documentation

Post by gandalf »

laedrus wrote:Hello there,

Just successful installed Plugin architecture for Cacti 0.8.7b (i think it's the version)

so, i tried to install aggregate plugin, following the PIA Documentation i must change the file in this way:

/cacti/include/global.php

//# $plugins = array();
//# //$plugins[] = thold;
//# $plugins[] = aggregate;
Wrong. Do NOT comment this line!

fine, and that's what i did, after unpack the plugin on plugins directory, with the very name written on the file.

now, when i see the plugin README i see that:

DO NOT FORGET TO INSTALL THE aggregate.sql
Hmm. I was quite sure that I've dropped that old stuff from README, didn't I? Which version do you use?
Installation:
- tar -zxf into ./plugins/aggregate folder
- change ./include/config.php to add the plugins line for "aggregate", as usual
No more need to manually import the table sql
Ahh, that's correct. Cacti 087 calls it global.php; earlier cacti versions use config.php. I should make this plain enough.

as you see, it asks to alter ./include/config.php instead of ./include/global.php, i think there's some mismatch somewhere.
have i to import pa.sql ? (after the files upgrade everything works fine)
Yes
so, what file to alter and include the plugin?
Using 087x, please change global.php

very sorry for all this confusion
Reinhard
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Just commited a new README. Prereq's now read:
----[ Prerequisites

Before you install Aggregate, you need to have met the following pre-requisites:

1) Cacti 0.8.6i or Above. Versions of Cacti prior to 0.8.6 are not supported.
2) Cacti 0.8.6x versions requires Plugin Architecture V1.1. This version includes
all hooks required for AGGREGATE.
Please change ./include/config.php to add this plugin
3) Cacti 0.8.7x requires Plugin Architecture V2.x.
Please change ./include/global.php to add this plugin
Hope, this makes things plain enough. The line about "importing aggregate.sql" was dropped.
Reinhard
laedrus
Posts: 27
Joined: Fri Mar 07, 2008 10:28 am

Post by laedrus »

I checked out, and i'm using

Cacti 0.8.7b and Plugin Architecture V2.1

I'm also imported pa.sql to the database.
the lines below, wasn't commented i just did it because a posting error here in the forum, i'll repost as original now:

Code: Select all

$plugins = array(); 
//$plugins[] = thold; 
$plugins[] = aggregate;
here is how it's written on global.php

after all that, i still don't get aggregate working (i'm using aggregatev0.65)

any idea?

Thanks!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm currently working on it. PIA2.1 has at least chagesd REALM handling; that's why two "Color Template..." entries exist in User Management for each user. Check both of them and retry.
Reinhard
cacti-ca
Posts: 15
Joined: Mon Nov 17, 2008 8:36 am

Aggregate plugin not working

Post by cacti-ca »

I have followed all the changes listed in this document , i am using 0.87b and PIA2.1, changed global and imported pa.sql into cacti DB, restarted httpd and mysqld services - i get a blank IE explorer window, any ideas.

- really wanna get it working (attached gloabl.php)

access URL is http://servername/cacti/
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Aggregate plugin not working

Post by gandalf »

cacti-ca wrote: - really wanna get it working (attached gloabl.php)
???
Reinhard
cacti-ca
Posts: 15
Joined: Mon Nov 17, 2008 8:36 am

aggregate plugin - global.php is as below

Post by cacti-ca »

<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2008 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/

/*
!!! IMPORTANT !!!

The following defaults are not to be altered. Please refer to
include/config.php for user configurable database settings.

*/ Plugins section*/
$plugins = array();
$plugins[] = 'Aggregate';

/* Default database settings*/
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";


/* Default session name - Session name must contain alpha characters */
$cacti_session_name = "Cacti";

/* Include configuration */
include(dirname(__FILE__) . "/config.php");

if (isset($config["cacti_version"])) {
die("Invalid include/config.php file detected.");
exit;
}

/* Files that do not need http header information - Command line scripts */
$no_http_header_files = array(
"cmd.php",
"poller.php",
"poller_commands.php",
"script_server.php",
"query_host_cpu.php",
"query_host_partitions.php",
"sql.php",
"ss_host_cpu.php",
"ss_host_disk.php",
"ss_sql.php",
"add_device.php",
"add_graphs.php",
"add_perms.php",
"add_tree.php",
"copy_user.php",
"poller_export.php",
"poller_graphs_reapply_names.php",
"poller_output_empty.php",
"poller_reindex_hosts.php",
"rebuild_poller_cache.php"
);

$config = array();
$colors = array();

/* this should be auto-detected, set it manually if needed */
$config["cacti_server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix";

/* built-in snmp support */
$config["php_snmp_support"] = function_exists("snmpget");

/* used for includes */
$config["base_path"] = strtr(ereg_replace("(.*)[\/\\]include", "\\1", dirname(__FILE__)), "\\", "/");
$config["library_path"] = ereg_replace("(.*[\/\\])include", "\\1lib", dirname(__FILE__));
$config["include_path"] = dirname(__FILE__);
$config["rra_path"] = $config["base_path"] . '/rra';
$config['url_path'] = "/cacti/";
/* colors */
$colors["dark_outline"] = "454E53";
$colors["dark_bar"] = "AEB4B7";
$colors["panel"] = "E5E5E5";
$colors["panel_text"] = "000000";
$colors["panel_link"] = "000000";
$colors["light"] = "F5F5F5";
$colors["alternate"] = "E7E9F2";
$colors["panel_dark"] = "C5C5C5";

$colors["header"] = "00438C";
$colors["header_panel"] = "6d88ad";
$colors["header_text"] = "ffffff";
$colors["form_background_dark"] = "E1E1E1";

$colors["form_alternate1"] = "F5F5F5";
$colors["form_alternate2"] = "E5E5E5";

if ((!in_array(basename($_SERVER["PHP_SELF"]), $no_http_header_files, true)) && ($_SERVER["PHP_SELF"] != "")) {
/* Sanity Check on "Corrupt" PHP_SELF */
if ((!is_file($_SERVER["PHP_SELF"])) && (!is_file($config["base_path"] . '/' . $_SERVER["PHP_SELF"]))) {
if (!is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["PHP_SELF"])) {
if (!((is_file($_SERVER["SCRIPT_FILENAME"])) && (substr_count($_SERVER["SCRIPT_FILENAME"], $_SERVER["PHP_SELF"])))) {
echo "\nInvalid PHP_SELF Path\n";
exit;
}
}
}

/* we don't want these pages cached */
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

/* initilize php session */
session_name($cacti_session_name);
session_start();

/* detect and handle get_magic_quotes */
if (!get_magic_quotes_gpc()) {
function addslashes_deep($value) {
$value = is_array($value) ? array_map('addslashes_deep', $value) : addslashes($value);
return $value;
}

$_POST = array_map('addslashes_deep', $_POST);
$_GET = array_map('addslashes_deep', $_GET);
$_COOKIE = array_map('addslashes_deep', $_COOKIE);
}

/* make sure to start only only Cacti session at a time */
if (!isset($_SESSION["cacti_cwd"])) {
$_SESSION["cacti_cwd"] = $config["base_path"];
}else{
if ($_SESSION["cacti_cwd"] != $config["base_path"]) {
session_unset();
session_destroy();
}
}
}

/* emulate 'register_globals' = 'off' if turned on */
if ((bool)ini_get("register_globals")) {
$not_unset = array("_GET", "_POST", "_COOKIE", "_SERVER", "_SESSION", "_ENV", "_FILES", "database_type", "database_default", "database_hostname", "database_username", "database_password", "config", "colors");

/* Not only will array_merge give a warning if a parameter is not an array, it will
* actually fail. So we check if HTTP_SESSION_VARS has been initialised. */
if (!isset($_SESSION)) {
$_SESSION = array();
}

/* Merge all into one extremely huge array; unset this later */
$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_SESSION, $_ENV, $_FILES);

unset($input["input"]);
unset($input["not_unset"]);

while (list($var,) = @each($input)) {
if (!in_array($var, $not_unset)) {
unset($$var);
}
}

unset($input);
}

/* 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");
include_once($config["library_path"] . "/html_utility.php");
include_once($config["library_path"] . "/html_validate.php");
include_once($config["library_path"] . "/variables.php");
include_once($config["library_path"] . "/auth.php");

/* current cacti version */
$config["cacti_version"] = "0.8.7b";

?>
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

And what do you want to tell us by posting this include/global.php file?
Reinhard
cacti-ca
Posts: 15
Joined: Mon Nov 17, 2008 8:36 am

Correct settings

Post by cacti-ca »

I was hoping that you could confirm that changes that i have made pertaining to plugins and URL path are correct.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please use lowercaps for "aggregate"
Reinhard
cacti-ca
Posts: 15
Joined: Mon Nov 17, 2008 8:36 am

blank IE window

Post by cacti-ca »

I have done that, but i still get a blank IE window, this only happens when I install the Plugin..
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: AGGREGATE Plugin Architecture X Plugin Documentation

Post by gandalf »

laedrus wrote:now, when i see the plugin README i see that:


DO NOT FORGET TO INSTALL THE aggregate.sql

wich don't comes with the package, cool
This should be cured by the latest version as of 0.66. There's in fact no more need for installing the aggregate.sql (this was years ago...)
another important thing, as the wiki documentation says about the PA, i didn't imported pa.sql to my sql schema, although i saw the need of it on some places, all this confuses me, someone who did it before knows what to do?

the main questions;

have i to import pa.sql ? (after the files upgrade everything works fine)

so, what file to alter and include the plugin?
Yes, the pa.sql must be installed ATM.
You will still have to change config.php to add the line for each plugin.
Starting with Cacti 088, PIA will be integral part of cacti, so no more need for this step, then. 088 will be Beta not before early 2009.

Reinhard
cacti-ca
Posts: 15
Joined: Mon Nov 17, 2008 8:36 am

Post by cacti-ca »

Ok, i have already completed all these steps, but i still have the same problem, can you point me towards where i could possibly debug a non-working web page for cacti access, as it was working before i installed the aggregate plugin.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please restore your old working global.php. This should revert everything with except for the PIA itself. Please verify, that you're really on 087b
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest