dashboard.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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" style="table-layout: fixed;">
  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" style="table-layout: fixed;">
  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. <div class="panel">
  266. <div class="panel-body">
  267. <h3 class="title-hero">
  268. 计算节点 TOP <span style="font-size: 17px;">10</span>
  269. </h3>
  270. <div class="row">
  271. <div class="col-md-4">
  272. <div class="content-box">
  273. <h3 class="content-box-header btn-info">
  274. CPU
  275. </h3>
  276. <div class="content-box-wrapper" style="padding-top: 0;">
  277. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  278. <thead>
  279. <tr>
  280. <td style="width: 65%;">实例</td>
  281. <td style="width: 35%;">负载</td>
  282. </tr>
  283. </thead>
  284. <tbody>
  285. {% for item in hosts_current_top_10_ret.data.cpu_load %}
  286. {% if item.node_id not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  287. <tr>
  288. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  289. <a href="/host/detail/{{ item.node_id }}">
  290. {{ hosts_mapping_by_node_id[item.node_id].hostname }}
  291. </a>
  292. </td>
  293. <td>
  294. <div class="progressbar-small progressbar" data-value="{{ item.cpu_load }}">
  295. <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 }}%">
  296. </div>
  297. </div>
  298. </td>
  299. </tr>
  300. {% endfor %}
  301. </tbody>
  302. </table>
  303. </div>
  304. </div>
  305. </div>
  306. <div class="col-md-4">
  307. <div class="content-box">
  308. <h3 class="content-box-header" style="background-color: #8e8e8e; color: #fff;">
  309. 磁盘 IOPS
  310. </h3>
  311. <div class="content-box-wrapper" style="padding-top: 0;">
  312. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  313. <thead>
  314. <tr>
  315. <td style="width: 65%;">实例</td>
  316. <td style="width: 35%;">IOPS</td>
  317. </tr>
  318. </thead>
  319. <tbody>
  320. {% for item in hosts_current_top_10_ret.data.rw_req %}
  321. {% if item.node_id not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  322. <tr>
  323. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  324. <a href="/host/detail/{{ item.node_id }}">
  325. {{ hosts_mapping_by_node_id[item.node_id].hostname }}({{ item.mountpoint }})
  326. </a>
  327. </td>
  328. <td>
  329. {{ item.rw_req }}
  330. </td>
  331. </tr>
  332. {% endfor %}
  333. </tbody>
  334. </table>
  335. </div>
  336. </div>
  337. </div>
  338. <div class="col-md-4">
  339. <div class="content-box">
  340. <h3 class="content-box-header" style="background-color: #8e8e8e; color: #fff;">
  341. 磁盘吞吐量
  342. </h3>
  343. <div class="content-box-wrapper" style="padding-top: 0;">
  344. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  345. <thead>
  346. <tr>
  347. <td style="width: 65%;">实例</td>
  348. <td style="width: 35%;">吞吐量</td>
  349. </tr>
  350. </thead>
  351. <tbody>
  352. {% for item in hosts_current_top_10_ret.data.rw_bytes %}
  353. {% if item.node_id not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  354. <tr>
  355. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  356. <a href="/host/detail/{{ item.node_id }}">
  357. {{ hosts_mapping_by_node_id[item.node_id].hostname }}({{ item.mountpoint }})
  358. </a>
  359. </td>
  360. <td>
  361. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  362. {% if item.rw_bytes >= 1024**3 %}
  363. {{ '%0.1f'| format(item.rw_bytes / 1024**3) }} GBps
  364. {% elif item.rw_bytes >= 1024**2 %}
  365. {{ '%0.1f'| format(item.rw_bytes / 1024**2) }} MBps
  366. {% elif item.rw_bytes >= 1024 %}
  367. {{ '%0.1f'| format(item.rw_bytes / 1024) }} KBps
  368. {% else %}
  369. {{ item.rw_bytes }} Bps
  370. {% endif %}
  371. </td>
  372. </tr>
  373. {% endfor %}
  374. </tbody>
  375. </table>
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380. <div class="row">
  381. <div class="col-md-4">
  382. <div class="content-box">
  383. <h3 class="content-box-header bg-green">
  384. 网络流量
  385. </h3>
  386. <div class="content-box-wrapper" style="padding-top: 0;">
  387. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  388. <thead>
  389. <tr>
  390. <td style="width: 65%;">实例</td>
  391. <td style="width: 35%;">流量</td>
  392. </tr>
  393. </thead>
  394. <tbody>
  395. {% for item in hosts_current_top_10_ret.data.rt_bytes %}
  396. {% if item.node_id not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  397. <tr>
  398. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  399. <a href="/host/detail/{{ item.node_id }}">
  400. {{ hosts_mapping_by_node_id[item.node_id].hostname }}({{ item.name }})
  401. </a>
  402. </td>
  403. <td>
  404. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  405. {% if item.rt_bytes * 8 >= 1000**3 %}
  406. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**3) }} Gbps
  407. {% elif item.rt_bytes * 8 >= 1000**2 %}
  408. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**2) }} Mbps
  409. {% elif item.rt_bytes * 8 >= 1000 %}
  410. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000) }} kbps
  411. {% else %}
  412. {{ item.rt_bytes * 8 }} bps
  413. {% endif %}
  414. </td>
  415. </tr>
  416. {% endfor %}
  417. </tbody>
  418. </table>
  419. </div>
  420. </div>
  421. </div>
  422. <div class="col-md-4">
  423. <div class="content-box">
  424. <h3 class="content-box-header btn-warning">
  425. 内存使用率
  426. </h3>
  427. <div class="content-box-wrapper" style="padding-top: 0;">
  428. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  429. <thead>
  430. <tr>
  431. <td style="width: 65%;">实例</td>
  432. <td style="width: 35%;">使用率</td>
  433. </tr>
  434. </thead>
  435. <tbody>
  436. {% for item in hosts_current_top_10_ret.data.memory_rate %}
  437. {% if item.node_id not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  438. <tr>
  439. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  440. <a href="/host/detail/{{ item.node_id }}">
  441. {{ hosts_mapping_by_node_id[item.node_id].hostname }}
  442. </a>
  443. </td>
  444. <td>
  445. {{ item.memory_rate }}%
  446. </td>
  447. </tr>
  448. {% endfor %}
  449. </tbody>
  450. </table>
  451. </div>
  452. </div>
  453. </div>
  454. <div class="col-md-4">
  455. </div>
  456. </div>
  457. </div>
  458. </div>
  459. {% endblock content %}