Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / pybind / mgr / dashboard / osds.html
1 {% extends "base.html" %}
2
3 {% block content %}
4
5 <script>
6         $(document).ready(function(){
7             // Pre-populated initial data at page load
8             var content_data = {{ content_data }};
9
10             var refresh = function() {
11                 $.get("{{ url_prefix }}/osd/list_data/", function(data) {
12                     content_data.osds_by_server = data;
13                     $('.inlinesparkline').sparkline();
14                     setTimeout(refresh, 5000);
15                 });
16             };
17
18             rivets.formatters.colored_up_in = function(osd){
19                 var result = "";
20                 if (osd.up) {
21                     result += "<span style='color:#00bb00;'>up</span>";
22                 } else {
23                     result += "<span style='color:#bb0000;'>down</span>";
24                 }
25
26                 result += ", ";
27
28                 if (osd.in) {
29                     result += "<span style='color:#00bb00;'>in</span>";
30                 } else {
31                     result += "<span style='color:#bb0000;'>out</span>";
32                 }
33
34                 return result;
35             };
36
37             rivets.formatters.sparkline_data = function(time_series) {
38                 result = "";
39                 for (var i = 1; i < time_series.length; ++i) {
40                     var delta_v = time_series[i][1] - time_series[i - 1][1];
41                     var delta_t = time_series[i][0] - time_series[i - 1][0];
42                     result += (delta_v / delta_t + ",");
43                 }
44                 return result;
45             };
46
47             rivets.bind($("div#content"), content_data);
48             $('.inlinesparkline').sparkline();
49             setTimeout(refresh, 5000);
50         });
51 </script>
52
53 <section class="content-header">
54     <h1>
55         OSD daemons
56     </h1>
57 </section>
58
59 <section class="content">
60     <div class="box">
61         <div class="box-body">
62
63             <table class="table table-condensed table-bordered">
64             <thead>
65             <tr>
66                 <th>Host</th>
67                 <th>ID</th>
68                 <th>Status</th>
69                 <th>PGs</th>
70                 <th>Usage</th>
71                 <th>Read bytes</th>
72                 <th>Write bytes</th>
73                 <th>Read ops</th>
74                 <th>Write ops</th>
75             </tr>
76             </thead>
77
78             <tbody rv-each-server="osds_by_server">
79                 <tr rv-each-osd="server.1">
80                     <td rv-if="osd.first" rv-rowspan="server.1 | length">{server.0}</td>
81                     <td><a rv-href="osd.url">{osd.id}</a></td>
82                     <td rv-html="osd | colored_up_in"></td>
83                     <td>{osd.stats.numpg}</td>
84                     <td>{osd.stats.stat_bytes_used | dimless_binary} / {osd.stats.stat_bytes | dimless_binary}</td>
85                     <td>{osd.stats.op_out_bytes | dimless_binary}/s <span class="inlinesparkline" rv-html="osd.stats_history.op_out_bytes | sparkline_data"></span></td>
86                     <td>{osd.stats.op_in_bytes | dimless_binary}/s <span class="inlinesparkline" rv-html="osd.stats_history.op_in_bytes | sparkline_data"></span></td>
87                     <td>{osd.stats.op_r | dimless}/s</td>
88                     <td>{osd.stats.op_w | dimless}/s</td>
89                 </tr>
90             </tbody>
91
92
93             </table>
94
95
96
97
98         </div>
99     </div>
100
101
102 </section>
103 <!-- /.content -->
104
105 {% endblock %}