Monitor Sense services using Ctrl-Q NR

Ctrl-Q NR can get info about all client-managed Qlik Sense services. Using Node-RED it's then easy to detect services that are not running and take necessary action (alert etc).

Monitor Sense services using Ctrl-Q NR

Proper monitoring of client-managed Qlik Sense is very important, at least if you have users relying on Sense apps for making good business decisions.

Proper monitoring would imply some kind of stand-alone tool that continuously looks at Sense and detects changes in the desired state of (for example) Sense's Windows services.
The open source tool Butler does this (and much more), for example.

💡
We can set up a "monitoring-light" solution using Ctrl-Q NR and Node-RED.
It will not give the same features as Butler, but it can still be a useful data source when building Sense-related flows in Node-RED.

Solution

The Node-RED flow below uses Ctrl-Q NR to do the following:

  1. Get status for all Sense services on all nodes in the Sense cluster. This information is retrieved from the Qlik Repository Service API.
    1. A single message is returned, containing a single JSON that includes data for all services.
  2. Split the single message into one message per service.
  3. Only pass the message on if the service is NOT running.
  4. Show the non-running services in the debug view. Also count how many non-running services were detected.
Flow to detect non-running Qlik Sense services.

Here is the flow's JSON that can be imported into Node-RED:

[{"id":"d669f2be7f08fc9f","type":"tab","label":"QSEoW: Service status","disabled":false,"info":"","env":[]},{"id":"a7b9d587f8614faa","type":"qseow-service-status","z":"d669f2be7f08fc9f","name":"Get status for all Qlik services on all Sense nodes","server":"5e42d0533190acfb","x":370,"y":140,"wires":[["bcc7f8e51db387b6","9d1d93b37e0e9f48"]]},{"id":"bcc7f8e51db387b6","type":"debug","z":"d669f2be7f08fc9f","name":"Result (single JSON for all services)","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":240,"wires":[]},{"id":"26f762835b751871","type":"inject","z":"d669f2be7f08fc9f","name":"Trigger","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":140,"wires":[["a7b9d587f8614faa"]]},{"id":"84e4d54f7b451519","type":"switch","z":"d669f2be7f08fc9f","name":"Find services that are not running","property":"payload.serviceStateText","propertyType":"msg","rules":[{"t":"neq","v":"Running","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":560,"y":300,"wires":[["13e999d0c7787f46","299985ca353df48a"]]},{"id":"13e999d0c7787f46","type":"debug","z":"d669f2be7f08fc9f","name":"Services that are not running","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":380,"wires":[]},{"id":"b53e9ae19839a5ca","type":"split","z":"d669f2be7f08fc9f","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":330,"y":300,"wires":[["84e4d54f7b451519"]]},{"id":"9d1d93b37e0e9f48","type":"change","z":"d669f2be7f08fc9f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.serviceStatus","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":300,"wires":[["b53e9ae19839a5ca"]]},{"id":"cbc70767745da354","type":"comment","z":"d669f2be7f08fc9f","name":"Get client-managed Sense services that are not running","info":"","x":240,"y":80,"wires":[]},{"id":"299985ca353df48a","type":"join","z":"d669f2be7f08fc9f","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":350,"y":380,"wires":[["c7989b6813283490"]]},{"id":"c7989b6813283490","type":"debug","z":"d669f2be7f08fc9f","name":"# of service messages","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload.length","targetType":"msg","statusVal":"payload.length","statusType":"auto","x":620,"y":420,"wires":[]},{"id":"5e42d0533190acfb","type":"qseow-sense-server","name":"Dummy Qlik Sense server","protocol":"https","host":"my.qlikserver.com","port":"4242","authType":"cert","certFile":"c:\\secret\\client.pem","keyFile":"c:\\secret\\client_key.pem","certCaFile":"","jwt":""}]

Does it work?

5 services not running.

This specific Qlik Sense environment has 3 nodes, of which only two are currently started.
It is thus expected that the services on the stopped server show up as not running.

⚠️
But what if the server that Ctrl-Q NR queries is down?
Then you don't get any response at all - and this is also the weakness of this kind of monitoring setup.

A proper monitoring tool does not depend on the QRS API to respond at tell what the service status is - a proper tool figures this out itself, an example how Butler does this is found here.