dashboard.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. {% extends "layout.html" %}
  2. {% block head %}
  3. {{ super() }}
  4. <style type="text/css">
  5. [class^="content-box"] {
  6. border-radius: 0 !important;
  7. }
  8. </style>
  9. {% endblock head %}
  10. {% block content %}
  11. <script type="text/javascript">
  12. var resource_path = window.location.pathname;
  13. var cur_url = resource_path;
  14. $(document).ready(function() {
  15. $('body').addClass('add-transition');
  16. $('.add-page-transition').on('click', function(){
  17. var transAttr = $(this).attr('data-transition');
  18. $('.add-transition').attr('class', 'add-transition');
  19. $('.add-transition').addClass(transAttr);
  20. });
  21. });
  22. </script>
  23. <div class="panel">
  24. <div class="panel-body">
  25. <h3 class="title-hero">
  26. 资源概览
  27. </h3>
  28. <div class="example-box-wrapper">
  29. <div class="row">
  30. <div class="col-md-2">
  31. <a href="/hosts" title="宿主机 CPU 总计" class="tile-box tile-box-shortcut btn-info">
  32. <div class="tile-content-wrapper">
  33. <i class="webhh icon-cpu-processor"></i>
  34. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  35. {{ hosts_sum.cpu }} 核
  36. </div>
  37. <div class="tile-header" style="opacity: .70;">
  38. 宿主机 CPU 总计
  39. </div>
  40. </div>
  41. </a>
  42. </div>
  43. <div class="col-md-2">
  44. <a href="/hosts" title="宿主机内存总计" class="tile-box tile-box-shortcut btn-warning">
  45. <div class="tile-content-wrapper">
  46. <i class="webhh icon-ram"></i>
  47. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  48. {{ (hosts_sum.memory / 1024 / 1024 / 1024)|int }} GB
  49. </div>
  50. <div class="tile-header" style="opacity: .70;">
  51. 宿主机内存总计
  52. </div>
  53. </div>
  54. </a>
  55. </div>
  56. <div class="col-md-2">
  57. <a href="/guests" title="虚拟机 CPU 总计" class="tile-box tile-box-shortcut btn-blue-alt">
  58. <div class="tile-content-wrapper">
  59. <i class="webhh icon-stampalt"></i>
  60. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  61. {{ guests_distribute_count_ret.data.cpu }} 核
  62. </div>
  63. <div class="tile-header" style="opacity: .70;">
  64. 虚拟机 CPU 总计
  65. </div>
  66. </div>
  67. </a>
  68. </div>
  69. <div class="col-md-3">
  70. <a href="/guests" title="虚拟机内存总计" class="tile-box tile-box-shortcut btn-purple">
  71. <div class="tile-content-wrapper">
  72. <i class="webhh icon-ruler"></i>
  73. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  74. {{ guests_distribute_count_ret.data.memory }} GB
  75. </div>
  76. <div class="tile-header" style="opacity: .70;">
  77. 虚拟机内存总计
  78. </div>
  79. </div>
  80. </a>
  81. </div>
  82. <div class="col-md-3">
  83. <a href="/disks" title="虚拟机磁盘空间总计" class="tile-box tile-box-shortcut btn-black-opacity">
  84. <div class="tile-content-wrapper">
  85. <i class="webhh icon-diskspace"></i>
  86. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  87. {{ disks_distribute_count_ret.data.total_size }} GB
  88. </div>
  89. <div class="tile-header" style="opacity: .70;">
  90. 虚拟机磁盘空间总计
  91. </div>
  92. </div>
  93. </a>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="panel">
  100. <div class="panel-body">
  101. <h3 class="title-hero">
  102. 虚拟机 TOP <span style="font-size: 17px;">10</span>
  103. </h3>
  104. <div class="row">
  105. <div class="col-md-4">
  106. <div class="content-box">
  107. <h3 class="content-box-header bg-blue-alt">
  108. CPU
  109. </h3>
  110. <div class="content-box-wrapper" style="padding-top: 0;">
  111. <table class="table mrg0B mrg10T">
  112. <thead>
  113. <tr>
  114. <td style="width: 65%;">实例</td>
  115. <td style="width: 35%;">负载</td>
  116. </tr>
  117. </thead>
  118. <tbody>
  119. {% for item in guests_current_top_10_ret.data.cpu_load %}
  120. {% if item.guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  121. <tr>
  122. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  123. <a href="/guest/detail/{{ item.guest_uuid }}">
  124. {{ guests_mapping_by_uuid[item.guest_uuid].label }}/{{ guests_mapping_by_uuid[item.guest_uuid].remark }}
  125. </a>
  126. </td>
  127. <td>
  128. <div class="progressbar-small progressbar" data-value="{{ item.cpu_load }}">
  129. <div class="progressbar-value tooltip-button {% if item.cpu_load >= 85 %}bg-red{% elif item.cpu_load >= 65 %}bg-orange{% else %}bg-green{% endif %}" title="{{ item.cpu_load }}%">
  130. </div>
  131. </div>
  132. </td>
  133. </tr>
  134. {% endfor %}
  135. </tbody>
  136. </table>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="col-md-4">
  141. <div class="content-box">
  142. <h3 class="content-box-header" style="background-color: #9e9e9e; opacity: 0.9; color: #fff;">
  143. 磁盘 IOPS
  144. </h3>
  145. <div class="content-box-wrapper" style="padding-top: 0;">
  146. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  147. <thead>
  148. <tr>
  149. <td style="width: 65%;">实例</td>
  150. <td style="width: 35%;">IOPS</td>
  151. </tr>
  152. </thead>
  153. <tbody>
  154. {% for item in guests_current_top_10_ret.data.rw_req %}
  155. {% if item.disk_uuid not in disks_mapping_by_uuid %}{% continue %}{% endif %}
  156. {% if disks_mapping_by_uuid[item.disk_uuid].guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  157. <tr>
  158. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  159. <a href="/disk/detail/{{ item.disk_uuid }}">
  160. {{ guests_mapping_by_uuid[disks_mapping_by_uuid[item.disk_uuid].guest_uuid].label }}/{{ disks_mapping_by_uuid[item.disk_uuid].remark }}
  161. </a>
  162. </td>
  163. <td>
  164. {{ item.rw_req }}
  165. </td>
  166. </tr>
  167. {% endfor %}
  168. </tbody>
  169. </table>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="col-md-4">
  174. <div class="content-box">
  175. <h3 class="content-box-header" style="background-color: #9e9e9e; opacity: 0.9; color: #fff;">
  176. 磁盘吞吐量
  177. </h3>
  178. <div class="content-box-wrapper" style="padding-top: 0;">
  179. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  180. <thead>
  181. <tr>
  182. <td style="width: 65%;">实例</td>
  183. <td style="width: 35%;">吞吐量</td>
  184. </tr>
  185. </thead>
  186. <tbody>
  187. {% for item in guests_current_top_10_ret.data.rw_bytes %}
  188. {% if item.disk_uuid not in disks_mapping_by_uuid %}{% continue %}{% endif %}
  189. {% if disks_mapping_by_uuid[item.disk_uuid].guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  190. <tr>
  191. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  192. <a href="/disk/detail/{{ item.disk_uuid }}">
  193. {{ guests_mapping_by_uuid[disks_mapping_by_uuid[item.disk_uuid].guest_uuid].label }}/{{ disks_mapping_by_uuid[item.disk_uuid].remark }}
  194. </a>
  195. </td>
  196. <td>
  197. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  198. {% if item.rw_bytes >= 1024**3 %}
  199. {{ '%0.1f'| format(item.rw_bytes / 1024**3) }} GBps
  200. {% elif item.rw_bytes >= 1024**2 %}
  201. {{ '%0.1f'| format(item.rw_bytes / 1024**2) }} MBps
  202. {% elif item.rw_bytes >= 1024 %}
  203. {{ '%0.1f'| format(item.rw_bytes / 1024) }} KBps
  204. {% else %}
  205. {{ item.rw_bytes }} Bps
  206. {% endif %}
  207. </td>
  208. </tr>
  209. {% endfor %}
  210. </tbody>
  211. </table>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="row">
  217. <div class="col-md-4">
  218. <div class="content-box">
  219. <h3 class="content-box-header bg-green" style="opacity: 0.72;">
  220. 网络流量
  221. </h3>
  222. <div class="content-box-wrapper" style="padding-top: 0;">
  223. <table class="table mrg0B mrg10T">
  224. <thead>
  225. <tr>
  226. <td style="width: 65%;">实例</td>
  227. <td style="width: 35%;">流量</td>
  228. </tr>
  229. </thead>
  230. <tbody>
  231. {% for item in guests_current_top_10_ret.data.rt_bytes %}
  232. {% if item.guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  233. <tr>
  234. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  235. <a href="/guest/detail/{{ item.guest_uuid }}">
  236. {{ guests_mapping_by_uuid[item.guest_uuid].label }}/{{ guests_mapping_by_uuid[item.guest_uuid].remark }}
  237. </a>
  238. </td>
  239. <td>
  240. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  241. {% if item.rt_bytes * 8 >= 1000**3 %}
  242. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**3) }} Gbps
  243. {% elif item.rt_bytes * 8 >= 1000**2 %}
  244. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**2) }} Mbps
  245. {% elif item.rt_bytes * 8 >= 1000 %}
  246. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000) }} kbps
  247. {% else %}
  248. {{ item.rt_bytes * 8 }} bps
  249. {% endif %}
  250. </td>
  251. </tr>
  252. {% endfor %}
  253. </tbody>
  254. </table>
  255. </div>
  256. </div>
  257. </div>
  258. <div class="col-md-4">
  259. </div>
  260. <div class="col-md-4">
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. {% endblock content %}