-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathglancesviewtab.hbs
executable file
·288 lines (260 loc) · 11.3 KB
/
glancesviewtab.hbs
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
{{#content "head"}}
{{> head}}
{{/content}}
{{#content "nav"}}
{{> nav}}
{{/content}}
{{#content "page"}}
<!-- Javascript d'initialisation d'un datatable jquery bootstrapisé -->
<script>
//<![CDATA[
$(document).ready(function()
{
{{#if result.processlist.length}}
setDataTable({{{json result.processlist}}}, "monitor10", "/#", "/#");
{{/if}}
{{#if result.percpu.length}}
setDataTable({{{json result.percpu}}}, "monitor9", "/#", "/#");
{{/if}}
{{#if result.sensors.length}}
setDataTable({{{json result.sensors}}}, "monitor8", "/#", "/#");
{{/if}}
{{#if result.network.length}}
populateGenericDatatable('/getdatanetwork', "monitor7", "_id", 10, []);
// setDataTable({{{json result.network}}}, "monitor7", "/#", "/#");
{{/if}}
{{#if result.fs.length}}
setDataTable({{{json result.fs}}}, "monitor6", "/#", "/#");
{{/if}}
{{#if result.diskio.length}}
setDataTable({{{json result.diskio}}}, "monitor5", "/#", "/#");
{{/if}}
{{#if result.memswap.length}}
setDataTable({{{json result.memswap}}}, "monitor4", "/#", "/#");
{{/if}}
{{#if result.mem.length}}
setDataTable({{{json result.mem}}}, "monitor3", "/#", "/#");
{{/if}}
{{#if result.cpu.length}}
setDataTable({{{json result.cpu}}}, "monitor2", "/#", "/#");
{{/if}}
{{#if result.alert.length}}
setDataTable({{{json result.alert}}}, "monitor1", "/#", "/#");
{{/if}}
var cpuTotal = ({{{json result.cpu}}});
var cpu = cpuTotal[0].total;
var cpuspan = document.getElementById("cpu");
var memUsed = ({{{json result.mem}}});
var mem = memUsed[0].used.substring(0, memUsed[0].used.length -11); //recup de la partie numerique
var unityMem = memUsed[0].used.substring(memUsed[0].used.length -11, memUsed[0].used.length); // recup de l'unite Ko Mo ou Go
var memspan = document.getElementById("mem"); //recuperation du dom (document object modele = structure HTML) par son id mem
var memunit = document.getElementById("memunit");//recuperation du dom (document object modele = structure HTML) par son id memunit
memunit.innerHTML = unityMem; // ecriture de l'unite dans le span prevu
var opts = {
lines: 12, // The number of lines to draw
angle: 0, // The length of each line
lineWidth: 0.7, // The line thickness
pointer: {
length: 0.5, // The radius of the inner circle
strokeWidth: 0.02, // The rotation offset
color: '#000000' // Fill color
},
limitMax: 'false', // If true, the pointer will not go past the end of the gauge
percentColors: [[0.0, "#a9d70b" ], [0.50, "#f9c802"], [1.0, "#ff0000"]],
strokeColor: '#222222', // to see which ones work best for you
generateGradient: true
};
var target = document.getElementById('jaugescputotal'); // your canvas element
var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!
gauge.setTextField(document.getElementById("preview-textfield_cputotal"));
gauge.maxValue = 100; // set max gauge value
gauge.animationSpeed = 60; // set animation speed (32 is default value)
gauge.set(cpu); // set actual value
var opts = {
lines: 12, // The number of lines to draw
angle: 0, // The length of each line
lineWidth: 0.7, // The line thickness
pointer: {
length: 0.5, // The radius of the inner circle
strokeWidth: 0.02, // The rotation offset
color: '#000000' // Fill color
},
limitMax: 'false', // If true, the pointer will not go past the end of the gauge
percentColors: [[0.0, "#a9d70b" ], [0.50, "#f9c802"], [1.0, "#ff0000"]],
strokeColor: '#222222', // to see which ones work best for you
generateGradient: true
};
var target = document.getElementById('jaugesmemused'); // your canvas element
var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!
gauge.setTextField(document.getElementById("preview-textfield_memused"));
var memMaxTab = ({{{json result.mem}}});
var memMax = ((memMaxTab[0].total).split('.')[0]);
gauge.maxValue = memMax; // set max gauge value
gauge.animationSpeed = 60; // set animation speed (32 is default value)
gauge.set(parseInt(mem)); // set actual value
});
//]]>
</script>
<script>
//<![CDATA[
$(document).ready(function(){
$("[data-mask]").inputmask();
});
</script>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Monitoring server
</h1>
<ol class="breadcrumb">
<li><a href="/index"><i class="fa fa-home"></i> Home</a></li>
<li><a href="#">Server monitor</a></li>
<li class="active">Create</li>
</ol>
</section>
<!-- Page Content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<!-- About Me Box -->
<div class="box box-primary">
<div class="box-body">
<div class="col-xs-12 col-sm-12 col-md-2">
<h3>Server:</h3>
<h4>{{result.system.hostname}}</h4>
<h5>{{result.system.os_name}} {{result.system.hr_name}}</h5>
<h5>Kernel {{result.system.os_version}}</h5>
<h5>Uptime {{result.uptime}}</h5>
</div>
<div class="col-xs-12 col-sm-12 col-md-1">
<h3>Tasks: </h3>
<h5>Total: {{result.processcount.total}}</h5>
<h5>Running: {{result.processcount.running}}</h5>
<h5>Thread: {{result.processcount.thread}}</h5>
<h5>Sleeping: {{result.processcount.sleeping}}</h5>
</div>
<div class="col-xs-12 col-sm-12 col-md-1">
<h3>Core:</h3>
<h5>Physique: {{result.core.phys}}</h5>
<h5>Logique: {{result.core.log}}</h5>
</div>
<div class="col-xs-12 col-sm-12 col-md-1">
<h3>Load:</h3>
<h5>cpucore: {{result.load.cpucore}}</h5>
<h5>min1: {{result.load.min1}}</h5>
<h5>min5: {{result.load.min5}}</h5>
<h5>min15: {{result.load.min15}}</h5>
</div>
<div class="col-xs-12 col-sm-12 col-md-2">
<h4 class="label-gauge">CPU: <span id="preview-textfield_cputotal"></span>%</h4>
<canvas class="gauge" id="jaugescputotal"></canvas>
</div>
<div class="col-xs-12 col-sm-12 col-md-2">
<h4 class="label-gauge">RAM:<span id="preview-textfield_memused"></span><span id="memunit"></span></h4>
<canvas class="gauge" id="jaugesmemused"></canvas>
</div>
<div class="col-xs-12 col-sm-12 col-md-1 aligndroit">
<h3>Times:<h4>{{result.now}}</h4></h3>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-xs-12 col-sm-12 col-md-12">
<h3>Alert:</h3>
<div id="monitor1" class="panel panel-default"></div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12">
<h5>CPU :</h5>
<div id="monitor2" class="panel panel-default"></div>
</div><!-- /.col-lg-12 -->
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-6">
<h5>Memory :</h5>
<div id="monitor3" class="panel panel-default"></div>
</div><!-- /.col-lg-12 -->
</div>
<div class="row-fluid">
<div class="col-lg-6">
<h5>Memory swap :</h5>
<div id="monitor4" class="panel panel-default"></div>
</div><!-- /.col-lg-12 -->
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-6">
<h5>Disques durs :</h5>
<div id="monitor5" class="panel panel-default"></div>
</div><!-- /.col-lg-6 -->
<div class="col-lg-6">
<h5>Montages Disques :</h5>
<div id="monitor6" class="panel panel-default"></div>
</div><!-- /.col-lg-6 -->
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12">
<h5>Reseaux :</h5>
<div id="network" class="panel panel-default">
<table class="table table-hover" id="monitor7">
<thead>
<tr>
<th mData="interface_name">interface_name</th>
<th mData="cx">cx</th>
<th mData="cumulative_cx">cumulative_cx</th>
<th mData="cumulative_rx">cumulative_rx</th>
<th mData="tx">tx</th>
<th mData="rx">rx</th>
<th mData="time_since_update">time_since_update</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td class="dataTables_empty" colspan="10"></td>
</tr>
</tbody>
</table>
</div>
</div><!-- /.col-lg-6 -->
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-4">
<h5>Temperature :</h5>
<div id="monitor8" class="panel panel-default"></div>
</div><!-- /.col-lg-6 -->
<div class="col-lg-8">
<h5>CPUS :</h5>
<div id="monitor9" class="panel panel-default"></div>
</div><!-- /.col-lg-12 -->
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12">
<h5>Liste des processus :</h5>
<div id="monitor10" class="panel panel-default"></div>
</div><!-- /.col-lg-12 -->
</div>
</div>
</div><!-- /Page Content -->
</div><!-- /.box-body -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
{{/content}}
{{#content "footer"}}
{{> footer}}
{{/content}}