Cacti / plugin_reportit

ReportIt Plugin for Cacti
GNU General Public License v2.0
7 stars 9 forks source link

Unable to add email recipients to report #24

Closed lbsou closed 5 years ago

lbsou commented 6 years ago

Cacti 1.1.38 Reportit git clone develop branch 2018-06-28

When I try to add an email recipients in a report, I hit "add" then it just bring me to the list of report...

Nothing in the logs.

Another thing that is curious, at the bottom of the email tab, there is no "save" button like in other tabs.

Thank you!

netniV commented 6 years ago

Check both the cacti logs and the apache error logs. Another thing to check is that your temporary folder has write acesss for the website user (but that usually has more issue with file uploads than anything else).

lbsou commented 6 years ago

Nothing in cacti logs with report module and report php file in debug mode Nothing in apache error.log

Not sure to understand the temporary folder validation...

gmourani commented 6 years ago

For me with the latest version of reportit (1.0.2), I can add the user email but he doesn't appears in the list and nothing in the Apache log file !

screen shot 2018-09-06 at 11 01 41 am
optimuscream commented 5 years ago

Same issue for me. I can add email address manually directly from the database.

INSERT INTO plugin_reportit_recipients (id, report_id, email, name) VALUES('21757', '1', 'email.address@domain.com', 'name' );

But when I run the report, nothing sent. No log.

netniV commented 5 years ago

Check that the auto email is actually enabled in the Settings -> ReportIt tab. You also need to have it enabled within the report definition. To query directly on the db, do the following:

select * from settings where name = 'reportit_email'
select id, auto_email from plugin_reportit_reports where id = <id>

Replace <id> with the id number of the report when you edit it.

optimuscream commented 5 years ago

Helo ,

Yes the first place I check is Reportit tab email settings. It is checked. I also run threshold alert in this cacti and email alert working well

SELECT * FROM `plugin_reportit_data_items`;
+-------+-----------+-------------+-----------+---------+------------+----------+----------------+
| id    | report_id | description | start_day | end_day | start_time | end_time | timezone       |
+-------+-----------+-------------+-----------+---------+------------+----------+----------------+
| 21757 |         1 |             | Monday    | Sunday  | 00:00:00   | 24:00:00 |  THA (GMT+07 ) |
+-------+-----------+-------------+-----------+---------+------------+----------+----------------+

select * from settings where name = 'reportit_email';
+----------------+-------+
| name           | value |
+----------------+-------+
| reportit_email | on    |
+----------------+-------+
1 row in set (0.00 sec)

select id, auto_email from plugin_reportit_reports where id = 1;
+----+------------+
| id | auto_email |
+----+------------+
|  1 | 1          |
+----+------------+
1 row in set (0.00 sec)

Cacti version 1.1.38 Latest reportit plugin cloned from github.

Thanks in advance.

ikorzha commented 5 years ago

netniV, I can confirm with other users that adding email to report doesn't function and that is a very important piece of this plugin that myself and others rely on. Back in a day of reportIT 0.8 my brother did fix this functionality, I can share with you the old 0.8 reportit it has functioning code that you can extract this email portion fix or you can apply fix of your own. Thank you in advance for your comments.

netniV commented 5 years ago

You could but I need to make it work with 1.x so there is probably little point. At this point I need to figure out how to actually create a working report since I never really used ReportIT until this week ;-)

One of the joys of being a developer, you seem to know the code before you know the product.

ikorzha commented 5 years ago

2 Things netniV, I believe the email code from 0.8.x can help as I believe it was missing in the first place from 0.8x branch and of course still missing here too on 1.0.2.. When it comes to reportIT teaching the ropes, I will be happy to provide you with learning session over Skype for business meeting or webex, it would probably take only 10-15min. I am actually uniquely positioned for that task as I have a fully working installation of reportIT on 0.8 branch as well as 1.0.2 branch to compare and contrast, so you can see non working features and how it should be..

Just let me if you a time of your convenience and I will send you private meeting invite I am in US Eastern time zone..

