[SOLVED] Plugins not showing within cacti

Support questions about the Threshold plugin

Moderators: Developers, Moderators

User avatar
gdsotirov
Posts: 45
Joined: Fri Sep 19, 2014 3:33 am
Location: Sofia, Bulgaraia
Contact:

Re: 'Thold' does not appear in templates

Post by gdsotirov »

The plugin...

Code: Select all

# ls -alh
total 628K
drwxrwxr-x 8 apache apache 4.0K Mar 14 15:42 ./
drwxrwxr-x 3 apache apache 4.0K Mar 14 18:56 ../
-rw-r--r-- 1 apache apache 1.1K Mar 14 03:59 .travis.yml
-rw-r--r-- 1 apache apache  16K Mar 14 03:59 CACTI-THOLD-MIB
-rw-r--r-- 1 apache apache  233 Mar 14 15:42 INFO
-rw-r--r-- 1 apache apache  26K Mar 14 03:59 LICENSE
-rw-r--r-- 1 apache apache  22K Mar 14 03:59 README.md
-rw-r--r-- 1 apache apache 5.6K Mar 14 03:59 cli_thresholds.php
drwxr-xr-x 2 apache apache 4.0K Mar 14 03:59 extras/
drwxr-xr-x 2 apache apache 4.0K Mar 14 03:59 images/
drwxr-xr-x 2 apache apache 4.0K Mar 14 03:59 includes/
-rw-r--r-- 1 apache apache   41 Mar 14 03:59 index.php
drwxr-xr-x 4 apache apache 4.0K Mar 14 03:59 locales/
-rw-r--r-- 1 apache apache  64K Mar 14 03:59 notify_lists.php
drwxr-xr-x 3 apache apache 4.0K Mar 14 03:59 service/
-rw-r--r-- 1 apache apache  54K Mar 14 03:59 setup.php
drwxr-xr-x 5 apache apache 4.0K Mar 14 03:59 themes/
-rw-r--r-- 1 apache apache  66K Mar 14 03:59 thold.php
-rw-r--r-- 1 apache apache  12K Mar 14 03:59 thold_daemon.php
-rw-r--r-- 1 apache apache  277 Mar 14 03:59 thold_daemon.service
-rw-r--r-- 1 apache apache 155K Mar 14 03:59 thold_functions.php
-rw-r--r-- 1 apache apache  47K Mar 14 03:59 thold_graph.php
-rw-r--r-- 1 apache apache  11K Mar 14 03:59 thold_process.php
-rw-r--r-- 1 apache apache  63K Mar 14 03:59 thold_templates.php
-rw-r--r-- 1 apache apache  18K Mar 14 03:59 thold_webapi.php
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: 'Thold' does not appear in templates

Post by netniV »

What does MySQL? Try doing SELECT * FROM plugin_configs;
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
gdsotirov
Posts: 45
Joined: Fri Sep 19, 2014 3:33 am
Location: Sofia, Bulgaraia
Contact:

Re: 'Thold' does not appear in templates

Post by gdsotirov »

Well, I found the time to debug this. I added trace messages into plugins.php as suggested (see my changes on GitHub). And after spending some time adding and adding trace messages, I finally got to this (which comes to confirm there is no problem with permissions):

Code: Select all

2018-03-14 22:40:30.46520:DEBUG: Enter plugins.php
2018-03-14 22:40:30.47262:DEBUG: Enter retrieve_plugin_list()
2018-03-14 22:40:30.47399:DEBUG: Plugin dir: thold2018-03-14 22:40:30.47416:DEBUG: Exit retrieve_plugin_list()
2018-03-14 22:40:30.52617:DEBUG: Enter update_show_current()
2018-03-14 22:40:30.52688:DEBUG: Enter plugins_load_temp_table()
2018-03-14 22:40:30.52701:DEBUG: table = plugin_temp_table_359531876
2018-03-14 22:40:30.53951:DEBUG: path = /var/www/htdocs/stats/cacti/plugins/
2018-03-14 22:40:30.53978:DEBUG: Reading '/var/www/htdocs/stats/cacti/plugins/'
2018-03-14 22:40:30.53994:DEBUG: Reading '/var/www/htdocs/stats/cacti/plugins/..'
2018-03-14 22:40:30.54009:DEBUG: Reading '/var/www/htdocs/stats/cacti/plugins/thold'
2018-03-14 22:40:30.54028:DEBUG: Is directory '/var/www/htdocs/stats/cacti/plugins/thold'
2018-03-14 22:40:30.54040:DEBUG: Found /var/www/htdocs/stats/cacti/plugins/thold/INFO
2018-03-14 22:40:30.54117:DEBUG: status = 0
2018-03-14 22:40:30.54310:DEBUG: exists = false
2018-03-14 22:40:30.54328:DEBUG: INSERT INTO plugin_temp_table_359531876 (directory, name, status, author, webpage, version, requires, infoname) VALUES (thold, Thresholds, 0, The Cacti Group, http://www.cacti.net, 1.0.4, , thold)
2018-03-14 22:40:30.54514:DEBUG: Reading '/var/www/htdocs/stats/cacti/plugins/index.php'
2018-03-14 22:40:30.54532:DEBUG: Reading '/var/www/htdocs/stats/cacti/plugins/.'
2018-03-14 22:40:30.54546:DEBUG: Closing '/var/www/htdocs/stats/cacti/plugins/'
2018-03-14 22:40:30.54557:DEBUG: Exit plugins_load_temp_table()
2018-03-14 22:40:30.54567:DEBUG: table = plugin_temp_table_359531876
2018-03-14 22:40:30.54682:DEBUG: SELECT count(*) FROM plugin_temp_table_359531876
2018-03-14 22:40:30.54857:DEBUG: total_rows =
2018-03-14 22:40:30.54888:DEBUG: SELECT * FROM plugin_temp_table_359531876  ORDER BY `name` ASC  LIMIT 0,50
2018-03-14 22:40:30.55181:DEBUG: Plugins count = 0
2018-03-14 22:40:30.55210:DEBUG: Exit update_show_current()
2018-03-14 22:40:30.56745:DEBUG: Exit plugins.php
Hint: Notice the values of total_rows and Plugins count above.

This puzzled me for a few minutes until I realized that the temporary table is just not created. Which made me check cacti user's permissions into the database (I'm using MySQL 5.7.21 BTW) and bingo CREATE TEMPORARY TABLES permission was not granted. I do not remember and cannot say why so, but I'm using this installation for about 10 years and as I mentioned already apparently by now I haven't used any plugins (shame on me).

