New PA Minimum Requirements?

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Moderators, Developers

Post Reply
Author
Message
aaronsegura
Posts: 25
Joined: Fri Jan 30, 2009 12:56 pm

New PA Minimum Requirements?

#1 Post by aaronsegura » Mon Apr 20, 2009 5:17 pm

Is it possible for someone to post a skeleton setup.php with the minimum requirements for PA 2.4? Or a basic walk-through of the procedure for getting a plugin working as far as PA2.4 is concerned?

I've been trying for the better part of a day to get a simple new plugin to register, but I've been unable to using the new plugin architecture stuff. I've been using the 'thold' plugin as a guide, but have been unable to get anything going.

Here is my current setup.php. Currently "Plugin Management" goes to a blank page. If I comment out the "plugin_nodeview_version" function, Plugin Management comes up just fine.

Code: Select all

<?php

    /*

        Stuff!

    */

function plugin_nodeview_install()  {

    api_plugin_register_hook('nodeview', 'top_header_tabs', 'nodeview_show_tab', 'setup.php');
    api_plugin_register_hook('nodeview', 'top_graph_header_tabs', 'nodeview_show_tab', 'setup.php');

    api_plugin_register_realm('nodeview', 'nodeview.php', 'View NodeView Tab', 1);

}

function plugin_nodeview_version() {
    return array(   
            'name'      => 'nodeview',
            'version'   => '0.0.1',
            'longname'  => 'NodeView',
            'author'    => 'Aaron Segura',
            'homepage'  => 'http://www.somedomain.com/',
            'email'     => '[email protected]',
            'url'       => 'http://www.somedomain.com/'
            );
}


function plugin_nodeview_uninstall () {
    // Do any extra Uninstall stuff here
    return true;
}


function plugin_nodeview_check_config () {
    // Here we will check to ensure everything is configured
    // nodeview_check_upgrade ();

    return true;

}

function nodeview_show_tab () {
    global $config;
    print '<a href="' . $config['url_path'] . 'plugins/nodeview/nodeview.php"><img src="' . $config['url_path'] . 'plugins/nodeview/images/NodeView_tab.png" alt="NodeView" align="absmiddle" border="0"></a>';
}

?>
The results of this are that I have a couple of entries in the "plugin_hooks" table, but nothing else that I can see. Shouldn't I at least have a tab across the top?

aaronsegura
Posts: 25
Joined: Fri Jan 30, 2009 12:56 pm

#2 Post by aaronsegura » Mon Apr 20, 2009 5:41 pm

./plugins.php @ line 217:

Code: Select all

                } else if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
                    $function = $file . '_version';
                    $cinfo[$file] = $function();
                    $cinfo[$file]['status'] = 0;
                    $pluginslist[] = $file;
                }
Shouldn't that be:

Code: Select all

$function = 'plugin_' . $file . '_install';
???

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

#3 Post by gandalf » Thu Apr 23, 2009 8:58 am

http://docs.cacti.net/plugins:development is the best we have until now. Please feel free to add all your knowledge there. For code enhacements or bugs, please use http://www.cacti.net/bugs.php
Reinhard

User avatar
Howie
Cacti Guru User
Posts: 5333
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

#4 Post by Howie » Sun Jun 07, 2009 10:43 am

aaronsegura wrote:./plugins.php @ line 217:

Code: Select all

                } else if (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) {
                    $function = $file . '_version';
                    $cinfo[$file] = $function();
                    $cinfo[$file]['status'] = 0;
                    $pluginslist[] = $file;
                }
Shouldn't that be:

Code: Select all

$function = 'plugin_' . $file . '_install';
???
No - it's just fetching the version info, to show in the little boxes on the plugin management page. I think it *should* be

Code: Select all

$function = 'plugin_' . $file . '_version'; 
though. $file."_version" is the old-style function to do the same job. Many plugins actually have both functions.
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

Post Reply