netniV commented 5 years ago

Thanks for the offer, if I need it I'll take you up on it. It would have to be webex as I have a personal license for teamviewer and that gets invalidated by pro ones.

Attach the code here and I will attempt to do a diff between the 0.8 version I can find and what you have. That, as you say, may be a missing piece.

ikorzha commented 5 years ago

Here attached is cc_reports.php from 0.8 that was previously fixed, which= reports.php in reportit 1.0.2

Please see if you can extract relevant piece of code to this problem.

This is how this working piece looked like in reportIT 0.8: cc_reports.txt

image

netniV commented 5 years ago

Bad news is that from what I can see, that functionality is still there, so it will have to be a full debug session to work it out.

ikorzha commented 5 years ago

Understood, we have to patiently wait. Thank you in advance.

optimuscream commented 5 years ago

Hi Mark (netniV) .. really appreciate your effort . Waiting for the result. Thanks

netniV commented 5 years ago

So, I believe I amended the scheduling options, but then found that it wouldn't work. The reason being that there is a flag "reportit_operator" which determines if scheduling appears under the "General" or "Admin" tabs. I fixed up the general one, not the admin. However, I think both need more work so a fix for that will be coming shortly.

netniV commented 5 years ago

OK, so a new update has been pushed to the 1.1.0 that's on the develop branch. This should now allow the saving of schedule fields whether they are on the general or admin tab of the report. Additionally, there is now a setting under Console->Configuration->Settings->Reports called Allow scheduling by Operators which shifts which tab the scheduling appears.

ikorzha commented 5 years ago

I confirm that report scheduling portion now working as designed and "report scheduling configuration" now get saved. Next issue in scheduling is email delivery, entered data into form doesn't get saved: Here is just a quick animated gif for reference. adding-email

netniV commented 5 years ago

So this would appear to be because the form is not sending back the custom attribute for the Add button to notify the backend to add a recipient. I'll have to see what can be done, though it may be like adding variables etc, where it's on a separate window.

rchen14b commented 5 years ago

@netniV

Hey Mark,

So the email function is basically not working yet?

netniV commented 5 years ago

You can manually add recipients but you can't through the webform. To manually add:

INSERT INTO `plugin_reportit_recipients` (`id`, `report_id`, `email`, `name`) VALUES (NULL, '999', 'netniv@cacti.net', 'Mark Brugnoli-Vinten')

Just replace the 999 with the report's ID (found when editing it) and the obvious email/name

This is a workaround until the add functionality gets repaired.

rchen14b commented 5 years ago

@netniV

Thanks. I was able to add a email address to it. But it seems like even I added my email, when I run a report, it still won't send the email. Any workaround to approach this one?

rchen14b commented 5 years ago

@netniV

Updated to 1.1.2, now I can't get into reports any more. image

netniV commented 5 years ago

Can you give me the error that is occurring? I was running fine.

rchen14b commented 5 years ago

Can you give me the error that is occurring? I was running fine.

Nothing on the log. I tried uninstall and reinstall no luck.

rchen14b commented 5 years ago

Can you give me the error that is occurring? I was running fine.

Reverted back to 1.1.1. Everything work again.

netniV commented 5 years ago

Error 500 means there will be a log entry somewhere. If it's not appearing in the cacti log, it should be appearing in the apache log

rchen14b commented 5 years ago

Error 500 means there will be a log entry somewhere. If it's not appearing in the cacti log, it should be appearing in the apache log

Could that be browser cache issue?

netniV commented 5 years ago

So I have installed 1.1.2 and found an issue where the templates table wasn't being generated if it didn't already exist. This is due to a bug I've found with the api code for creating a plugin table. So, I've made a workaround. However, I'm not sure that would affect you but try the latest download from dev.

rchen14b commented 5 years ago

So I have installed 1.1.2 and found an issue where the templates table wasn't being generated if it didn't already exist. This is due to a bug I've found with the api code for creating a plugin table. So, I've made a workaround. However, I'm not sure that would affect you but try the latest download from dev.

