summaryrefslogtreecommitdiffstats
path: root/health-system-html.lsp
blob: 99036e9a57ec4834741bcb3eb7bd32473044917c (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
<% local view = ... %>

<h1>System</h1>

<h2>Versions and names</h2>
<DL>
<pre><%= html.html_escape(view.value.version.value) %></pre>
<pre><%= html.html_escape(view.value.uname.value) %></pre>
</DL>

<h2>Uptime</h2>
<DL>
<pre><%= html.html_escape(view.value.uptime.value) %></pre>
</DL>

<h2>Time/TimeZone</h2>
<DL>
<pre><%= html.html_escape(view.value.date.value) %></pre>
<pre><%= html.html_escape(view.value.timezone.value) %></pre>
</DL>

<h2>Memory</h2>
<DL>
<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>
</DL>