Page 3 of 3
Re: NagiosXI not emailing scheduled reports
Posted: Mon Mar 13, 2017 1:02 pm
by tgriep
It looks like the apache user account was added to the crontab.deny file on the server or that the file doesn't exist and that is denying access for that user to write to it's crontab file.
If the file /etc/crontab.deny does not exist, create it by running
Then update the Scheduled report and see if the apache crontab file gets populated.
If the /etc/crontab.deny exists,
Edit it and remove the apache user from it if it is in there
Save the file and update the Schedules again.
If you still see this error
You (apache) are not allowed to use this program (crontab)
in the /var/log/httpd/error_log file, add the apache user to the /etc/crontab.allow file by running
Code: Select all
touch /etc/crontab.allow
echo apache > /etc/crontab.allow
Users must be listed in crontab.allow, or not listed in crontab.deny in order to use crontab. If neither file exists then only root can utilize crontab.
Re: NagiosXI not emailing scheduled reports
Posted: Mon Mar 13, 2017 4:25 pm
by sampath.krb
Hello tgriep,
Issue is resolved on our DEV Nagios Server and I do see reports being emailed as scheduled.
I replicated the same changes on our Prod Nagios Server as well. I do see jobs getting created in "/var/spool/cron/apache", but no reports are being emailed out.
Code: Select all
[user@srv etc]$ sudo ls -l /var/spool/cron/apache
-rw------- 1 apache apache 347 Mar 13 20:27 /var/spool/cron/apache
[user@srv etc]$ cat cron.allow
root
nagios
apache
[root@srv ~]# cat /var/spool/cron/apache
#crontab for apache user
15 16 * * * /usr/bin/php /usr/local/nagiosxi/html/includes/components/scheduledreporting/sendreport.php --report=a5vogS --username="<user>" > /dev/null 2>&1
30 16 * * * /usr/bin/php /usr/local/nagiosxi/html/includes/components/scheduledreporting/sendreport.php --report=tZgDKf --username="<user>" > /dev/null 2>&1
Re: NagiosXI not emailing scheduled reports
Posted: Mon Mar 13, 2017 4:36 pm
by tgriep
This one may be a email issue or a cron permission issue.
Can you look on the /var/log/cron file when those reports were scheduled to run and see if they ran or generated errors?
If they did run, check the following log files to see if there are any email errors, post any here so we can view them.
Code: Select all
/usr/local/nagiosxi/tmp/phpmailer.log
/var/log/maillog
Re: NagiosXI not emailing scheduled reports
Posted: Mon Mar 13, 2017 5:34 pm
by sampath.krb
I did not find any errors around the time of report schedule in the file "/usr/local/nagiosxi/tmp/phpmailer.log". And nothing in specific in CRON or maillog.
I will PM the /var/log/cron & /var/log/maillog for your reference.
phpmailer.log file is pretty big in size, hence I am not sending that file.
Re: NagiosXI not emailing scheduled reports
Posted: Tue Mar 14, 2017 8:39 am
by tgriep
Can you run this command on the Nagios server and post the output?
Code: Select all
ll /usr/local/nagiosxi/html/includes/components/scheduledreporting
Re: NagiosXI not emailing scheduled reports
Posted: Tue Mar 14, 2017 9:07 am
by sampath.krb
[<User>@<Srv> ~]$ ll /usr/local/nagiosxi/html/includes/components/scheduledreporting
total 352
-rw-r----- 1 nagios nagios 2852 Jan 11 23:09 CHANGES.txt
-rw-r----- 1 nagios nagios 774 Aug 1 2016 sanity.sh
-rw-r----- 1 nagios nagios 21910 Jan 11 23:09 scheduledreporting.inc.php
-rw-r----- 1 nagios nagios 249721 Jan 11 23:09 schedulereport.php
-rw-r----- 1 nagios nagios 74695 Jan 11 23:09 sendreport.php
Re: NagiosXI not emailing scheduled reports
Posted: Tue Mar 14, 2017 9:49 am
by tgriep
Try running the report in a console as the Apache user to see if there are any errors and post them here so we can view them.
Do this on a console on the XI server but replace <user> with the actual username from the apache crontab.
Code: Select all
su apache
/usr/bin/php /usr/local/nagiosxi/html/includes/components/scheduledreporting/sendreport.php --report=tZgDKf --username="<user>"
Re: NagiosXI not emailing scheduled reports
Posted: Tue Mar 14, 2017 11:46 am
by sampath.krb
Hi tgriep,
Some how the reports started working now. Not sure what happened yesterday. In fact I did receive the reports which were supposed to be received yesterday evening.
I believe the issue is resolved now. Thank you for all your help.
Re: NagiosXI not emailing scheduled reports
Posted: Tue Mar 14, 2017 12:14 pm
by tgriep
Maybe the reports were working yesterday but they were stuck in a mail queue somewhere, glad it is working for you now.
If you don't have anymore questions, shall I mark the post as solved and lock it?
Re: NagiosXI not emailing scheduled reports
Posted: Tue Mar 14, 2017 12:26 pm
by sampath.krb
Sure, you can mark the post as solved.
Thanks once again.