Here is a very simple but very powerful DOS batch file for use as a Nagios Plugin to monitor Qlikview Tasks.
You will first need to install net-snmp and then a Nagios client like NSClient++. After that, you need to follow the Qlikview instructions on how to enable SNMP.
Once SNMP is enabled, run this script and pass the OID and the Task name. The results should look like:
OK: Job myjob status is Waiting
Refer to the Qlikview Docs for more information. Lastly, Enjoy!
@echo off
@setlocal enableextensions enabledelayedexpansion
REM Author : Gou
REM Date : 08/01/2013
REM Requires: net-snmp,NSClient++ and qlikview SNMP enabled
REM http://www.net-snmp.org/
REM
REM USAGE : This plugin takes 2 arguments
REM first argument is the OID (1.3.6.1.4.1.30764.1.2.2.1.1.3.n)
REM second argument is the name of the Qlikview Task
REM %script% %OID% %TaskName%
REM Query OID 1.3.6.1.4.1.30764.1.2.2.1.1.2.n to get the Task Name
REM Replace n with a number >0 to get individual Task Names/Task Status
REM Query OID 1.3.6.1.4.1.30764.1.2.2.1.1.3.n to get the Task Status
REM Last...Refer to the Qlikview Server Reference Manual for more details
REM Run snmpget to get the job status
for /f "tokens=4" %%i in ('snmpget -v 1 -c public 127.0.0.1:4721 %1') do set qvstat=%%i
REM If nothing is returned, go to unknown
if "%qvstat%" == "" GOTO unknown
REM Do some parsing here to remove the quotes
set qvstat=%qvstat:~1,-1%
REM If the status matches, do something
if not x%qvstat:Waiting=%==x%qvstat% GOTO ok
if not x%qvstat:Running=%==x%qvstat% GOTO ok
if not x%qvstat:Aborting=%==x%qvstat% GOTO ok
if not x%qvstat:Finished=%==x%qvstat% GOTO ok
if not x%qvstat:Warning=%==x%qvstat% GOTO warn
if not x%qvstat:Failed=%==x%qvstat% GOTO err
REM If nothing matches, run unknown and exit
:unknown
REM Adjust to warning if you like (exit should be 3)
echo CRITICAL: Status of Job %2 is unknown
exit /B 2
:err
echo CRITICAL: Job %2 failed
exit /B 2
:ok
echo OK: Job %2 status is %qvstat%
exit /B 0
:warn
echo warning: Job %2 state is warning
exit /B 1
REM END