Qlik Community

Qlik Sense Enterprise Documents & Videos

Documents & videos about Qlik Sense.

Qlik Sense task failure report with Nprinting

erikadvectas
Valued Contributor

Qlik Sense task failure report with Nprinting

As there is no built in task failure report in Qlik Sense, we decided to create one, with Nprinting.

Requirements:

  • 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

map_p24:

mapping Load

    _TimeDIM_Link,

    '1' as past24

resident datetime

//

where num(DateTime) >= num(now()-1);

//fetches only tasks that failed

map_rfail:

mapping LOAD distinct

    _proxySessionPackage,

    '1' as Rfailures

RESIDENT ReloadSummary

where [Reload Failure] = 1;

//arranges a table for us that we can filter on

getvar:

noconcatenate LOAD distinct

    _proxySessionPackage,

    '1' as failurepast24

RESIDENT LogContent

//only past 24 hours

where applymap('map_p24',_TimeDIM_Link,null()) = 1

//only failures

and applymap('map_rfail',_proxySessionPackage,null()) = 1;

//gets us a variable of how many tasks that failed

failuresornot:

Load

    sum(failurepast24) as f24

resident getvar;

//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.

Within Nprinting:

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.

Filters:

Add a new filter, called "Only failures past 24 hours".

Settings:

"failurepast24", "Value is", 1

Conditions:

Add a new condition, call it "Failures over the past 24 hours"

Settings:

Variable, vfailuresornot, >_ , Constant , 1

Report:

Create a new report called "Task failure xls", add the above filter "Only failures past 24 hours".


Edit the report to contain:

<failurepast24_Level>

Total number of failures past 24 hours:

<vfailuresornot>

Reload summary:

<HkBHBv>

Reload details:

<XnBPft>

</failurepast24_Level>

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.

Publish task:

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"

Message:

"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.

Attachments
Comments
deepti_singh
Contributor II

Hi Erik,

I am trying your approach and ran into an issue. I created a copy of the Operations Monitor and added a tab with the recommended script. When I reload it, I get an error " Error: Table 'ReloadSummary' not found", though I can see the table ReloadSummary in the data model as shown in the screenshot mentioned below.

I checked for the spelling, case etc.

Can you please suggest what I am doing wrong?

Thanks,

Deepti

erikadvectas
Valued Contributor

Hi there Deepti,

Which version are you using? I have only tested this with 3.2.3 of Qlik Sense Server.

Is the table drop beforehand?

Is your added table at the very end of the script?

Add it as a Section at the end(bottom) of your copy of Operations Monitor.

Cheers

deepti_singh
Contributor II

Hi Erik,

I am using Qlik Sense 3.2.0 and NPrinting 17.3. I added the script recommended by you at the end of the script of the Operations Monitor.

I did a quick test where I reloaded a copy of the Operations Monitor dashboard (without adding the script) that ran today and encountered the same error. Looks like everyday when the dashboard runs (after all the tasks run), it runs successfully. But when I make a copy of it and reload it throws the error "Error: Table 'ReloadSummary".

Maybe we can take this offline (I can share my emai id) so that I can share the two log files (the one that ran successfully and the one that fails to reload without even adding the script)?

Thanks,

Deepti

erikadvectas
Valued Contributor

Hmm. Then it might not have something to do with my script.

Can you just add the script log here?    

deepti_singh
Contributor II

Sure Erik.




Since I cannot upload files here, please find below the scripts for the two log files:


[Log files removed by moderator due to size]

deepti_singh
Contributor II

Erik,

It looks like the copy of the Operations Monitor (OM) dashboard (without your script) was failing because it was running at the same time as the original OM dashboard. But when I changed the schedule, it runs fine.

Now I added your script in the copy of the OM dashboard and it fails due to the same error mentioned above. Looks like the script is throwing an error now.

erikadvectas
Valued Contributor

Hi Deepti,

As you can see on line 1643 it already fails before my script.

From what I can see in the beginning you are using an older version. Are you reloading on Desktop? Please try the server.


2017-08-18 08:39:50 0009 LET startMsg     = 'Reloading Operations Monitor 3.1.0 from (servername) running version 3.2.0'

2017-08-18 08:39:50 0010 TRACE Reloading Operations Monitor 3.1.0 from (servername) running version 3.2.0

2017-08-18 08:39:50 0010 Reloading Operations Monitor 3.1.0 from (servername) running version 3.2.0

Whereas on mine it says:

2017-08-24 06:45:07 0020 LET startMsg = 'Reloading Operations Monitor 3.3.4 from ACTUALSERVERNAME running version 3.2.0. ' & If(db_v_file_override=2,'Database logs chosen',if(db_v_file_override=1,'File logs chosen','Default log source selected (will check database first, then files)'))

2017-08-24 06:45:07 0021 TRACE Reloading Operations Monitor 3.3.4 from ACTUALSERVERNAME running version 3.2.0. Default log source selected (will check database first, then files)

2017-08-24 06:45:07 0021 Reloading Operations Monitor 3.3.4 from ACTUALSERVERNAME running version 3.2.0. Default log source selected (will check database first, then files)

2017-08-24 06:45:07 0022

For some reason yours doesn't find the servername nor uses a newer version. Please try to upgrade. Also ensure that there have been some reloads the past 24 hours.

Version history
Revision #:
1 of 1
Last update:
‎04-21-2017 07:28 AM
Updated by: