-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_container.html
118 lines (118 loc) · 4.15 KB
/
main_container.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
<div class="page-header">
<h2>Load Report Viewer - {{ all_hosts|length }} systems are being monitored.</h2>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 text-right">
<p class="top_spacing">Will update <span id="pre-remaining"> in about </span> <span id="remaining">20</span> <span id="post-remaining"> s</span></p>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-lg-4 col-md-12 col-sm-4 col-xs-4">
<span class="label label-danger">About to catch fire!</span>
</div>
<div class="col-lg-4 col-md-12 col-sm-4 col-xs-4">
<span class="label label-warning">Maybe take a look.</span>
</div>
<div class="col-lg-4 col-md-12 col-sm-4 col-xs-4">
<span class="label label-success">Boooring!</span>
</div>
</div>
</div>
</div>
</div>
</div>
{% for host in all_hosts %}
{% if loop.index0 % 2 == 0 %}
<div class="row">
{% endif %}
{% if host.load|float > (2 * host.processor_count|float) %}
{% set host_state = 'danger' %}
{% elif host.load|float > (1 * host.processor_count|float) %}
{% set host_state = 'warning' %}
{% else %}
{% set host_state = 'success' %}
{% endif %}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="panel panel-{{ host_state }}">
<div class="panel-heading">
<strong> {{ host.hostname }} ({{ host.processor_count }} cores) </strong>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<strong>Load Average:</strong>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9">
<span class=" text-{{ host_state }} ">{{ '%0.2f' % host.load|float }}</span>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<strong>Ping:</strong>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9">
<span class=" text-{{ host_state }} ">{{ host.ping }} {{ host.pingunit }}</span>
</div>
</div>
<div class="row top_spacing">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<strong>Partitions usage status:</strong>
</div>
</div>
{% for partition in host.disk_usage %}
{% if partition[1]|float >= 95 %}
{% set partition_status = 'danger' %}
{% elif partition[1]|float >= 90 %}
{% set partition_status = 'warning' %}
{% else %}
{% set partition_status = 'success' %}
{% endif %}
<div class="row">
<div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
{{ partition[0][1:-1] }}
</div>
<div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
<div class="progress">
<div class="progress-bar progress-bar-{{ partition_status }}" style="width: {{partition[1]}}%">{{ partition[1] }}%</div>
</div>
</div>
</div><!-- row of a partition-->
{% endfor %}
</div>
<table class="table table-hover table-responsive table-condensed">
{% for row in host.process_table %}
{% set table_element_tag = "td" %}
{% if loop.index0 == 0 %}
{% set table_element_tag = "th" %}
<thead>
{% elif loop.index0 == 1 %}
<tbody>
{% endif %}
{% if (row[8]|float >= (50 * host.processor_count|float)) or (row[9]|float >= 50) %}
{% set row_style = 'danger' %}
{% elif (row[8]|float >= (25 * host.processor_count|float)) or (row[9]|float >= 25) %}
{% set row_style = 'warning' %}
{% else %}
{% set row_style = ' ' %}
{% endif %}
<tr class = "{{ row_style }}">
{% for col in row %}
{% if (loop.index0 != 2) and (loop.index0 != 4) and (loop.index0 != 5) and (loop.index0 != 6) and (loop.index0 != 7) %}
<{{ table_element_tag}}> {{ col }} </{{ table_element_tag }}>
{% endif %}
{% endfor %}
</tr>
{% if loop.index == 1 %}
</thead>
{% endif %}
{% endfor %}
</tbody>
</table>
</div> <!-- panel -->
</div> <!-- col -->
{% if loop.index0 % 2 == 1 %}
</div> <!-- row -->
{% endif %}
{% endfor %}