It can be quite useful to know when a Qlik application has failed in order to correct the issue and get your business users back up and running. While QlikView has a solid task failure notification feature, Qlik Sense currently falls short. Because there is no default facility by which to issue notifications for task failures in Qlik Sense (https://community.qlik.com/thread/157245), a third party solution must be employed.
This solution is composed of three parts:
- Qlik Sense Application
A Qlik Sense application is deployed against the Qlik Sense Scheduler Log files and the errors and failures are filtered for. An error/failure output file is generated.
- Email Generator
A command line tool called ‘blat’ is used to write a generic email with the output file from above as an attachment.
- Windows Task Scheduler
The windows task scheduler is employed to schedule the command line file, which generates the email, to run at regular intervals. Any scheduler of this type can work.
1) Qlik Sense Application
Write and schedule the Qlik Sense Application.
Sample Qlik Sense App Script:
2) Email Generator
Download the ‘blat’ email utility from https://sourceforge.net/projects/blat/.
Installation can be as simple as copying the extracted BLAT files (blat.dll, blat.exe, blat.lib, blatdll.h) into the C:\Windows\system32 folder.
Paste the following code into a batch file, replacing the EMAILSERVER, USEREMAIL and USEREMAILPW with the appropriate values. The batch file must be located in the same folder as the output of the Qlik Sense application.
3) Windows Task Scheduler
Schedule the batch file from Step 2 with Windows Task Scheduler to run at an appropriate interval.
Note that the batch file accepts a parameter for the target email address and can be added into the scheduler properties.
Within the task properties, be sure to check ‘Run with highest privileges’ and ‘Run whether user is logged in or not’.
Some IT Departments may require that this be a service account login setup by a network administrator.
There are three places the interval for error checking must be set. (1) In the Qlik Sense App Script – see the vL.CheckWindowInMin variable. (2) In the QMC Task Scheduler (3) In Windows Task Scheduler. These intervals should be set equal to each other for most accurate results.
The batch file can be made into a compiled application (exe file) with one of several common utilities. Ex. http://download.cnet.com/Bat-To-Exe-Converter-Portable/3000-2069_4-10555897.html
This can be useful in making the required email credentials more secure.
BLAT can also be configured to use the registry to store common parameters such as the email server, user name and password. The batch file can also be modified to accept these parameters at runtime.
Please consult your IT Department to ensure that you’ve considered all pertinent security policies.