This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMachineSummary.html
80 lines (78 loc) · 2.56 KB
/
MachineSummary.html
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
79
80
## -*- coding: utf-8 -*-
<%inherit file="/module_base.html" />
<%!
import ipaddress
%>
<%def name="content()">
<script type="text/javascript">
function toggle(element, button) {
if(button.val().indexOf("Show") !== -1) {
element.show();
button.val(button.val().replace("Show", "Hide"));
} else {
element.hide();
button.val(button.val().replace("Hide", "Show"));
}
}
</script>
<input id="down-toggler" type="button" value="Hide down hosts" onfocus="this.blur()" onclick='toggle($(".down-row"), $("#down-toggler"));' />
<input id="desk-toggler" type="button" value="Hide desktop hosts" onfocus="this.blur()" onclick='toggle($(".desktop"), $("#desk-toggler"));' />
<input id="non-desk-toggler" type="button" value="Hide non-desktop hosts" onfocus="this.blur()" onclick='toggle($(".non-desktop"), $("#non-desk-toggler"));' />
<div class="Up Hosts" id="${module.instance_name}_up_hosts" >
<table class="TableData">
<tr class="TableHeader">
<th>IP</th>
<th>State</th>
<th>Hostname</th>
<th>Wiki Link</th>
<th>ssh Hostname</th>
<th>OS Version</th>
<th>VM</th>
<th>Vagrant</th>
<th>Ansible Roles</th>
<th>Last Users</th>
<th>Nagios</th>
<th>Notes</th>
</tr>
% for entry in sorted(statistics, key=lambda host: ipaddress.ip_address(host['ip'])):
<%
import string
if entry['state'] == 'Down':
class_name = 'down-row'
style_str = 'background-color: gray'
else:
class_name = 'up-row'
style_str = ''
endif
if '129.13.102' in str(entry['ip']):
class_name = class_name + ' desktop'
else:
class_name = class_name + ' non-desktop'
endif
%>
<tr class='${class_name}' style='${style_str}'>
<td>${entry['ip']}</td>
<td>${entry['state']}</td>
<td>${entry['hostname']}</td>
<td><a href="${entry['wiki_link']}">⮊</a></td>
<td>${entry['ssh_hostname']}</td>
<td>${entry['os']}</td>
% if entry['vm_guest'] == 'Yes':
<td style="color:green;">✓</td>
% else:
<td style="color:red">×</td>
% endif
<td>${entry['vm_host']}</td>
<td>${entry['ansible_roles']}</td>
<td>${entry['last_user']}</td>
% if entry['nagios_link'] != 'No Nagios found':
<td><a href="${entry['nagios_link']}" style="color:red;">(Critical: ${entry['nagios_crit']}) (Warning; ${entry['nagios_warn']})</a></td>
% else:
<td></td>
% endif
<td>${entry['notes']}</td>
</tr>
% endfor
</table>
</div>
</%def>