#!/usr/bin/env python3 # -*- coding: utf-8 -*- # if you change this script "touch" it to reload by apache # e.g touch /var/www/html/wsgi_isttok_status.py """ Created on December 8 16:34:35 2019 https://tecadmin.net/install-apache-mod-wsgi-on-ubuntu-16-04-xenial Install: Include in /etc/apache2/conf-available/mod-wsgi.conf : WSGIScriptAlias /isttok /var/www/html/wsgi_isttok_status.py and do: systemctl restart apache2 @author: bernardo carvalho@IPFN """ # from epics import caget, caput, cainfo, PV import os #os.environ['EPICS_CA_ADDR_LIST'] = 'localhost 192.168.1.110 192.168.1.120' #os.environ['EPICS_CA_ADDR_LIST'] = 'localhost 192.168.1.110' os.environ['EPICS_CA_ADDR_LIST'] = '192.168.1.110' os.environ['EPICS_CA_AUTO_ADDR_LIST'] = 'NO' def application(environ,start_response): status = '200 OK' html = '\n' \ '
RPump1-Pressure: ' + RPump1press + ' mBar. ALARM Status:' +RPpreAlarm+'
' else: html += 'TMPump1-PressureAdmission: ' + TMPump1press + ' mBar
' html += 'VVessel-Pressure: ' + VVesselpress + ' mBar
' html += 'OPSTATE: ' + opState + ', UPS-OnBattery: '+ OnBattery+ '
' html += 'OPREQ: ' + opReq + '
' if opReqN == 0: html += 'Note: you can try to login to rpi-isttok machine and do: ' html += '
caput ISTTOK:central:OPREQ START' html += '
PULSE-NUMBER: ' + pulseNum + '
' html += 'Rpi CurrentTime: ' + rpiCurrentTime + '
' else: html += 'RPump1-Pressure: ' + str(RPump1press) + ' mBar
' # return [html] # RPump1press = caget('ISTTOK:vacuum:RPump1-Pressure') # RPump2press = caget('ISTTOK:vacuum:RPump2-Pressure') # html += 'RPump2-Pressure: ' + str(RPump2press) + ' mBar
' # TMPump1press = caget('ISTTOK:vacuum:TMPump1-PressureAdmission') # VVesselpress = caget('ISTTOK:vacuum:VVessel-Pressure') # RPump2press = caget('ISTTOK:central:RPump2-Pressure') # html += '' + RPump1Info + ''