Plugin architecture and the hostinfo plugin

Support for the Plugin Architecture

Moderators: Developers, Moderators

Post Reply
pthaynes
Cacti User
Posts: 56
Joined: Mon Apr 20, 2009 1:29 am
Location: Australia

Plugin architecture and the hostinfo plugin

Post by pthaynes »

In the past I have been copying new plugins to subdirectories of the plugins directory and then installing and enabling them using the "Plugin management" web page. When doing that I have not been updating the global.php file. Is this the correct method? I am currently using plugin architecture version 2.2.

I haven't actually had any issues except I noticed that the host info plugin does not return details for any plugins that are not listed in the global.php file.

If I add in lines for each of the plugins does this break anything? Alternatively if I remove lines for plugins that support the new plugin architecture from the global.php file will that break anything?

I am thinking if I remove the excess items from the global.php file I could create a new equivalent hostinfo plugin which queries for new plugins via SQL and for old plugins via the array called $plugins.

Thanks for any responses.
Dyr
Posts: 23
Joined: Mon Sep 10, 2007 5:21 am

Post by Dyr »

I wrote a little simple patch for hostinfo.php that fix it, see below. By the way, it stills needed in recognizing enabled/disabled plugins and duplicate plugins (i.e. registered in both PA and global.conf)...but I'm lazy. :D

That's it output at my server:
Cacti Version - 0.8.7d
Plugin Architecture - 2.4
Poller Type - Cactid v
Server Info - FreeBSD 7.2-STABLE
Web Server - lighttpd/1.4.22
PHP - 5.2.9
PHP Extensions - session, Reflection, date, libxml, cgi-fcgi, standard, sockets, pcre, snmp, xml, mysql, ctype, SimpleXML, SPL, filter, bz2, gd, mbstring, mysqli
MySQL - 5.0.81
RRDTool - 1.3.7
SNMP - 5.4.2.1
Plugins
  • Plugins architecture plugins:
    Create Aggregate Graphs (aggregate - v0.71)
    Global Plugin Settings (settings - v0.6)
    Realtime Graph Viewer (realtime - v0.36)
    RRD File Cleaner (rrdclean - v0.38)
    Thresholds (thold - v0.4.1)
    Old architecture plugins:
    Syslog Monitoring (syslog - v0.5.3)
    Global Plugin Settings (settings - v0.6)
    Host Info (hostinfo - v0.2)
    Mobile Cacti (mobile - v0.1)

Code: Select all

--- hostinfo.php.orig	2007-10-25 08:43:50.000000000 +0400
+++ hostinfo.php	2009-06-05 15:21:12.000000000 +0400
@@ -121,8 +121,17 @@
 	form_alternate_row_color($colors["alternate"],$colors["light"], 0);
 	print "<td valign=top>Plugins</td><td>";
 	$bbcode .= "[b]Plugins[/b][list]";
+	$temp = db_fetch_assoc('SELECT * FROM plugin_config ORDER BY name');
+	print "<b><font color=blue>Plugins architecture plugins:</font></b><br>";
+	$bbcode .= "[b][color=blue]Plugins architecture plugins:[/color][/b]\n";
+	foreach ($temp as $t) {
+	    print (isset($t['name']) ? $t['name'] . ' (' : '') . $t['directory'] . ' - v' . $t['version'] . (isset($t['name']) ? ')' : '').'<br>';	     
+	    $bbcode .= (isset($t['name']) ? $t['name'] . ' (' : '') . $t['directory'] . ' - v' . $t['version'] . (isset($t['name']) ? ')' : '')."\n";	     
+	}
 	$c = count($plugins);
 	$x = 0;
+	print "<b><font color=blue>Old architecture plugins:</font></b><br>";
+	$bbcode .= "[b][color=blue]Old architecture plugins:[/color][/b]\n";
 	foreach ($plugins as $p) {
 		$f = "$p" . "_version";
 		$x++;
@@ -139,6 +148,8 @@
 			$bbcode .= "\n";
 		}
 	}
+	
+	
 
 	print "</td></tr>";
Attachments
This is how it should looks like at my server
This is how it should looks like at my server
new hostinfo.png (29.01 KiB) Viewed 4280 times
hostinfo.patch
Patch to add iin hostinfo.php ability to recognize PA plugins
(1.13 KiB) Downloaded 604 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests