As there is no built in task failure report in Qlik Sense, we decided to create one, with Nprinting.
- Nprinting 17+
- Qlik Sense 3+
A copy has been made of the original Operations Monitor with some slight modifications. Operations Monitor_taskfailures is the new name, and a new tab within the script is added with some alterations. The actual Qlik Sense app (Operations Monitor_taskfailures) runs a daily task (Reload task of OM_taskfailures) on a set schedule. This means we will get a report every 24 hours of the past failures. Naturally, this reload setting can be increased.
The jobs in Nprinting utilizes parts of the new script to trigger a report only if there is an error, built on the copy of “Operations Monitor”.
Here is what you need to do in Qlik Sense:
Make a copy of the Operations Monitor, call it e.g. Operation Monitor_taskfailures.
Add the following to a new tab of the script, containing the following code:
//fetches only the past 24 hours for us
'1' as past24
where num(DateTime) >= num(now()-1);
//fetches only tasks that failed
mapping LOAD distinct
'1' as Rfailures
where [Reload Failure] = 1;
//arranges a table for us that we can filter on
noconcatenate LOAD distinct
'1' as failurepast24
//only past 24 hours
where applymap('map_p24',_TimeDIM_Link,null()) = 1
and applymap('map_rfail',_proxySessionPackage,null()) = 1;
//gets us a variable of how many tasks that failed
sum(failurepast24) as f24
//sets the variable
let vfailuresornot = if(len(trim(peek('f24',-1))) = 0,'0',peek('f24',-1));
trace there has been '$(vfailuresornot)' failures;
//no need for this table anymore
drop table failuresornot;
Schedule a reload of the new Operations Monitor, e.g. 06.50 every morning.
Go to the Management Console of Nprinting.
Add a new app, e.g. "Task failure report", and a new connection to your new copy "Operation Monitor_taskfailures".
The connection should include the proxy address to the server https://servername.domain.local/ and a Sense App ID. You need to be able to extract objects from your Qlik Sense server, see the help site for more info.
Add a new filter, called "Only failures past 24 hours".
"failurepast24", "Value is", 1
Add a new condition, call it "Failures over the past 24 hours"
Variable, vfailuresornot, >_ , Constant , 1
Create a new report called "Task failure xls", add the above filter "Only failures past 24 hours".
Edit the report to contain:
Total number of failures past 24 hours:
As you can see above, by restricting data to only show what we have within our filter, only actual failures will be included. The reload summary table and reload details are official tables within the app.
Attached is an example of the Excel spreadsheet.
Create a new publish task, which you can name "Task failures on SERVERNAME".
Include the report as an Excel spreadsheet attached to the email and send to the relevant users and/or to the newsstand or unified hub. No filters are needed but add the condition above ("Failures over the past 24 hours") to be set as "true". That way you will only get emails if there have been any failures during the past 24 hours.
If you are using an email to send the report you may write:
Title: "Task failure report on BIPORTALDEV"
"There have been a number of task failures on SERVERNAME.
Please go to the Operations Monitor https://SERVERNAME/sense/app/APPID/sheet/SHEETID/state/analysis to look into this further."
Remember to grab your own address to the official Operations Monitor (our copy of the app is just for generating a warning) as it is usually reloaded every hour. Past the address to the Task sheet within the app as above so that it is easily clickable for the administrator. As per version 17.3 it is not yet possible to include report-data directly into the email, hence the .xlsx as an attachment.
Suggestion is to set the task to run a couple of minutes after the "Operations Monitor_taskfailures" job has finished within Qlik Sense, allow some margin. In this case, it is set to 07.00, just in time for the system administrators to show up in the office in the morning
Note that if upgrading, remember to make a copy of the new Operations Monitor and include your "task-failure script", in order to stay up to date.