Enable Email Notifications if Cluster is Down

If you are running a multi-tenant system with FileCloud, make sure all site URLs for each site is accessible from the local site. This is used by the task scheduler/cron to run automated tasks for each site.

Email can be used to monitor not only clusters in a multi-tenancy but any MongoDB replica you have set up.


FileCloud uses a cron job (on Linux) or Windows Task Scheduler (on Windows) to perform certain ongoing maintenance tasks.
One of these tasks can be to send an email when one of the cluster instances or any MongoDB replica is down.

The email settings used for this notification are in cloudconfig.php.

  • The email will be sent from: TONIDOCLOUD_REPLY_TO_EMAIL
  • The email will be sent to the address configured in: TONIDOCLOUD_DBSERVER

These settings should already be configured in your cloudconfig.php file.

 

What do you want to do?

 Add a PHP file to Cron

These instructions assume your FileCloud installation is under /var/www/ folder.

To add a PHP to a Cron Job in Linux:

1. Open the crontab  (assuming apache is running under www-data account).

crontab -u www-data -e

In case of centOS, use the following:

crontab -u apache -e

2. At the end of the crontab file add the following line:

php ./tools/mongohealth/index.php

3. Save and Exit


Add a PHP file to Scheduler

To configure a Scheduled Task in Windows:

1. Use Notepad or similar program to create a new file named "fccron.vbs" in a location like c:\xampp\htdocs\resources\backup folder.  

2. Enter the following contents from the code block below and save the file. Additionally, in the code block below ensure that paths to php.exe and cron.php files are correct.

CreateObject("Wscript.Shell").Run "C:\xampp\php\php.exe -f ""c:\xampp\htdocs\core\framework\cron.php"" ", 0, False

 3. Open Task Scheduler. 

4. In the right menu under Actions, click Create Task.

5. On the General tab, in Name, type in MongoDB Cluster Notification, or something similar.

6. On the Triggers tab, click New Trigger.

7. For Begin the Task, select On a Schedule.

8. In Settings, select Daily, select a time, and then select Recur every 1 days.

9. Under Advanced Settings, select Repeat Task every 5 minutes, as how often you you want the trigger to run.

10. For Duration, select Indefinitely.

11. Check Enabled, and then click OK.

12. On the Actions tab, click New Action.

13. For Action, select Start a program.

14. Enter the following path:

php ./tools/mongohealth/index.php

15. Click OK.