summaryrefslogtreecommitdiffstats
path: root/health-system-html.lsp
blob: e580d09f726f9b976c6b3b23beec0dd657a19490 (plain)
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
<% local view, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>

<%
local header_level = htmlviewfunctions.displaysectionstart(view, page_info)
local header_level2 = htmlviewfunctions.incrementheader(header_level)
%>

<% htmlviewfunctions.displaysectionstart(cfe({label="Versions and names"}), page_info, header_level2) %>
<pre><%= html.html_escape(view.value.version.value) %></pre>
<pre><%= html.html_escape(view.value.uname.value) %></pre>
<% htmlviewfunctions.displaysectionend(header_level2) %>

<% htmlviewfunctions.displaysectionstart(cfe({label="Uptime"}), page_info, header_level2) %>
<pre><%= html.html_escape(view.value.uptime.value) %></pre>
<% htmlviewfunctions.displaysectionend(header_level2) %>

<% htmlviewfunctions.displaysectionstart(cfe({label="Time/TimeZone"}), page_info, header_level2) %>
<pre><%= html.html_escape(view.value.date.value) %></pre>
<pre><%= html.html_escape(view.value.timezone.value) %></pre>
<% htmlviewfunctions.displaysectionend(header_level2) %>

<% htmlviewfunctions.displaysectionstart(cfe({label="Memory"}), page_info, header_level2) %>
<pre><%= html.html_escape(view.value.memory.value) %></pre>

<%
local function print_percent(val)
	if (tonumber(val) > 10) then
		io.write(html.html_escape(val) .. "%")
	end
end
%>

<table style="margin:0px;padding:0px;border:0px">
	<tr>
		<td>0%</td>
		<td width="<%= html.html_escape(view.value.memory.used) %>%"
		    style="background:red;border:2px solid black;border-right:none;">
			<center><b><% print_percent(view.value.memory.used) %></b></center>
		</td>
		<td width="<%= html.html_escape(view.value.memory.buffers) %>%"
		    style="background:yellow;border:2px solid black;">
			<center><b><% print_percent(view.value.memory.buffers) %></b></center>
		</td>
		<td width="<%= tonumber(view.value.memory.free) %>%"
		    style="background:#0c0;border:2px solid black;border-left:none;">
			<center><b><% print_percent(view.value.memory.free) %></b></center>
		</td>
		<td>100%</td>
	</tr>
</table>

<table style="margin:0px;padding:0px;border:0px;margin-top:5px;">
	<tr>
		<td width="100px"><b>Legend:</b></td>
		<td style="background:red;;border:2px solid black;" width="20px"></td>
		<td width="70px"><b>=Used</b></td>
		<td style="background:yellow;;border:2px solid black;" width="20px"></td>
		<td width="70px"><b>=buffers / Cached</b></td>
		<td style="background:#0c0;border:2px solid black;" width="20px"></td>
		<td><b>=Free</b></td>
	</tr>
</table>

<% htmlviewfunctions.displaysectionend(header_level2) %>

<% htmlviewfunctions.displaysectionend(header_level) %>