NagiosXI not emailing scheduled reports

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NagiosXI not emailing scheduled reports

Post 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

Code: Select all

touch /etc/crontab.deny
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

Code: Select all

/etc/crontab.deny
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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampath.krb
Posts: 23
Joined: Fri Dec 09, 2016 3:07 pm

Re: NagiosXI not emailing scheduled reports

Post 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 
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NagiosXI not emailing scheduled reports

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampath.krb
Posts: 23
Joined: Fri Dec 09, 2016 3:07 pm

Re: NagiosXI not emailing scheduled reports

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NagiosXI not emailing scheduled reports

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampath.krb
Posts: 23
Joined: Fri Dec 09, 2016 3:07 pm

Re: NagiosXI not emailing scheduled reports

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NagiosXI not emailing scheduled reports

Post 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>"
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampath.krb
Posts: 23
Joined: Fri Dec 09, 2016 3:07 pm

Re: NagiosXI not emailing scheduled reports

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NagiosXI not emailing scheduled reports

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
sampath.krb
Posts: 23
Joined: Fri Dec 09, 2016 3:07 pm

Re: NagiosXI not emailing scheduled reports

Post by sampath.krb »

Sure, you can mark the post as solved.

Thanks once again.
Locked