Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Oct 21, 2018 2:33 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Cacti 1.1.5 (partly?) loads plugins even during installer
PostPosted: Sun Apr 30, 2017 5:18 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5264
Location: United Kingdom
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!)


Top
 Profile  
 
 Post subject: Re: Cacti 1.1.5 (partly?) loads plugins even during installe
PostPosted: Sun Apr 30, 2017 9:22 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5264
Location: United Kingdom
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!)


Top
 Profile  
 
 Post subject: Re: Cacti 1.1.5 (partly?) loads plugins even during installe
PostPosted: Thu Feb 08, 2018 9:42 pm 
Offline
Cacti Pro User
User avatar

Joined: Mon Jan 05, 2015 10:10 am
Posts: 605
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.


Top
 Profile  
 
 Post subject: Re: Cacti 1.1.5 (partly?) loads plugins even during installe
PostPosted: Fri Feb 09, 2018 8:02 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 1519
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.

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Cacti 1.1.5 (partly?) loads plugins even during installe
PostPosted: Fri Feb 09, 2018 8:12 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2694
Location: Kressbronn, Germany
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:
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


Top
 Profile  
 
 Post subject: Re: Cacti 1.1.5 (partly?) loads plugins even during installe
PostPosted: Fri Feb 09, 2018 8:28 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5264
Location: United Kingdom
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!)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group