Event Handler examples
Overview
The Event Handler framework in MyClient Enterprise is a great way to automate tasks, create custom reports, and add new functionality to your backup business. Any action in MyClient can cause an event to happen. New actions and events are regularly added to the MyClient, so keep an eye on the changelog » for updates.
This page is a non-exhaustive list of example solutions built using Event Handlers, that may inspire you in creating more automation in your own installations.
Example 1: Send warning email to staff when a customer exceeds quota
- Use the Manage Bulkmail Templates page to create a new email template to send.
- Create the following event handler:
- Backupjob completed Where status is: Quota Exceeded → Send email Template: (your saved template), Recipient: (your own email address)
Note that the "Include Event Details" option includes information about the source of the event; in this case, including the customer's username and basic information about the backupset and backupjob in which the status was detected. This information is reasonably technical. In this case, it is appropriate to choose "Include Event Details" in the event handler. However, in emails sent to the customer, it might not be appropriate to use this option.
Example 2: When a customer exceeds quota, increase quota by 10GB and then revert after 7 days
- Create the following event handler:
- Backupjob completed Where status is Quota Exceeded → Apply Temporary Quota Change Quota (GB): 5, Duration: 7 days, Relative: Yes
You may wish to combine this with the above example to notify you when this action takes place (if multiple events handle the same condition, they will all run).
Example 3: Create a custom daily report
- Use the Search Backupsets page to find customers and backupsets meeting your criteria
- Save your search with a descriptive name
- Create the following event handler:
- Every day At: 7.00am → Send custom backup report Select backupsets: (your saved search), Template: Modern, Recipient: (your choice)
It's important to use a descriptive name when saving your search; partially so that you recall the purpose of the search in future, but also because the event handler uses the name of the saved search as the email subject. This example can be useful for providing a single report on multiple backup accounts to a single customer, keeping tabs on a group of customers, and much more.
Example 4: Create a daily report for a customer with multiple backupjobs per day
- On the Search Backupjobs page, create the following search:
- WHERE Customer is (target customer) AND Hours since job end is up to 24 hours
- Save your search with a descriptive name
- Create the following event handler:
- Every day At: 7.00am → Send custom backup job search Select backupjobs: (your saved search), Recipient: (your choice)
Example 5: Automatic 10GB permanent quota increase and notification for customers of one reseller using over 80% quota
- On the Search Customers page, create the following search:
- WHERE Reseller is (your target reseller) AND Customer Quota Used Percent is over 80%
- Save your search with a descriptive name (Once you are satisfied that the matched customers should indeed be upgraded!)
- Use the Manage Bulkmail Templates page to create a new email to send to the customer
- e.g. "Congratulations, we're upgrading your account by 10GB"
- Be aware that the name you choose to save this notification as will be used as the subject line for the email.
- Create the following event handlers:
- Every hour → Connect to selected backup accounts by Backupset search Select backupsets: (your saved search)
- Event triggered connected to backup account Event: (the first event) → Set Backup Account Quota Quota (GB): 10, Relative: Yes
- Event triggered connected to backup account Event: (the first event) → Send email to customer Template: (your saved template), Include Event Details: No
Note that in this example, the precise event details are not relevant to the customer, and so the "Include Event Details" option should be disabled. This example also highlights the importance of choosing descriptive names for saved items.
It should also be noted that this system will catch accounts that sit between 80% and 100% of quota usage: the earlier examples should also be employed in order to catch customers that exceed quota in a single backup job while starting from below 80%.
Example 6: Tag module changes for later followup
- Tag a customer with your desired tag, save changes, and then remove the tag again
- Create the following event handlers:
- System module added to backup account Module is: any/all modules → Add tag to customer Tag: (your chosen tag)
- System module removed to backup account Module is: any/all modules → Add tag to customer Tag: (your chosen tag)
You can then later find for customers who met this criteria by making a search on the View Customers or View Accounts pages. You are free to extend this concept by adding multiple different tags, or by adding handlers for other events (e.g. automatic module allocation, quota changes, bandwidth changes, or something else).
Example 7: Test SMS support
- Follow the instructions on Configuring SMS Support » for your installation.
- Create the following event handler:
- User-initiated trigger → Send SMS Message: test message, Recipient: (your cellphone number)
- Click the "Trigger Now" button to run the event.
Example 8: Receive SMS alert when someone uses MyClient to login directly to the backup server
- Create the following event handler:
- Operator logged in to backup server → Send SMS Message: Operator logged in to backup server, Recipient: (your cellphone number)
Additional details are not appended to SMS messages for potential cost reasons. When you receive this message, you can find out more information by browsing the System Notifications page, which includes information about which operator and backup server are in question.
Example 9: Receive SMS alert when a customer has failed to enter their password on the Customer Portal
After five failed attempts to log in to the Customer Portal, access is blocked to an IP address for up to one hour. By opting to receive an instant notification of this, you can contact the customer and resolve the issue without frustrating them further.
- Create the following event handler:
- Customer login triggered bruteforce protection → Send SMS Message: Bruteforce protection triggered, Recipient: (your cellphone number)
Example 10: Automatically respond to incoming tickets
- Create the following event handler:
- New ticket received by email → Add note to ticket Message: Sorry, we're currently unavailable!
Example 11: Automatically close tickets that have not been updated in 7 days
- On the Tickets page, create the following search:
- WHERE Days since last update is Over 7 days AND Ticket Status is not Closed
- Save the search with a descriptive name
- Create the following event handlers:
- Every day Time: 12.00 noon → Connect to selected tickets Select tickets: (your saved search)
- Event triggered connected to ticket Event: (the first event) → Add note to ticket Message: "This ticket has not been updated in 7 days and will automatically close. Please open a new ticket if you are still experiencing this issue."
- Event triggered connected to ticket Event: (the first event) → Change ticket status Status: Closed
Example 12: Get a weekly report of all customers whose data use has dropped by 50% in the last week
- On the View customers page, create the following search:
- WHERE Usage change percent in one week is below -50%
- Save the search with a descriptive name
- Create the following event handler:
- Every week Day: Monday, Time: 8.30am → Send customer search as report Select customers: (your saved search)
Example 13: Attach the primary reseller to any ticket lodged by a specific reseller
- Create the following event handler:
- Ticket newly raised in MyClient → Attach reseller office to ticket Reseller office: (your primary office)
The "Ticket newly raised in MyClient" event has a limited set of filters available. However, it is possible to use any custom ticket search query, as evidenced by the following example:
Example 14: Attach reseller A to all new tickets lodged by any reseller, except for reseller B
- On the My Tickets page, create the following search:
- WHERE Not visible to any member of {reseller A} AND Not visible to any member of {reseller B} AND Ticket state is Open
- Save the search with a descriptive name
- Create the following event handlers:
- Ticket newly raised in MyClient → Connect to selected tickets (your saved search)
- Event triggered connected to ticket (the first event) → Attach reseller office to ticket (Reseller A)
Example 15: Send a reminder email to trial accounts after a few days
- On the View Customers page, create the following search:
- WHERE Days since account registration is exactly 14 days AND User Trial Status is Trial
- Save the search with a descriptive name
- On the Email Templates page, create an email template to send to the customer
- e.g. "We hope you're enjoying your trial!"
- You can use the "Company Name" and "Contact Person" macro fields to personalise the email that will be sent
- The title of the email template will be used as the email subject, so be sure to use an appropriate name
- Create the following event handlers:
- Every day at 12.00 → Connect to selected backup accounts by customer search (your saved search)
- Event triggered connected to backup account → Send email to customer by backup account report recipients
As this email will be sent directly to the customer, it is best to not enable the "include event details" option.
Example 16: Automatically retry missed backups (immediately)
- Create the following event handler:
- Backupjob completed (where status is Missed Backup) → Start backup job
Example 17: Automatically retry missed backups (batched)
- On the Search Backupsets page, create the following search:
- WHERE Hours since last job is Up to 24, AND Last Status is Missed Backup AND Backupset Type is FILE
- Save the search with a descriptive name
- Create the following event handlers:
- Every day at 9.00 → Connect to selected backupsets (your saved search)
- Event triggered connected to backupset (the above event) → Start backup job
Example 18: Offer to assist customers after they perform a restore
- Create the following event handler:
- Restore initiated → Send email to customer by backup account report recipients
Example 19: Send a warning notification to customers who restored data, only if the customer opts in to notifications
- Tag a customer with a new "Wants Restore Notifications" tag
- On the View Customers page, create the following search:
- WHERE (Customer tags) is tagged with "Wants Restore Notifications"
- Save the search with a descriptive name
- Create the following event handlers:
- Restore initiated → Connect to backup account if present in search (your saved search)
- Event triggered connected to backup account (the above event) → Send email to customer by backup account report recipients
This is the first example to demonstrate the "if present in search" filter events. These filter events are available for several object types - including backup accounts and backupsets - and allow you to perform arbitrary restrictions based on the full power of MyClient's search system.
Example 20: Send a customer their email report daily on failure, but also send it to another email address every day regardless
This is best achieved by first setting the customer's email report to "daily on failure", and then creating a separate custom report for the email address:
- On the Search Backupsets page, create the following search:
- WHERE Customer is (the chosen customer)
- Save the search with a descriptive name
- Create the following event handler:
- Every day at 7.00am → Send custom backup report (your saved search, the customer's email address)
Example 21: Get an alert whenever an account's quota is changed outside of MyClient
- Create the following event handler:
- Permanent change to account quota detected on backup server → Send email (Template, new template e.g. "Mystery quota change!"; Recipient, yourself; do include event details)
Example 22: Send a monthly email report to a customer about their backup jobs
- On the Search Backupjobs page, make the following search
- WHERE Customer is (selected customer)
- AND Days since job start is (Up to) 31 days
- Save the search with a descriptive name
- On the Manage Event Handlers page, create the following event:
- Every Month (on Day 1 at 09:00) → Send custom backup job search (your saved search)
- The "Calendar" template might be appropriate for a regular email, but the "Compact Grid" option shows more detail. We're happy to introduce additional templates if the current options don’t meet your needs
- Every Month (on Day 1 at 09:00) → Send custom backup job search (your saved search)
You can test this feature by using your own email address as the recipient, or by viewing the sent email from the "Mail: Browse History" page.
Example 23: Every month, increase quota by 10% for some or all accounts
- On the View Customers page, make the following search
- WHERE Customer Name contains blank
- Alternatively, create a more restricted search that will find only the customers who should recieve this quota increase.
- Save the search with a descriptive name (i.e. "Customers to recieve auto quota increase")
- On the Manage Event Handlers page, create the following events:
- Every Month (on Day 1 at 09:00) → Connect to selected backup accounts by Customer search (your saved search)
- Event triggered connected to backup account → Set quota to formula (quota * 1.1)