[SOLVED] Plugins not showing within cacti

Support questions about the Threshold plugin

Moderators: Moderators, Developers

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

Re: 'Thold' does not appear in templates

#16 Post by gdsotirov » Wed Mar 14, 2018 1:08 pm

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

Re: 'Thold' does not appear in templates

#17 Post by netniV » Wed Mar 14, 2018 1:41 pm

What does MySQL? Try doing SELECT * FROM plugin_configs;

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

Re: 'Thold' does not appear in templates

#18 Post by gdsotirov » Wed Mar 14, 2018 4:14 pm

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

Re: 'Thold' does not appear in templates

#19 Post by netniV » Wed Mar 14, 2018 4:32 pm

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. :)

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

Re: 'Thold' does not appear in templates

#20 Post by gdsotirov » Thu Mar 15, 2018 8:22 am

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

Re: [SOLVED] Plugins not showing within cacti

#21 Post by netniV » Thu Mar 15, 2018 8:27 am

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.

yllam
Posts: 2
Joined: Thu Mar 08, 2018 12:31 pm

Re: [SOLVED] Plugins not showing within cacti

#22 Post by yllam » Fri Mar 16, 2018 12:35 pm

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.

[[email protected] 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
[[email protected] plugins]# pwd
/usr/share/cacti/plugins
[[email protected] plugins]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[[email protected] plugins]#

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

Re: [SOLVED] Plugins not showing within cacti

#23 Post by netniV » Sat Mar 17, 2018 3:51 am

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 :)

AnjaVictor
Posts: 1
Joined: Tue Oct 02, 2018 6:18 am

Re: [SOLVED] Plugins not showing within cacti

#24 Post by AnjaVictor » Tue Oct 02, 2018 6:45 am

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 472 times

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

Re: [SOLVED] Plugins not showing within cacti

#25 Post by netniV » Tue Oct 02, 2018 3:00 pm

Yes. You need to add it to your account as a permission under Settings -> Users or Settings -> Groups

Post Reply