Thanks. I will give a try.

rchen14b commented 5 years ago

So I have installed 1.1.2 and found an issue where the templates table wasn't being generated if it didn't already exist. This is due to a bug I've found with the api code for creating a plugin table. So, I've made a workaround. However, I'm not sure that would affect you but try the latest download from dev.

Thanks. I will give a try.

Still have this issue, even with a different browser. image

rchen14b commented 5 years ago

@netniV

I think I found the log: [Wed Oct 03 12:26:45.689759 2018] [php7:warn] [pid 27148] [client MY_IP:7268] PHP Warning: include(): Failed opening './include/global.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cacti/include/auth.php on line 27, referer: http://Cacti_IP/cacti/user_group_admin.php?action=edit&id=1&tab=realms [Wed Oct 03 12:26:45.689908 2018] [php7:error] [pid 27148] [client MY_IP:7268] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/cacti/include/auth.php:30\nStack trace:\n#0 /var/www/html/cacti/plugins/reportit/reports.php(25): require_once()\n#1 {main}\n thrown in /var/www/html/cacti/include/auth.php on line 30, referer: http://Cacti_IP/cacti/user_group_admin.php?action=edit&id=1&tab=realms

netniV commented 5 years ago

Is the plugin enabled?

netniV commented 5 years ago

No wait, that error is given by user_group_admin.php not by reportit.

netniV commented 5 years ago

run this in the reportit directory:

php -l view.php
rchen14b commented 5 years ago

@netniV

The plugin is enabled. Here is the output: image

rchen14b commented 5 years ago

@netniV

HTTPD error regarding to this action: [Wed Oct 03 13:21:18.927643 2018] [php7:warn] [pid 1419] [client MY_IP:11790] PHP Warning: include(./include/global.php): failed to open stream: No such file or directory in /var/www/html/cacti/include/auth.php on line 27, referer: http://CACTI_IP/cacti/plugins.php [Wed Oct 03 13:21:18.927735 2018] [php7:warn] [pid 1419] [client MY_IP:11790] PHP Warning: include(): Failed opening './include/global.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cacti/include/auth.php on line 27, referer: http://CACTI_IP/cacti/plugins.php [Wed Oct 03 13:21:18.927888 2018] [php7:error] [pid 1419] [client MY_IP:11790] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/cacti/include/auth.php:30\nStack trace:\n#0 /var/www/html/cacti/plugins/reportit/reports.php(25): require_once()\n#1 {main}\n thrown in /var/www/html/cacti/include/auth.php on line 30, referer: http://CACTI_IP/cacti/plugins.php

ikorzha commented 5 years ago

netniV I am getting the same errors as rchen29 has reported (ERROR 500) with the latest GIT build: When I click Console ->Template->report: image

[Wed Oct 03 14:34:18.771424 2018] [php7:error] [pid 26834] [client 172.18.40.255:53017] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/include/auth.php:30\nStack trace:\n#0 /var/www/html/plugins/reportit/templates.php(25): require_once()\n#1 {main}\n thrown in /var/www/html/include/auth.php on line 30, referer: https://cactione.aaa.com/utilities.php?action=view_logfile

netniV commented 5 years ago

What version of Cacti are you two running? I think I know what the issue is now....

rchen14b commented 5 years ago

What version of Cacti are you two running? I think I know what the issue is now....

@netniV 1.1.37

ikorzha commented 5 years ago

I am on 1.1.38

netniV commented 5 years ago

One minute and i'll have an update for you.

netniV commented 5 years ago

Or I could just set the minimum requirement to 1.2 and be evil ;-)

rchen14b commented 5 years ago

Or I could just set the minimum requirement to 1.2 and be evil ;-)

😭 oh no

netniV commented 5 years ago

OK fix should be up. Let me know.

rchen14b commented 5 years ago

@netniV [Wed Oct 03 15:15:32.878344 2018] [php7:warn] [pid 22175] [client MY_IP:23736] PHP Warning: include(./include/global.php): failed to open stream: No such file or directory in /var/www/html/cacti/include/auth.php on line 27, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:15:32.878423 2018] [php7:warn] [pid 22175] [client MY_IP:23736] PHP Warning: include(): Failed opening './include/global.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cacti/include/auth.php on line 27, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:15:32.878529 2018] [php7:error] [pid 22175] [client MY_IP:23736] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/cacti/include/auth.php:30\nStack trace:\n#0 /var/www/html/cacti/plugins/reportit/reports.php(25): require_once()\n#1 {main}\n thrown in /var/www/html/cacti/include/auth.php on line 30, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:15:52.088213 2018] [php7:warn] [pid 27351] [client MY_IP:23737] PHP Warning: include(./include/global.php): failed to open stream: No such file or directory in /var/www/html/cacti/include/auth.php on line 27, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:15:52.088301 2018] [php7:warn] [pid 27351] [client MY_IP:23737] PHP Warning: include(): Failed opening './include/global.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cacti/include/auth.php on line 27, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:15:52.088397 2018] [php7:error] [pid 27351] [client MY_IP:23737] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/cacti/include/auth.php:30\nStack trace:\n#0 /var/www/html/cacti/plugins/reportit/view.php(27): require_once()\n#1 {main}\n thrown in /var/www/html/cacti/include/auth.php on line 30, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:16:28.346672 2018] [php7:warn] [pid 14282] [client MY_IP:23871] PHP Warning: include(./include/global.php): failed to open stream: No such file or directory in /var/www/html/cacti/include/auth.php on line 27, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:16:28.346746 2018] [php7:warn] [pid 14282] [client MY_IP:23871] PHP Warning: include(): Failed opening './include/global.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/cacti/include/auth.php on line 27, referer: http://MY_IP/cacti/plugins.php [Wed Oct 03 15:16:28.346842 2018] [php7:error] [pid 14282] [client MY_IP:23871] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/cacti/include/auth.php:30\nStack trace:\n#0 /var/www/html/cacti/plugins/reportit/reports.php(25): require_once()\n#1 {main}\n thrown in /var/www/html/cacti/include/auth.php on line 30, referer: http://MY_IP/cacti/plugins.php

Still not let me in.

ikorzha commented 5 years ago

Same problem for me: php error 500 still

[Wed Oct 03 16:18:59.538310 2018] [php7:warn] [pid 63193] [client 172.18.41.74:53520] PHP Warning: include(./include/global.php): failed to open stream: No such file or directory in /var/www/html/include/auth.php on line 27, referer: https://cactione.aaa.com/utilities.php?action=view_logfile [Wed Oct 03 16:18:59.538372 2018] [php7:warn] [pid 63193] [client 172.18.41.74:53520] PHP Warning: include(): Failed opening './include/global.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/include/auth.php on line 27, referer: https://cactione.aaa.com/utilities.php?action=view_logfile [Wed Oct 03 16:18:59.538450 2018] [php7:error] [pid 63193] [client 172.18.41.74:53520] PHP Fatal error: Uncaught Error: Call to undefined function get_cacti_version() in /var/www/html/include/auth.php:30\nStack trace:\n#0 /var/www/html/plugins/reportit/reports.php(25): require_once()\n#1 {main}\n thrown in /var/www/html/include/auth.php on line 30, referer: https://cactione.aaa.com/utilities.php?action=view_logfile

netniV commented 5 years ago

Right, one second.

netniV commented 5 years ago

You guys are making me go backwards ... I left 1.1.38 behind ages ago ;-)

ikorzha commented 5 years ago

Easy for you to say I am afraid to move to 1.2 yet way to many unknowns.. Hell I can't even compile spine after 1.18x my pollers stop polling.. (correction it compiles fine just doesn't poll when installed on master server)

netniV commented 5 years ago

Interesting, that shouldn't be an issue. But what version is 1.18x?