Cacti 1.1.5 (partly?) loads plugins even during installer

Support for the Plugin Architecture

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
Howie
Cacti Guru User
Posts: 5327
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Cacti 1.1.5 (partly?) loads plugins even during installer

#1 Post by Howie » Sun Apr 30, 2017 5:18 am

I've been updating a script for Vagrant to get a Cacti 1.x development environment going automatically, and I noticed something odd:

even during the installer process of Cacti (accepting license, checks etc), some parts of inactive plugins are loaded. If I have weathermap in the plugins/ directory before the installer has run, then a few jquery parts (select All on the templates selection page) don't work, and the final Cacti console stops partway down - BEFORE any plugins are installed or enabled.
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!)

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

Re: Cacti 1.1.5 (partly?) loads plugins even during installe

#2 Post by Howie » Sun Apr 30, 2017 9:22 am

Also, if you (as a completely random example) download the latest release of thold from github, unzip it, try to install it, realise that it's not actually for Cacti 1.x and that you need to do a git clone to get a working version, then delete the directory and do that, Cacti will continue to tell you that it's not compatible - I guess something caches the previous version's status?
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!)

User avatar
Osiris
Cacti Pro User
Posts: 835
Joined: Mon Jan 05, 2015 10:10 am

Re: Cacti 1.1.5 (partly?) loads plugins even during installe

#3 Post by Osiris » Thu Feb 08, 2018 9:42 pm

Howie,

Can you reconfirm with 1.1.34, and if they still exist, open these as issues in the GitHub repo. In 1.1.34, all the headers common across all pages now. I think the second may still be an issue.
Before history, there was a paradise, now dust.

netniV
Cacti Guru User
Posts: 2682
Joined: Sun Aug 27, 2017 12:05 am

Re: Cacti 1.1.5 (partly?) loads plugins even during installe

#4 Post by netniV » Fri Feb 09, 2018 8:02 am

So there are three functions in lib/plugins.php which look at the plugins/<plugin>/INFO file.
  • api_plugin_get_dependencies()
    This function uses parse_ini_file() to load the data into an array, then returns an array of the dependancies.

    This is used within lib/plugins.php by api_plugin_install()
  • api_plugin_remote_capabilities()
    This function uses parse_ini_file() to load the data into an array, then returns an array of the capabilities

    This is used within lib/plugins.php by api_plugin_run_plugin_hook() and api_plugin_run_plugin_hook_function() to run hooks, and api_plugin_has_capability() to check for capabilities
  • plugin_is_compatible()
    This function uses plugin_load_info_file to load the data into an array. If the value was returned as FALSE then it is assumed to be a legacy plugin. If the value returned is an array, it tries to find the version of compatibility and makes sure that the Cacti system is not below that value.

    This is used in plugins.php to determine whether to display the plugin as being compatible or not
None of these three functions check that a plugin is disabled, they simply read that data. Most of the code is completely unaware of what plugins are installed/enabled or not. If a plugin is installed, it will appear in the SQL database in the plugin_config table. The status field of that table determines whether it's enabled or not.

User avatar
phalek
Cacti Guru User
Posts: 2710
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Cacti 1.1.5 (partly?) loads plugins even during installe

#5 Post by phalek » Fri Feb 09, 2018 8:12 am

As far as I remember the setup.php file is always read in so anything that's in there and not contained in a function will be executed/included.

I realized that when I encrypted that file and Cacti failed to load although the plugin wasn't enabled at all.

Though that was with 0.8.x and I've not tested it with 1.x
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code: Select all

CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061
[/size]

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

Re: Cacti 1.1.5 (partly?) loads plugins even during installe

#6 Post by Howie » Fri Feb 09, 2018 8:28 am

1.x has a much more involved setup process (which is a good thing! :-) ). I was a bit surprised I could break it.

Anyway, I think it's no longer an issue. My vagrant build script still does the same thing, and on newer 1.x it's fine.
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