Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andreaswork/108fefded71af0b49b64d4d092e14e56 to your computer and use it in GitHub Desktop.
Save andreaswork/108fefded71af0b49b64d4d092e14e56 to your computer and use it in GitHub Desktop.
i dont even
<component name="ProjectDictionaryState">
<dictionary name="Andreas" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>Buildout</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.1 virtualenv at C:\Users\Andreas\lapio" project-jdk-type="Python SDK" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/lapio.iml" filepath="$PROJECT_DIR$/.idea/lapio.iml" />
</modules>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/Lapio_dev" vcs="Git" />
</component>
</project>
# sitename User IP/URL ssh_port use
Rovaniemi pul pulrov.dyndns.org 22 1
Oulu pul puloul.dyndns.org 222 0
Jyvaskyla pul puljyv.dyndns.org 22 1
import os
from subprocess import *
import glob
import numpy as np
import sys
import getopt
import time
from datetime import datetime
'''
Black = switched off, green = all good, yellow = needs attention soon, orange = needs attention NOW, red = FAILED
1. Read all available data from measurment stations (diskspace, measurmentstatus, temp, voltages etc.)
2. Write station data into a file
3. Read headerfile for threshold values
4. Compare header values to station values
5. Output comparison results to a file
6. Using flask, output comparison result to a website
7. DONE!
'''
def getDiskStatus(station):
try:
sshCommand = 'ssh -p {} {}@{} df -h | grep /dev/sda5'.format(station['port'], station['user'], station['ip'])
command = os.popen(sshCommand)
read = command.readline()
read = read.split()
diskStatus = read[1], read[3], read[4]
except:
diskStatus = ['X', 'X', 'X']
return diskStatus
def getConnectionStatus(station):
#print('\nChecking connection to: {}'.format(station['name']))
if station['port'] is not '0':
try:
sshCommand = os.system('nc -z -w 4 {} {}'.format(station['ip'], station['port']))
if sshCommand == 0:
#print('connection to: {} was successfull!'.format(station['name']))
return '0'
else:
return '1'
except:
return 'error'
def getMeasurmentStatus(station, timeThreshold=2):
sshCommand = 'ssh -p {} {}@{} tail -1 {}'.format(station['port'], station['user'], station['ip'], "outfile")
try:
command = os.popen(sshCommand, 'r')
res = command.readline()
res = res.split()
timeStr = res[1] + ' ' + res[2]
logTime = datetime.strptime(timeStr, '%d.%m.%Y %H:%M:%S')
remoteEpoch = (logTime - datetime(1970, 1, 1)).total_seconds()
localEpoch = (datetime.utcnow() - datetime(1970, 1, 1)).total_seconds()
if (localEpoch - remoteEpoch) < timeThreshold:
logStatus = int(localEpoch - remoteEpoch)
else:
logStatus = int(localEpoch - remoteEpoch)
except:
logStatus = 'Null'
timeStr= 'Error Error Error'
return logStatus, timeStr
def readHeaderFiles(headerfolder):
headerlist = []
for files in headerfolder:
with open(files) as file:
for line in file:
line = line.split()
if line[0] is not '#':
pass
else:
headerlist.append(line[1:])
#print(headerlist)
return headerlist
def readAddressFile(filename):
stationsList = []
with open(filename) as file:
for line in file:
line = line.split()
if line[0] is not '#':
stationsList.append({'name': line[0], 'user': line[1], 'ip': line[2], 'port': line[3], 'use': line[4],})
else:
pass
#print(stationsList)
return stationsList
#main app, read address, connect to station, fetch needed data, write it to outputfile.
def main(address_info, header_data, outFileName = 'statusInfo.txt'):
# Read data from address and header files
loop = 0 # for
while loop == 0: # testing
time.sleep(2)
addressInfo = readAddressFile(address_info)
headerInfo = readHeaderFiles(header_data)
'''############################################'''
stationStatuslist = []
headerStatuslist = []
for line in addressInfo:
if line['use'] is not '0':
connectionStatus = getConnectionStatus(line)
measurmentStatus = getMeasurmentStatus(line)
diskStatus = getDiskStatus(line)
stationStatuslist.append([measurmentStatus[1], line['name'], connectionStatus,
diskStatus[0], diskStatus[1], diskStatus[2]])
print(stationStatuslist)
else:
#print("\nSkipping: {}, monitoring turned off!!".format(line['name']))
stationStatuslist.append(['XX.XX.XXXX XX:XX:XX', line['name'], 'N', 'N', 'N', 'N'])
if outFileName is None:
return stationStatuslist
else:
file = open(outFileName, 'w')
file.write(
"Date & Time(UT)\t\t\tStation\t\tNetwork (0=OK)\tTotal disk size\t\tSpaceleft(G)\tSpace left(%)\n")
for i in stationStatuslist:
file.write('{}\t\t{}\t\t{}\t\t{}\t\t\t{}\t\t{}\t\n'.format(i[0], i[1], i[2], i[3], i[4], i[5]))
file.close()
#get data from station
#read header_file
# compare station_data to header_data
''' read conf file for addresses '''
if __name__ == "__main__":
station_addresses = "addresses.conf"
header_data = glob.glob('/home/andreas/PycharmProjects/Lapio 0.2/headers/*.txt')
main(station_addresses, header_data)
import os
import numpy
import datetime
import time
import glob
import fnmatch
def readPul(fname):
ff = open(fname, 'r')
dd = ff.readlines()
rec = {}
for ll in dd:
ll = ll.split()
if ll[0][0] == '#':
pass
else:
name = ll[0]
rec[name] = {}
rec[name]['user'] = ll[1]
rec[name]['url'] = ll[2]
rec[name]['port'] = ll[3]
rec[name]['use'] = ll[4]
return rec
def readStatusFile(fname):
ff = open(fname, 'r')
dd = ff.readlines()
status = {}
for line in dd:
line = line.split()
name = line[2]
status[name] = {}
status[name]['name'] = line[2]
status[name]['logtime'] = line[0] + ' ' + line[1]
status[name]['network'] = line[3]
status[name]['diskspace'] = line[4]
status[name]['spaceleft'] = line[5]
status[name]['freespace'] = line[6]
return status
def checkNetwork(hostname, port):
if port is not '0':
return os.system('nc -z -w 2 {} {}'.format(hostname, port))
else:
return '-1'
def pingHost(hostname):
return os.system('ping {} -c 1'.format(hostname))
def getTomoLogs(rec):
status = []
ret = []
for r in rec:
if r[4] == '1':
#pingStatus = pingHost(r[2])
pingStatus = checkNetwork(r[2], r[3])
else:
#pingStatus = '-'
pingStatus = -1
print(r[2], ' ', r[3], ' ', pingStatus)
if r[2] is not '0' and pingStatus==0:
try:
sshCmd = 'ssh -p {} {}@{} tail -1 /home/pul/outfile'.format(r[3], r[1], r[2])
print(sshCmd)
cmd = os.popen(sshCmd, 'r')
ret = cmd.readline()
rval = ret.split()
timeStr = rval[0] + ' ' + rval[1]
logTime = datetime.datetime.strptime(
timeStr,'%Y-%m-%d %H:%M:%S')
logTime = (logTime -
datetime.datetime(1970,1,1)).total_seconds()
t = (datetime.datetime.utcnow() -
datetime.datetime(1970,1,1) ).total_seconds()
logStatus = int(round(t - logTime,0))
except:
#ret = 'ERROR READING LOG'
logStatus = -1
else:
logStatus = -1
status.append([pingStatus,logStatus,ret])
return status
def getTomoLogs2(rec):
status = []
for r in rec:
# Ping host first
pingStatus = pingHost(r[2])
if pingStatus == 0:
try:
sshCmd = 'ssh -p {} {}@{} tail -1 /home/pul/outfile'.format(
r[3],r[1],r[2])
cmd = os.popen(sshCmd,'r')
logStatus = '<span class=ok">'+cmd.readline()+'</span>'
except:
logStatus = '<span class="error">ERROR READING LOG</span>'
status.append([pingStatus,logStatus])
else:
status.append([pingStatus,'<span class="error">NO NETWORK</span>'])
return status
'''
'''
def getRioLogs(rio):
tt = datetime.datetime.utcnow()
dt = datetime.datetime(tt.year, tt.month, tt.day)
dd = dt - datetime.datetime(1970,1,1)
timestamp = dd.days * 3600 * 24
status = []
for r in rio:
# Ping host first
pingStatus = pingHost(r[2])
if pingStatus == 0:
try:
sshCmd = 'ssh -p {} {}@{} tail -1 /data0/spec-{}/timestamps.log'.format(
r[3],r[1],r[2], timestamp)
cmd = os.popen(sshCmd,'r')
rval = cmd.readline().split()
logTime = float(rval[1])
t = (datetime.datetime.utcnow() - datetime.datetime(1970,1,1) ).total_seconds()
logStatus = int(round(t - logTime,0))
except:
logStatus = -9999
status.append([pingStatus,logStatus])
else:
status.append([pingStatus,-1])
return status
def getHWStatus(rec):
status = []
for r in rec:
if r[2] is not '0':
try:
sshCmd = 'ssh -p {} {}@{} python mtui/mtui.py'.format(
r[3],r[1],r[2])
cmd = os.popen(sshCmd,'r')
rval = cmd.readline().split()
except:
rval = ['X','X','X','X']
status.append(rval)
else:
rval = ['X', 'X', 'X', 'X']
return status
def getHWStatus2(rec):
status = []
for r in rec:
try:
sshCmd = 'ssh -p {} {}@{} tail -1 /mnt/sampler/logs/tui.log'.format(
r[3],r[1],r[2])
cmd = os.popen(sshCmd,'r')
rval = cmd.readline().split()
rval = rval[2:]
except:
rval = ['X','X','X','X']
status.append(rval)
return status
def getHWStatus3(rec):
status = []
for r in rec:
nws = checkNetwork(r[2], r[3])
print("HW: {} {} {}".format(r[2], r[3], nws))
if r[2] is not '0' and nws==0:
try:
sshCmd = 'ssh -p {} {}@{} tail -10 /mnt/sampler/logs/tomo.log'.format(
r[3],r[1],r[2])
cmd = os.popen(sshCmd,'r')
rr = cmd.readlines()
rr.reverse()
rval = ['X','X','X','X']
for r in rr:
if r.find('[tui]') >= 0:
s = r.split()
rval = s[3:]
break
# print(rval)
except:
rval = ['X','X','X','X']
else:
rval = ['X','X','X','X']
status.append(rval)
return status
def getDirNames(device):
dataRoot = '/data/tomo/'
deviceDataDir = dataRoot+device
z = os.listdir(deviceDataDir)
z.sort(reverse=True)
return [deviceDataDir, z]
def getFileNames(device, day):
dataDir = '/data/tomo/'+device+'/'+day+'/DATA/'
ff = os.listdir(dataDir)
files = fnmatch.filter(ff,'*.png')
files.sort()
ff = []
for f in files:
f = f.split('@')
ff.append(f[:2])
return [dataDir,ff]
def timesFromFiles(ll):
zz = []
for l in ll:
#print(l)
dd = datetime.datetime.utcfromtimestamp(int(l[0]))
timeStr = '{:02d}:{:02d}:{:02d}'.format(dd.hour, dd.minute, dd.second)
zz.append(timeStr)
return zz
def getPicName(name,day,flight):
dataDir = '/data/tomo/'+name+'/'+day+'/DATA/'
glob = '{}*.png'.format(flight)
print(dataDir)
print(glob)
ff = os.listdir(dataDir)
files = fnmatch.filter(ff,glob)
plotFile = files[0]
return dataDir[1:]+plotFile
def getFileRowCount(device,date,filename):
fName = '/data/tomo/'+ device + '/' + date + '/DATA/' + filename
ff = open(fName,'r')
dd = ff.readlines()
ff.close()
return len(dd)
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 2 columns, instead of 5 in line 6.
Sitename,Rovaniemi
Measurment,Pulsation
Location(coords),xxx
Timezone, gmt+2
Date,1.1.2017
TempOut,15
TempIn,0,35,5,30
TempCpu,0,70,20,60
DiskSpace,5,100,10,15
VoltageUps,200,230,210,225
VoltageMeasurment,10,14,11,15
Flowday,min, max
FlowdayLast,min,max
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
HEADERLIST
SITENAME: Rovaniemi
MEASURMENT: Pulsation
COORDINATES: N66.75 E25.96
TIMEZONE: UTC +02:00
DATE: 2017/07/08
2017/07/08 17:47:31
2017/07/08 18:04:31
2017/07/08 18:04:32
2017/07/08 18:04:33
2017/07/08 18:04:34
2017/07/08 18:04:35
2017/07/08 18:09:01
2017/07/08 18:09:02
2017/07/08 18:09:03
2017/07/08 18:09:53
2017/07/08 18:09:54
2017/07/08 18:16:46
2017/07/08 18:16:47
2017/07/08 18:16:48
2017/07/08 18:21:39
2017/07/08 18:21:40
2017/07/08 18:21:41
2017/07/08 18:21:42
2017/07/08 18:21:43
2017/07/08 23:29:43
2017/07/08 23:29:44
2017/07/08 23:29:45
2017/07/08 23:29:46
HEADERLIST
SITENAME: Rovaniemi
MEASURMENT: Pulsation
COORDINATES: N66.75 E25.96
TIMEZONE: UTC +02:00
DATE: 2017/07/09
['2017/07/09 23:59:44', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:45', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:46', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:47', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:48', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:49', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:50', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:51', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:52', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:53', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:54', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:55', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:56', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:57', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:58', None, None, None, None, None, None, None, None]
['2017/07/09 23:59:59', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:00', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:20', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:21', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:22', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:23', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:24', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:25', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:26', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:27', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:28', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:29', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:30', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:31', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:32', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:59', None, None, None, None, None, None, None, None]
['2017/07/09 00:32:00', None, None, None, None, None, None, None, None]
['2017/07/09 00:32:01', None, None, None, None, None, None, None, None]
['2017/07/09 00:32:02', None, None, None, None, None, None, None, None]
['2017/07/09 00:32:03', None, None, None, None, None, None, None, None]
['2017/07/09 00:32:04', None, None, None, None, None, None, None, None]
['2017/07/09 00:32:05', None, None, None, None, None, None, None, None]
HEADERLIST
SITENAME: Rovaniemi
MEASURMENT: Pulsation
COORDINATES: N66.75 E25.96
TIMEZONE: UTC +02:00
DATE: 2017/07/10
['2017/07/10 00:00:02', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:04', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:05', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:06', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:07', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:08', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:09', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:10', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:11', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:12', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:13', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:14', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:15', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:16', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:17', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:18', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:19', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:20', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:21', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:22', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:23', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:24', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:25', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:26', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:27', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:28', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:29', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:30', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:31', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:32', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:33', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:34', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:35', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:36', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:37', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:38', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:39', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:40', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:41', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:42', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:43', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:44', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:46', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:47', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:48', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:49', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:50', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:51', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:52', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:53', None, None, None, None, None, None, None, None]
['2017/07/10 00:00:54', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:45', None, None, None, None, None, None, None, None]
HEADERLIST
SITENAME: Rovaniemi
MEASURMENT: Pulsation
COORDINATES: N66.75 E25.96
TIMEZONE: UTC +02:00
DATE: 2017/07/11
['2017/07/11 23:59:47', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:48', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:49', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:50', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:51', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:52', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:53', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:54', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:55', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:56', None, None, None, None, None, None, None, None]
['2017/07/11 23:59:57', None, None, None, None, None, None, None, None]
['2017/07/09 00:31:19', None, None, None, None, None, None, None, None]
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 2 columns, instead of 5 in line 7.
contains threshold values, min max high low
Sitename,Rovaniemi
Measurment,Pulsation
Location(coords),xxx
Timezone, gmt+2
Date,1.1.2017
TempOut,15
TempIn,0,35,5,30
TempCpu,0,70,20,60
DiskSpace,5,100,10,15
VoltageUps,200,230,210,225
VoltageMeasurment,10,14,11,15
Flowday,min, max
FlowdayLast,min,max
Sitename: Rovaniemi
LocationName: Pulsaatio
Location(co-ordinates): +67.4,+25.4
Timezone: 2.0
Date: <todays_date>
TempOut: 15
TempIn: 0 35 5 30
TempCpu: min max low high
DiskSpace: 5 100 10 90
VoltageUPS: min max low high
Voltage: min max low highF
Flowday: <null>
FlowdayLast: <null>
'''
headerInfolist = []
with open(filename) as file:
for line in file:
line = line.split()
headerInfolist.append(line)
#line2 = headerInfolist2.append({'Sitename': line2[0], 'LocationName': line2[1], 'Location(co-ordinates)': line2[2],
# 'Timezone': line2[3], 'Date': line2[4], 'tempOut': line2[5], 'tempIn': line2[6],
# 'tempCpu': line2[7], 'Disk space': line2[8], 'VoltageUps': line2[9],
# 'Voltage': line2[10], 'Flowday': line2[11], 'Flowdaylast': line2[12]})
print(headerInfolist)
return headerInfolist
'''
# Sitename: Sodankyla
# LocationName: Pulsaatio
# Location(co-ords): +67.4,+25.4
# Timezone: 2.0
# Date: <todays_date>
# TEMPOUT: min max low high
# TEMPIN: min max low high
# TEMCPU: min max low high
# DISKSPACE: min max low high
# VOLTAGEUPS: min max low high
# VOLTAGE: min max low high
# FLOWDAY: <null>
# FLOWDAYLAST: <null>
# Auto detect text files and perform LF normalization
* text=auto
from flask import Flask, render_template
import getStatusWeb
import datetime
app = Flask(__name__)
app.debug = True
addressesConfFile = 'C:/Users/Andreas/PycharmProjects/lapio/addresses.conf'
pulStatusFile = 'C:/Users/Andreas/PycharmProjects/lapio/statusInfo.txt'
@app.route("/")
def index():
return render_template('index.html')
@app.route("/mag")
def mag():
return render_template('mag.html')
@app.route("/rio")
def rio():
return render_template('rio.html')
@app.route("/radar")
def radar():
return render_template('radar.html')
@app.route("/pul")
def pul():
pul = getStatusWeb.readPul(addressesConfFile)
pulStatus = getStatusWeb.readStatusFile(pulStatusFile)
# Merge data
for key in pul:
pul[key].update(pulStatus[key])
# Sort pul keys
pulkeys = list(pul.keys())
pulkeys.sort()
q = datetime.datetime.utcnow()
timeString = '{:%Y-%m-%d %H:%M:%S}'.format(q)
# return render_template('list_info.html', pul=pul, pulkeys=pulkeys, time=timeString)
return render_template('pul.html', pul=pul, pulkeys=pulkeys, time=timeString)
@app.route("/tomo")
def tomo():
return render_template('tomo.html')
@app.route("/seismo")
def seismo():
return render_template('seismo.html')
@app.route("/vlf")
def vlf():
return render_template('vlf.html')
if __name__ == "__main__":
app.run()
# Ask the user for input
host = raw_input("Enter a host to ping: ")
# Set up the echo command and direct the output to a pipe
p1 = subprocess.Popen(['ping', '-c 2', host], stdout=subprocess.PIPE)
# Run the command
output = p1.communicate()[0]
print output
--------------------------------------------------------
target = raw_input("Enter an IP or Host to ping:")
host = subprocess.Popen(['host', target], stdout = subprocess.PIPE).communicate()[0]
print host
----------------------------------------------
import logging
from logging.handlers import TimedRotatingFileHandler
# format the log entries
formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
handler = TimedRotatingFileHandler('/path/to/logfile.log',
when='midnight',
backupCount=10)
handler.setFormatter(formatter)
logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
# generate example messages
for i in range(10000):
time.sleep(1)
logger.debug('debug message')
logger.info('informational message')
logger.warn('warning')
logger.error('error message')
logger.critical('critical failure')
-----------------------------------------------------------------------------------
body {font-family: 'Roboto', sans-serif;margin:20px;}
h1 {margin-top:20px;margin-bottom:20px;}
h2 {}
table {margin-left:60px;border-collapse: collapse; border: 1px solid black;}
th {}
tr {border: 1px solid #888;}
td {padding:5px;text-align:right;}
#header {color:#888;font-size:400%; font-weight:bolder;margin-bottom:10px;}
#time {color:#888; font-size:150%;font-weight:bold;margin-bottom:40px;margin-top:10px;}
#dirlist {}
#files {}
#plot {width:95%;}
#datatable {table-layout:fixed; width:90%;}
#measurmentList {
font-family: "Times New Roman", Georgia, Serif;, size:30; margin:0px;
text-align: center;
font-size: 15pt;
}
#measurmentList table {
border: 3px #00 solid;
}
#dateTimeClock {
font-family: 'Robot', sans-serif, size: 30;margin:10px;
font-size: 50pt;
text-align: center;
}
.section {}
.tableheader {background-color:#888;font-weight:bold;color:#eee;}
.datadate {width:10%;text-align:left;vertical-align:top;}
.dataflight {width:20%;text-align:left;vertical-align:top;}
.dataplot {width:70%;vertical-align:top;}
/* ------------------------------------BUTTONS----------------------------------------------------- */
/* ------------------------------------BUTTONS----------------------------------------------------- */
/* ------------------------------------BUTTONS----------------------------------------------------- */
.greenButton {
-moz-box-shadow:inset 0px 1px 0px 0px #3dc21b;
-webkit-box-shadow:inset 0px 1px 0px 0px #3dc21b;
box-shadow:inset 0px 1px 0px 0px #3dc21b;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #44c767), color-stop(1, #5cbf2a));
background:-moz-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
background:-webkit-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
background:-o-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
background:-ms-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
background:linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#44c767', endColorstr='#5cbf2a',GradientType=0);
background-color:#44c767;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #18ab29;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:20px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #2f6627;
}
.greenButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5cbf2a), color-stop(1, #44c767));
background:-moz-linear-gradient(top, #5cbf2a 5%, #44c767 100%);
background:-webkit-linear-gradient(top, #5cbf2a 5%, #44c767 100%);
background:-o-linear-gradient(top, #5cbf2a 5%, #44c767 100%);
background:-ms-linear-gradient(top, #5cbf2a 5%, #44c767 100%);
background:linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5cbf2a', endColorstr='#44c767',GradientType=0);
background-color:#5cbf2a;
}
.greenButton:active {
position:relative;
top:1px;
}
.redButton {
-moz-box-shadow:inset 0px 1px 0px 0px #f5978e;
-webkit-box-shadow:inset 0px 1px 0px 0px #f5978e;
box-shadow:inset 0px 1px 0px 0px #f5978e;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f24537), color-stop(1, #c62d1f));
background:-moz-linear-gradient(top, #f24537 5%, #c62d1f 100%);
background:-webkit-linear-gradient(top, #f24537 5%, #c62d1f 100%);
background:-o-linear-gradient(top, #f24537 5%, #c62d1f 100%);
background:-ms-linear-gradient(top, #f24537 5%, #c62d1f 100%);
background:linear-gradient(to bottom, #f24537 5%, #c62d1f 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f24537', endColorstr='#c62d1f',GradientType=0);
background-color:#f24537;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #d02718;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:20px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #810e05;
}
.redButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #c62d1f), color-stop(1, #f24537));
background:-moz-linear-gradient(top, #c62d1f 5%, #f24537 100%);
background:-webkit-linear-gradient(top, #c62d1f 5%, #f24537 100%);
background:-o-linear-gradient(top, #c62d1f 5%, #f24537 100%);
background:-ms-linear-gradient(top, #c62d1f 5%, #f24537 100%);
background:linear-gradient(to bottom, #c62d1f 5%, #f24537 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#c62d1f', endColorstr='#f24537',GradientType=0);
background-color:#c62d1f;
}
.redButton:active {
position:relative;
top:1px;
}
.blackButton {
-moz-box-shadow:inset 0px 1px 0px 0px #000000;
-webkit-box-shadow:inset 0px 1px 0px 0px #000000;
box-shadow:inset 0px 1px 0px 0px #000000;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #050505), color-stop(1, #616161));
background:-moz-linear-gradient(top, #050505 5%, #616161 100%);
background:-webkit-linear-gradient(top, #050505 5%, #616161 100%);
background:-o-linear-gradient(top, #050505 5%, #616161 100%);
background:-ms-linear-gradient(top, #050505 5%, #616161 100%);
background:linear-gradient(to bottom, #050505 5%, #616161 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#050505', endColorstr='#616161',GradientType=0);
background-color:#050505;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #0a0a0a;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:20px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #000000;
}
.blackButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #616161), color-stop(1, #050505));
background:-moz-linear-gradient(top, #616161 5%, #050505 100%);
background:-webkit-linear-gradient(top, #616161 5%, #050505 100%);
background:-o-linear-gradient(top, #616161 5%, #050505 100%);
background:-ms-linear-gradient(top, #616161 5%, #050505 100%);
background:linear-gradient(to bottom, #616161 5%, #050505 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#616161', endColorstr='#050505',GradientType=0);
background-color:#616161;
}
.blackButton:active {
position:relative;
top:1px;
}
.yellowButton {
-moz-box-shadow:inset 0px 1px 0px 0px #cdf725;
-webkit-box-shadow:inset 0px 1px 0px 0px #cdf725;
box-shadow:inset 0px 1px 0px 0px #cdf725;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f7ff00), color-stop(1, #dff05b));
background:-moz-linear-gradient(top, #f7ff00 5%, #dff05b 100%);
background:-webkit-linear-gradient(top, #f7ff00 5%, #dff05b 100%);
background:-o-linear-gradient(top, #f7ff00 5%, #dff05b 100%);
background:-ms-linear-gradient(top, #f7ff00 5%, #dff05b 100%);
background:linear-gradient(to bottom, #f7ff00 5%, #dff05b 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7ff00', endColorstr='#dff05b',GradientType=0);
background-color:#f7ff00;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #cbeb15;
display:inline-block;
cursor:pointer;
color:#cfc9c9;
font-family:Arial;
font-size:20px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #fafa0d;
}
.yellowButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dff05b), color-stop(1, #f7ff00));
background:-moz-linear-gradient(top, #dff05b 5%, #f7ff00 100%);
background:-webkit-linear-gradient(top, #dff05b 5%, #f7ff00 100%);
background:-o-linear-gradient(top, #dff05b 5%, #f7ff00 100%);
background:-ms-linear-gradient(top, #dff05b 5%, #f7ff00 100%);
background:linear-gradient(to bottom, #dff05b 5%, #f7ff00 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dff05b', endColorstr='#f7ff00',GradientType=0);
background-color:#dff05b;
}
.yellowButton:active {
position:relative;
top:1px;
}
.orangeButton {
-moz-box-shadow:inset 0px 1px 0px 0px #f2c34b;
-webkit-box-shadow:inset 0px 1px 0px 0px #f2c34b;
box-shadow:inset 0px 1px 0px 0px #f2c34b;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f57513), color-stop(1, #f5bc49));
background:-moz-linear-gradient(top, #f57513 5%, #f5bc49 100%);
background:-webkit-linear-gradient(top, #f57513 5%, #f5bc49 100%);
background:-o-linear-gradient(top, #f57513 5%, #f5bc49 100%);
background:-ms-linear-gradient(top, #f57513 5%, #f5bc49 100%);
background:linear-gradient(to bottom, #f57513 5%, #f5bc49 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f57513', endColorstr='#f5bc49',GradientType=0);
background-color:#f57513;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #f5bf62;
display:inline-block;
cursor:pointer;
color:#fafafa;
font-family:Arial;
font-size:20px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
text-shadow:0px 1px 0px #ebb159;
}
.orangeButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f5bc49), color-stop(1, #f57513));
background:-moz-linear-gradient(top, #f5bc49 5%, #f57513 100%);
background:-webkit-linear-gradient(top, #f5bc49 5%, #f57513 100%);
background:-o-linear-gradient(top, #f5bc49 5%, #f57513 100%);
background:-ms-linear-gradient(top, #f5bc49 5%, #f57513 100%);
background:linear-gradient(to bottom, #f5bc49 5%, #f57513 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5bc49', endColorstr='#f57513',GradientType=0);
background-color:#f5bc49;
}
.orangeButton:active {
position:relative;
top:1px;
}
/* ------------------------------------BUTTONS----------------------------------------------------- */
/* ------------------------------------BUTTONS----------------------------------------------------- */
/* ------------------------------------BUTTONS----------------------------------------------------- */
setInterval(function(){
var date = new Date();
var format = "YYYY-MMM-DD DDD";
dateConvert(date,format)
}, 1);
function dateConvert(dateobj,format){
var year = dateobj.getFullYear();
var month= ("0" + (dateobj.getMonth()+1)).slice(-2);
var date = ("0" + dateobj.getDate()).slice(-2);
var hours = ("0" + dateobj.getHours()).slice(-2);
var minutes = ("0" + dateobj.getMinutes()).slice(-2);
var seconds = ("0" + dateobj.getSeconds()).slice(-2);
var day = dateobj.getDay();
var months = ["1","2","3","4","5","6","7","8","9","10","11","12"];
var converted_date = "";
switch(format){
case "YYYY-MM-DD":
converted_date = year + "-" + month + "-" + date;
break;
case "YYYY-MMM-DD DDD":
converted_date = year + "-" + months[parseInt(month)-1] + "-" + date + " " + hours + ":" + minutes + ":" + seconds;
break;
}
//return converted_date;
// to show it I used innerHTMl in a <p> tag
document.getElementById("dateTimeClock").innerHTML = converted_date;
}
function tS(){
x=new Date(tN().getUTCFullYear(),tN().getUTCMonth(),tN().getUTCDate(),
tN().getUTCHours(),tN().getUTCMinutes(),tN().getUTCSeconds());
x.setTime(x.getTime()+dS()); return x;}
function tN(){
return new Date(); }
function dS(){
return ((tN().getTime()>fD(0,2,4,-1).getTime())&&(tN().getTime()<fD(0,9,5,-1).getTime()))?3600000:0; }
function fD(d,m,h,p){
var week=(p<0)?7*(p+1):7*(p-1),nm=(p<0)?m+1:m,x=new Date(tN().getUTCFullYear(),nm,1,h,0,0),
dOff=0; if(p<0){ x.setTime(x.getTime()-86400000);}
if(x.getDay()!=d){ dOff=(x.getDay()<d)?(d-x.getDay()):0-(x.getDay()-d);
if(p<0&&dOff>0){ week-=7; } if(p>0&&dOff<0){ week+=7;}
x.setTime(x.getTime()+((dOff+week)*86400000));
}
return x;}
function lZ(x){
return (x>9)?x:'0'+x;}
function dT(){
if(fr==0){ fr=1; document.write('<span id=\"tP\">'+eval(oT)+'</span>'); }
document.getElementById('tP').innerHTML=eval(oT); setTimeout('dT()',1000); }
function dE(x){
if(x==1||x==21||x==31){ return 'st'; }
if(x==2||x==22){ return 'nd'; }
if(x==3||x==23){ return 'rd'; }
return 'th'; }
function dTd(){
if(frd==0){ frd=1; document.write('<span id=\"tPd\">'+eval(oTd)+'</span>'); }
document.getElementById('tPd').innerHTML=eval(oTd); setTimeout('dTd()',1000); }
function y4(x){ return (x<500)?x+1900:x; }
var fr=0
var frd=0
var oT=\"lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())\"
var dN=new Array('Sun','Mon','Tues','Wednes','Thurs','Fri','Satur')
var mN=new Array('January','February','March','April','May','June','July','August','September','October','November','December')
var oTd=\"dN[tS().getDay()]+'day, '+tS().getDate()+dE(tS().getDate())+' '+mN[tS().getMonth()]+' '+y4(tS().getYear())\"
import numpy as np
import csv
import os
headerInfoFile = 'C:/Users/Andreas/PycharmProjects/lapio/headers/pulrov_header.csv'
headerInfolist = []
def readHeaderfile(headerDir):
for csvFilename in os.listdir(headerDir):
if not csvFilename.endswith('_header.csv'):
continue
csvRows = []
with open(headerDir+csvFilename, 'r', encoding='UTF-8') as csvFileObj:
readerObj = csv.reader(csvFileObj)
for row in readerObj:
if readerObj.line_num == 1:
continue
csvRows.append(row)
return csvRows
def csv_writer(data, path):
with open(path, "w", newline='') as csv_file:
writer = csv.writer(csv_file, delimiter=',')
for line in data:
writer.writerow(line)
return csv_file
def main(headerFile, outputHeaderDir):
# read threshold values from header.csv
headerData = readHeaderfile(headerFile)
# write headerdata to output.csv file
writeCsvData = csv_writer(headerData, outputHeaderDir)
if __name__ == "__main__":
headerDir = 'C:/Users/Andreas/PycharmProjects/lapio/headers/'
outputHeaderDir = 'C:/Users/Andreas/PycharmProjects/lapio/headers/output.csv'
main(headerDir, outputHeaderDir)
import csv
import datetime
import os
import subprocess
import time
def getTimestamp():
time = datetime.datetime.now()
dtString = time.strftime('%Y/%m/%d %H:%M:%S')
return dtString
def writer(datalist, headerlist, path):
# open file and write stuff in it, "a" = append, "r" = read, "ab" = append binary, "w" = write
with open(path, "a", newline='', encoding='UTF-8') as csv_file:
writer = csv.writer(csv_file)
for line in datalist:
if os.stat(path).st_size == 0:
for row in headerlist:
row = row.splitlines()
writer.writerow(row)
else:
writer.writerow([line])
def getHeaderInfo():
headerData = [
'HEADERLIST',
'SITENAME:\t\t\t' 'Rovaniemi',
'MEASURMENT:\t\t\t' 'Pulsation',
'COORDINATES:\t\t' 'N66.75 E25.96',
'TIMEZONE:\t\t\t' 'UTC +02:00'
]
date = getTimestamp().split()[0]
headerData.append('DATE:\t\t\t\t' + date)
return headerData
def getTempOut():
pass
def getTempIn():
pass
def getTempCpu():
pass
def getDiskStatus():
# does not work on windows (obviously), need something else for Ionosonde
ds = []
cmd = subprocess.getoutput('df -h | grep /dev/sda5 \'{ print $1 }\' | cut -d\'/\' -f3')
ds = ds.append(cmd)
return ds
def getVoltageUps():
pass
def getVoltageMeas():
pass
def getFlowday():
pass #TODO figure this one out
def getFlowdayLast():
pass #TODO this one aswell
def main():
# random loop for log testing
loop = 0
while loop == 0:
''' This is a measurement PC software, that runs locally on every measurement station
Get all housekeeping data, same data used for status monitoring
getStatusRemote gets this apps outputfile and does all the reading and data comparing
'''
now = datetime.datetime.now()
datestring = now.strftime('%Y%m%d')
# Makes a new file every midnight with current days string in filename, change pc time to test!!!!
file = 'C:/Users/Andreas/PycharmProjects/lapio/headers/PUL_ROV_' + datestring + '_META.csv'
time.sleep(1)
datalist = []
readHeader = getHeaderInfo()
timestamp = getTimestamp()
tempOut = getTempOut()
tempIn = getTempIn()
tempCpu = getTempCpu()
diskStatus = getDiskStatus()
voltageUps = getVoltageUps()
voltageMeas = getVoltageMeas()
flowday = getFlowday()
flowdayLast = getFlowdayLast()
# append everything to the list
#TODO format the list, for neater output
datalist.append([timestamp, tempOut,tempIn,tempCpu,diskStatus,voltageUps,voltageMeas, flowday, flowdayLast])
writeFile = writer(datalist,readHeader, file)
if __name__ == "__main__":
main()
Date & Time(UT) Station Network (0=OK) Total disk size Spaceleft(G) Space left(%)
04.07.2017 05:47:32 Rovaniemi 0 23G 16G 27%
XX.XX.XXXX XX:XX:XX Oulu N N N N
04.07.2017 05:47:35 Jyvaskyla 0 41G 32G 17%
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8" http-equiv="refresh" content="05"/>
<title>SGO</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
<script type="text/javascript" src="{{ url_for('static', filename='js/clock.js') }}"></script>
</head>
<body>
<h1 id="header">Main page</h1>
<h1 id="time">{{ time }}</h1>
</body>
<h2 class="section">All Stations ( page set to auto-refresh every 5seconds!)</h2>
<div id ="measurmentList">
<table>
<!-- for i in statusinfo %} -->
<tr>
<!-- if measurment[i]['net'] > 0 or measurment[i][diskpace] < threshold[disk] %} -->
<th><a class="blackButton" href="{{ url_for('mag')}}"> Magnetometers</a></th>
<!-- elif something something %}-->
<th><a class="greenButton" href="{{ url_for('rio')}}">Riometers</a></th>
<!-- elif something something %}-->
<th><a class="yellowButton" href="{{ url_for('pul')}}">Pulsation</a></th>
<!-- else something %} -->
<th><a class="orangeButton" href="{{ url_for('vlf')}}">VLF</a>
<!-- endif %}
</tr>
<!-- { endfor %} -->
<tr>
<td colspan=4>
<div id="dateTimeClock">Loading</div>
</td>
</tr>
<tr>
<th><a class="redButton" href="{{ url_for('tomo')}}">Tomography</a></th>
<th><a class="greenButton" href="{{ url_for('seismo')}}">Seismometers</a></th>
<th><a class="greenButton" href="{{ url_for('radar')}}">R&R Receivers</a></th>
</tr>
</table>
</div>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MAGNETOMETERS</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
</head>
<body>
<h1>MAGNETIC MEASURMENTS</h1>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8" http-equiv="refresh" content="05"/>
<title>PULSATION</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
<script type="text/javascript" src="{{ url_for('static', filename='js/clock.js') }}"></script>
</head>
<body>
<h1 id="header">PULSATION STATUSPAGE</h1>
<h1 id="time">{{ time }}</h1>
<h1>Date&Time</h1>
<div id="dateTimeClock">Loading</div>
</body>
<h2 class="section">Pulsation ( page set to auto-refresh every 5seconds!</h2>
<table>
<tr class="tableheader">
<td>Date&Time</td>
<td>Name</td>
<td>Network</td>
<td>Disk space (Gt)</td>
<td>Disk left (Gt)</td>
<td>Disk usage (%)</td>
</tr>
{% for p in pulkeys %}
<tr>
<td>{{ pul[p]['logtime']}}</td>
<td>{{ pul[p]['name']}}</td>
<td>{{ pul[p]['network'] }}</td>
<td>{{ pul[p]['diskspace'] }}</td>
<td>{{ pul[p]['spaceleft'] }}</td>
<td>{{ pul[p]['freespace'] }}</td>
</tr>
{% endfor %}
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>RADAR AND RADIO RECEIVER</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
</head>
<body>
<h1>RADAR AND RADIO RECEIVER STATUSPAGE</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>RIOMETERS</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
</head>
<body>
<h1>RIOMETER STATUSPAGE</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>SEISMOMETERS</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
</head>
<body>
<h1>SEISMOMETER STATUSPAGE</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TOMOGRAPHY</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
</head>
<body>
<h1>TOMOGRAPHY STATUSPAGE</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>VLF INSTRUMENTS</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
</head>
<body>
<h1>VLF INSTRUMENT STATUSPAGE</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment