Using Slack to monitor Qlikview and Qlik Sense


Slack has only been around since August 2013, but I would definitively say it’s one of the better team communication services out there. The web client is great, and the OSX and IOS clients are truly awesome. It integrates with tons of other services, including Dropbox, GitHub, IFTTT, Jira, Google Drive, RSS, Nagios, Yo, Twitter and Pingdom are just some of the services it supports (as of today they seem to support ca 75 integrations). There are also generic connectors for incoming and outgoing webhooks, especially the incoming webhook feature will be interesting from a systems monitoring perspective – it will allows us to post messages to Slack by just calling a certain URL.

Slack integrations

In this post we will look how we can use this to both monitor the various QlikView services, as well as monitor the transfer of files (e.g. data files used by QV) to a QV server, and a as a generic way of sending notifications from QlikView Management Console (QMC).

Most of the concepts below also apply to Qlik Sense, of course.

Free is good!

Slack pricing

The free tier of Slack is surprisingly useful. It will give you a sizeable (10k lines), fully searchable message archive, 5 integrations to other services (this is probably the main limitation, at least for me).

Thus, it is quick, easy and free (!) to create an account that you can use for monitoring one or more QV servers.

Monitor QlikView services

QlikView services

So let’s get started. The scenario here is that we have a QV server with the usual services installed (QMC, QDS, QVS etc).

We will use Windows’ built in features for handling failing services, especially the feature that allows us both to restart a service that has for some reason died, as well as run any command if one or more attempts to restart a service fails. The command we will use is one that posts a message to your Slack channel.
The setup is simple: First try to restart the service a couple of times, and then finally as a last resort post a message to your Slack channel (either the default “general” channel, or a dedicated “qlikview-alert” channel or similar).

Windows service curl Slack notification

For posting to Slack we use the cURL command, which allows us to do a HTTP POST from command line. The one challenge here is that curl is a Linux command, but you can either install curl from CygWin (I have been been using it for years, it’s super good – and free) or from one of the ports made for Windows. I have had more success with CygWin’s curl than the various Windows ports out there, but your milage may vary.

The command looks something like this:

curl -X POST --data-urlencode 'payload={"text": "Action needed: QV Distribution service on server A is no longer running.", "username": "qv-monitor-bot", "icon_emoji": ":bangbang:"}' https://hooks.slack.com/services/<your token>

Note that you first need to enable the “Incoming WebHooks” integration in your Slack channel of choice. After doing that you will get a webhook URL similar to https://hooks.slack.com/services/<your token>, this is the one to be used in the call to curl above.

Emojis can be customized at will, there are lots and lots to choose from.

Assuming the webhook in Slack has been set up, the curl call above will result in a message popping up in Slack:

To try things out, you could try killing one of the monitoring QV services and make sure you get the expected response in Slack.

More docs on incoming webhooks can be found here.

By the way, as we are really just using Windows own notifications for failed Windows services, the concept can be applied to any service , so feel free to expand the use case to other services you want to monitor.

Monitor upload of files to a QlikView server

Getting the needed data into a QlikView environment is usually no problem, as QV is quite good at connecting to different data sources. Keeping stakeholders in the loop with respect to reloads of data is another story though – people are often eagerly waiting for the latest and greatest data to be available in QV. So how do we solve this?

Telling people that data has arrived on the QV server is a good first step. It’s quite common to use text files for data delivery, delivered over FTP, rsync or other mechanisms.

Using the same concept as already described, we can use a directory monitoring tool such as Directory Monitor to trigger an event when new files arrive. That event is… of course the same curl command as above. Stakeholders can now monitor a particular Slack channel (e.g. “qlikview-announce”), any information about started or finished reloads will be posted there.

Send QMC status messages to Slack

The last piece of the puzzle is a rather generic one.

Using QMC’s “Supporting Tasks” feature, it is easy to set up a QMC task that inserts a message into a Slack channel. It could be when a reload chain starts, or when a reload chain has finished and fresh data is available for users to access. Or both, of course. Or when a reload failed and manual intervention is needed.

I have had trouble getting the curl command to run straight from the QMC supporting task, instead a .BAT file had to be used to trigger the curl command from QMC.

The command line statement of the QMC supporting task looks something like this (replace with your own paths and file name):

"E:\path\to\bat\file\reload_completed.bat"

That bat file is then very similar to the curl call above. In the example below we actually post to two different channels, informing the people in those channels that a reload has failed on a particular QV server.

REM Post in Qlikview-alerts channel
curl -X POST --data-urlencode 'payload={"text": "Action needed: Reload of task XYZ failed. Server *<servername>*.", "username": "qv-monitor-bot", "icon_emoji": ":bangbang:"}' https://hooks.slack.com/services/<ID1>
REM Post in Qlikview general channel
curl -X POST --data-urlencode 'payload={"text": "Action needed: Reload of task XYZ failed. Server *<servername>*.", "username": "qv-monitor-bot", "icon_emoji": ":bangbang:"}' https://hooks.slack.com/services/<ID2>

Try it out and get some free credits

Finally, feel free to use this link to try out Slack (or the links earlier in this post), it will give you USD 100 to spend on their service. Even though you get quite far with the free service, they also have some nice upgrades so the free credit might come in handy.