-
Notifications
You must be signed in to change notification settings - Fork 0
/
server
executable file
·78 lines (67 loc) · 1.51 KB
/
server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/ruby
require 'rubygems'
require 'sinatra'
get '/' do
'
<h2>Status of Mechanism in Real Time (SMART)</h2></p>
<a href="status">Watch the Status</a> ( Refesh Automatically per 6 seconds )</p>
<a href="log">Check the log</a> ( Refesh Automatically per minute )</p>
<a href="criteria">Criteria of Checkpoints</a></p>
<a href="readme">README</a></p>
'
end
get '/criteria' do
content='<a href="/">Back</a></p>'
f = File.open("SMART.criteria")
f.each { |line|
content+=line
content+='</p>'
}
f.close
content
end
get '/readme' do
content='<a href="/">Back</a></p>'
f = File.open("README")
f.each { |line|
content+=line
content+='</p>'
}
f.close
content
end
get '/log' do
content='<a href="/">Back</a></p><meta http-equiv="refresh" content="60">'
f = File.open("SMART.log")
f.each { |line|
content+=line
content+='</p>'
}
f.close
content
end
get '/status' do
content='<a href="/">Back</a></p><meta http-equiv="refresh" content="6">'
f = File.open("SMART.status")
f.each { |line|
content+=line
content+='</p>'
}
f.close
content
end
get '/3' do
File.read("images/gdu-smart-failing.png")
end
get '/2' do
File.read("images/gdu-smart-threshold.png")
end
get '/1' do
File.read("images/gdu-smart-healthy.png")
end
get '/0' do
File.read("images/gdu-smart-unknown.png")
end
get '/alert' do
File.read("sounds/alarm-clock-elapsed.mp3")
end