Conclusion: Cacti plugins cannot be loaded from /plugins/ folder unless cacti's database user has CREATE TEMPORARY TABLES privilege granted (see CREATE TEMPORARY TABLE Syntax). Thus, in my case the solution was to execute the following:

Code: Select all

GRANT CREATE TEMPORARY TABLES ON cacti.* TO 'cacti'@'localhost';
Note: If PHP is configured to use persistent connections then this won't take effect until new connection is used (or httpd or mysql are restarted).

So this was my problem. However, I think this could be better handled into plugins.php, because CREATE TEMPORARY TABLE would raise

Code: Select all

ERROR 1044 (42000): Access denied for user 'cacti'@'localhost' to database 'cacti'
if CREATE TEMPORARY TABLES privilege is not granted. I'm not that familiar with Cacti's sources, but I think plugins.php doesn't write any debug even this is enabled in Settings.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: 'Thold' does not appear in templates

Post by netniV »

Thanks for that breakdown. I think it may be worth getting the installer to check for that by trying to create a temporary table. Since you are already on GitHub, can you create an issue for it at https://github.com/cacti/cacti/issues/ with your above findings and I'll put my comments then apply a fix. :)
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
gdsotirov
Posts: 45
Joined: Fri Sep 19, 2014 3:33 am
Location: Sofia, Bulgaraia
Contact:

Re: 'Thold' does not appear in templates

Post by gdsotirov »

netniV wrote:Since you are already on GitHub, can you create an issue for it at https://github.com/cacti/cacti/issues/ with your above findings and I'll put my comments then apply a fix. :)
I just create issue #1474 in GitHub. Thank you and let me know if any help necessary.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: [SOLVED] Plugins not showing within cacti

Post by netniV »

Thanks for that. I've marked this as solved and amend the title slightly since it wasn't specific to thold but the any plugin.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
yllam
Posts: 2
Joined: Thu Mar 08, 2018 12:31 pm

Re: [SOLVED] Plugins not showing within cacti

Post by yllam »

Ok, I finally got it working. I've uninstall/remove the thold plugin completely from/usr/share/cacti/plugins directory. Get a fresh copy from Github ( git clone https://github.com/Cacti/plugin_thold ) to the plugins directory. Be sure to rename the directory to thold. Install and activate thold from the Configuration---->Plugins Management left navigation bar from the Cacti GUI.

[user@abcxyz plugins]# ls -ls
total 8
4 -rw-r--r-- 1 root root 40 Feb 25 17:12 index.php
4 drwxr-xr-x 9 root root 4096 Mar 16 08:41 thold
[root@nagdev2 plugins]# pwd
/usr/share/cacti/plugins
[user@abcxyz plugins]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@nagdev2 plugins]#
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: [SOLVED] Plugins not showing within cacti

Post by netniV »

When using GIT to clone the cacti plugins, always specify the extra parameter for directory name:

Code: Select all

git clone https://github.com/cacti/plugin_thold thold
That last "thold" automatically names the folder used by git so you don't have to rename later. The same applies for some other users plugins (network-weathermap is actually just weathermap). Best way to be sure, check the INFO file within the plugin folder.

Starting with 1.2.x, the plugin management system will actually warn you that the folder name is wrong to be more helpful :)
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
AnjaVictor
Posts: 1
Joined: Tue Oct 02, 2018 6:18 am

Re: [SOLVED] Plugins not showing within cacti

Post by AnjaVictor »

Hello all,
I'm using cacti version 1.1.38
I installed thold plugin and I got the plugin infos from http://<cacti_url>/plugins.php but I can't get it from my TAB menu so I don't know where to configure the plugin so I can use it.

any idea of the problem?

thank you
Attachments
thold.png
thold.png (64.47 KiB) Viewed 11439 times
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: [SOLVED] Plugins not showing within cacti

Post by netniV »

Yes. You need to add it to your account as a permission under Settings -> Users or Settings -> Groups
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Rafid
Posts: 3
Joined: Thu Jan 21, 2021 6:24 am

Re: [SOLVED] Plugins not showing within cacti

Post by Rafid »

I am facing this problem in cacti.

I have created temporary table in cacti database and still no plugin is shown in cacti.

can any one help?
cedricpah
Posts: 2
Joined: Thu Aug 25, 2022 2:36 am

Re: [SOLVED] Plugins not showing within cacti

Post by cedricpah »

Hi, got the same. Solved by doing :
chmod -R 755 thold
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest