dashboard.html 28 KB

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