#!{{ python_executable }} import cgi import cgitb import json import os import subprocess def refresh(): command = ["{{ monitor_bin }}", "-a"] subprocess.call(command) cgitb.enable(display=0, logdir="/tmp/cgi.log") form = cgi.FieldStorage() json_file = "{{ json_file }}" if not os.path.exists(json_file) or "refresh" in form: refresh() if not os.path.exists(json_file): print """

Monitoring :

No status file found

""" exit(0) result = json.load(open(json_file)) print "" print "" print "" print "" print "

Monitoring :

" print "
" print "" print "

Last time of monitoring process : %s

" % (result['datetime']) del result['datetime'] print "
" print "
" print "

These scripts and promises have failed :

" for r in result: if result[r] != '': print "

%s

%s
" % (cgi.escape(r), cgi.escape(result[r])) print "
" print "

These scripts and promises were successful :

" print "" print ""