dashboard.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. {% extends theme("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. $(document).ready(function() {
  13. $('body').addClass('add-transition');
  14. $('.add-page-transition').on('click', function(){
  15. var transAttr = $(this).attr('data-transition');
  16. $('.add-transition').attr('class', 'add-transition');
  17. $('.add-transition').addClass(transAttr);
  18. });
  19. });
  20. </script>
  21. <div class="panel">
  22. <div class="panel-body">
  23. <h3 class="title-hero">
  24. 资源概览
  25. </h3>
  26. <div class="example-box-wrapper">
  27. <div class="row">
  28. <div class="col-md-2">
  29. <a href="/hosts" title="计算节点 CPU 总计" class="tile-box tile-box-shortcut btn-info">
  30. <div class="tile-content-wrapper">
  31. <i class="webhh icon-cpu-processor"></i>
  32. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  33. {{ hosts_sum.cpu }} 核
  34. </div>
  35. <div class="tile-header" style="opacity: .70;">
  36. 计算节点 CPU 总计
  37. </div>
  38. </div>
  39. </a>
  40. </div>
  41. <div class="col-md-2">
  42. <a href="/hosts" title="计算节点内存总计" class="tile-box tile-box-shortcut btn-warning">
  43. <div class="tile-content-wrapper">
  44. <i class="webhh icon-ram"></i>
  45. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  46. {{ (hosts_sum.memory / 1024 / 1024 / 1024)|int }} GB
  47. </div>
  48. <div class="tile-header" style="opacity: .70;">
  49. 计算节点内存总计
  50. </div>
  51. </div>
  52. </a>
  53. </div>
  54. <div class="col-md-2">
  55. <a href="/guests" title="虚拟机 CPU 总计" class="tile-box tile-box-shortcut btn-blue-alt">
  56. <div class="tile-content-wrapper">
  57. <i class="webhh icon-stampalt"></i>
  58. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  59. {{ guests_distribute_count_ret.data.cpu }} 核
  60. </div>
  61. <div class="tile-header" style="opacity: .70;">
  62. 虚拟机 CPU 总计
  63. </div>
  64. </div>
  65. </a>
  66. </div>
  67. <div class="col-md-3">
  68. <a href="/guests" title="虚拟机内存总计" class="tile-box tile-box-shortcut btn-purple">
  69. <div class="tile-content-wrapper">
  70. <i class="webhh icon-ruler"></i>
  71. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  72. {{ guests_distribute_count_ret.data.memory }} GB
  73. </div>
  74. <div class="tile-header" style="opacity: .70;">
  75. 虚拟机内存总计
  76. </div>
  77. </div>
  78. </a>
  79. </div>
  80. <div class="col-md-3">
  81. <a href="/disks" title="虚拟机磁盘空间总计" class="tile-box tile-box-shortcut btn-black-opacity">
  82. <div class="tile-content-wrapper">
  83. <i class="webhh icon-diskspace"></i>
  84. <div style="font-size: 20px; margin-top: 18px; right: 10px; position: absolute;">
  85. {{ disks_distribute_count_ret.data.total_size }} GB
  86. </div>
  87. <div class="tile-header" style="opacity: .70;">
  88. 虚拟机磁盘空间总计
  89. </div>
  90. </div>
  91. </a>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="panel">
  98. <div class="panel-body">
  99. <h3 class="title-hero">
  100. 虚拟机 TOP <span style="font-size: 17px;">10</span>
  101. </h3>
  102. <div class="row">
  103. <div class="col-md-4">
  104. <div class="content-box">
  105. <h3 class="content-box-header btn-blue-alt">
  106. CPU
  107. </h3>
  108. <div class="content-box-wrapper" style="padding-top: 0;">
  109. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  110. <thead>
  111. <tr>
  112. <td style="width: 65%;">实例</td>
  113. <td style="width: 35%;">负载</td>
  114. </tr>
  115. </thead>
  116. <tbody>
  117. {% for item in guests_current_top_10_ret.data.cpu_load %}
  118. {% if item.guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  119. <tr>
  120. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  121. <a href="/guest/detail/{{ item.guest_uuid }}">
  122. {{ guests_mapping_by_uuid[item.guest_uuid].label }}/{{ guests_mapping_by_uuid[item.guest_uuid].remark }}
  123. </a>
  124. </td>
  125. <td>
  126. <div class="progressbar-small progressbar" data-value="{{ item.cpu_load }}">
  127. <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 }}%">
  128. </div>
  129. </div>
  130. </td>
  131. </tr>
  132. {% endfor %}
  133. </tbody>
  134. </table>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="col-md-4">
  139. <div class="content-box">
  140. <h3 class="content-box-header" style="background-color: #9e9e9e; opacity: 0.9; color: #fff;">
  141. 磁盘 IOPS
  142. </h3>
  143. <div class="content-box-wrapper" style="padding-top: 0;">
  144. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  145. <thead>
  146. <tr>
  147. <td style="width: 65%;">实例</td>
  148. <td style="width: 35%;">IOPS</td>
  149. </tr>
  150. </thead>
  151. <tbody>
  152. {% for item in guests_current_top_10_ret.data.rw_req %}
  153. {% if item.disk_uuid not in disks_mapping_by_uuid %}{% continue %}{% endif %}
  154. {% if disks_mapping_by_uuid[item.disk_uuid].guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  155. <tr>
  156. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  157. <a href="/disk/detail/{{ item.disk_uuid }}">
  158. {{ guests_mapping_by_uuid[disks_mapping_by_uuid[item.disk_uuid].guest_uuid].label }}/{{ disks_mapping_by_uuid[item.disk_uuid].remark }}
  159. </a>
  160. </td>
  161. <td>
  162. {{ item.rw_req }}
  163. </td>
  164. </tr>
  165. {% endfor %}
  166. </tbody>
  167. </table>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="col-md-4">
  172. <div class="content-box">
  173. <h3 class="content-box-header btn-warning" style="background-color: #9e9e9e; opacity: 0.9; color: #fff;">
  174. 磁盘吞吐量
  175. </h3>
  176. <div class="content-box-wrapper" style="padding-top: 0;">
  177. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  178. <thead>
  179. <tr>
  180. <td style="width: 65%;">实例</td>
  181. <td style="width: 35%;">吞吐量</td>
  182. </tr>
  183. </thead>
  184. <tbody>
  185. {% for item in guests_current_top_10_ret.data.rw_bytes %}
  186. {% if item.disk_uuid not in disks_mapping_by_uuid %}{% continue %}{% endif %}
  187. {% if disks_mapping_by_uuid[item.disk_uuid].guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  188. <tr>
  189. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  190. <a href="/disk/detail/{{ item.disk_uuid }}">
  191. {{ guests_mapping_by_uuid[disks_mapping_by_uuid[item.disk_uuid].guest_uuid].label }}/{{ disks_mapping_by_uuid[item.disk_uuid].remark }}
  192. </a>
  193. </td>
  194. <td>
  195. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  196. {% if item.rw_bytes >= 1024**3 %}
  197. {{ '%0.1f'| format(item.rw_bytes / 1024**3) }} GBps
  198. {% elif item.rw_bytes >= 1024**2 %}
  199. {{ '%0.1f'| format(item.rw_bytes / 1024**2) }} MBps
  200. {% elif item.rw_bytes >= 1024 %}
  201. {{ '%0.1f'| format(item.rw_bytes / 1024) }} KBps
  202. {% else %}
  203. {{ item.rw_bytes }} Bps
  204. {% endif %}
  205. </td>
  206. </tr>
  207. {% endfor %}
  208. </tbody>
  209. </table>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. <div class="row">
  215. <div class="col-md-4">
  216. <div class="content-box">
  217. <h3 class="content-box-header btn-success" style="opacity: 0.72;">
  218. 网络流量
  219. </h3>
  220. <div class="content-box-wrapper" style="padding-top: 0;">
  221. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  222. <thead>
  223. <tr>
  224. <td style="width: 65%;">实例</td>
  225. <td style="width: 35%;">流量</td>
  226. </tr>
  227. </thead>
  228. <tbody>
  229. {% for item in guests_current_top_10_ret.data.rt_bytes %}
  230. {% if item.guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  231. <tr>
  232. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  233. <a href="/guest/detail/{{ item.guest_uuid }}">
  234. {{ guests_mapping_by_uuid[item.guest_uuid].label }}/{{ guests_mapping_by_uuid[item.guest_uuid].remark }}
  235. </a>
  236. </td>
  237. <td>
  238. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  239. {% if item.rt_bytes * 8 >= 1000**3 %}
  240. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**3) }} Gbps
  241. {% elif item.rt_bytes * 8 >= 1000**2 %}
  242. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**2) }} Mbps
  243. {% elif item.rt_bytes * 8 >= 1000 %}
  244. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000) }} kbps
  245. {% else %}
  246. {{ item.rt_bytes * 8 }} bps
  247. {% endif %}
  248. </td>
  249. </tr>
  250. {% endfor %}
  251. </tbody>
  252. </table>
  253. </div>
  254. </div>
  255. </div>
  256. <div class="col-md-4">
  257. <div class="content-box">
  258. <h3 class="content-box-header btn-warning" style="opacity: 0.72;">
  259. 内存使用率
  260. </h3>
  261. <div class="content-box-wrapper" style="padding-top: 0;">
  262. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  263. <thead>
  264. <tr>
  265. <td style="width: 65%;">实例</td>
  266. <td style="width: 35%;">使用率</td>
  267. </tr>
  268. </thead>
  269. <tbody>
  270. {% for item in guests_current_top_10_ret.data.memory_rate %}
  271. {% if item.guest_uuid not in guests_mapping_by_uuid %}{% continue %}{% endif %}
  272. <tr>
  273. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  274. <a href="/guest/detail/{{ item.guest_uuid }}">
  275. {{ guests_mapping_by_uuid[item.guest_uuid].label }}/{{ guests_mapping_by_uuid[item.guest_uuid].remark }}
  276. </a>
  277. </td>
  278. <td>
  279. {{ item.memory_rate }}%
  280. </td>
  281. </tr>
  282. {% endfor %}
  283. </tbody>
  284. </table>
  285. </div>
  286. </div>
  287. </div>
  288. <div class="col-md-4">
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. <div class="panel">
  294. <div class="panel-body">
  295. <h3 class="title-hero">
  296. 计算节点 TOP <span style="font-size: 17px;">10</span>
  297. </h3>
  298. <div class="row">
  299. <div class="col-md-4">
  300. <div class="content-box">
  301. <h3 class="content-box-header btn-info">
  302. CPU
  303. </h3>
  304. <div class="content-box-wrapper" style="padding-top: 0;">
  305. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  306. <thead>
  307. <tr>
  308. <td style="width: 65%;">实例</td>
  309. <td style="width: 35%;">负载</td>
  310. </tr>
  311. </thead>
  312. <tbody>
  313. {% for item in hosts_current_top_10_ret.data.cpu_load %}
  314. {% if item.node_id | string not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  315. <tr>
  316. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  317. <a href="/host/detail/{{ item.node_id }}">
  318. {{ hosts_mapping_by_node_id[item.node_id | string].hostname }}
  319. </a>
  320. </td>
  321. <td>
  322. <div class="progressbar-small progressbar" data-value="{{ item.cpu_load }}">
  323. <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 }}%">
  324. </div>
  325. </div>
  326. </td>
  327. </tr>
  328. {% endfor %}
  329. </tbody>
  330. </table>
  331. </div>
  332. </div>
  333. </div>
  334. <div class="col-md-4">
  335. <div class="content-box">
  336. <h3 class="content-box-header" style="background-color: #8e8e8e; color: #fff;">
  337. 磁盘 IOPS
  338. </h3>
  339. <div class="content-box-wrapper" style="padding-top: 0;">
  340. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  341. <thead>
  342. <tr>
  343. <td style="width: 65%;">实例</td>
  344. <td style="width: 35%;">IOPS</td>
  345. </tr>
  346. </thead>
  347. <tbody>
  348. {% for item in hosts_current_top_10_ret.data.rw_req %}
  349. {% if item.node_id | string not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  350. <tr>
  351. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  352. <a href="/host/detail/{{ item.node_id }}">
  353. {{ hosts_mapping_by_node_id[item.node_id | string].hostname }}({{ item.mountpoint }})
  354. </a>
  355. </td>
  356. <td>
  357. {{ item.rw_req }}
  358. </td>
  359. </tr>
  360. {% endfor %}
  361. </tbody>
  362. </table>
  363. </div>
  364. </div>
  365. </div>
  366. <div class="col-md-4">
  367. <div class="content-box">
  368. <h3 class="content-box-header" style="background-color: #8e8e8e; color: #fff;">
  369. 磁盘吞吐量
  370. </h3>
  371. <div class="content-box-wrapper" style="padding-top: 0;">
  372. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  373. <thead>
  374. <tr>
  375. <td style="width: 65%;">实例</td>
  376. <td style="width: 35%;">吞吐量</td>
  377. </tr>
  378. </thead>
  379. <tbody>
  380. {% for item in hosts_current_top_10_ret.data.rw_bytes %}
  381. {% if item.node_id | string not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  382. <tr>
  383. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  384. <a href="/host/detail/{{ item.node_id }}">
  385. {{ hosts_mapping_by_node_id[item.node_id | string].hostname }}({{ item.mountpoint }})
  386. </a>
  387. </td>
  388. <td>
  389. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  390. {% if item.rw_bytes >= 1024**3 %}
  391. {{ '%0.1f'| format(item.rw_bytes / 1024**3) }} GBps
  392. {% elif item.rw_bytes >= 1024**2 %}
  393. {{ '%0.1f'| format(item.rw_bytes / 1024**2) }} MBps
  394. {% elif item.rw_bytes >= 1024 %}
  395. {{ '%0.1f'| format(item.rw_bytes / 1024) }} KBps
  396. {% else %}
  397. {{ item.rw_bytes }} Bps
  398. {% endif %}
  399. </td>
  400. </tr>
  401. {% endfor %}
  402. </tbody>
  403. </table>
  404. </div>
  405. </div>
  406. </div>
  407. </div>
  408. <div class="row">
  409. <div class="col-md-4">
  410. <div class="content-box">
  411. <h3 class="content-box-header btn-success">
  412. 网络流量
  413. </h3>
  414. <div class="content-box-wrapper" style="padding-top: 0;">
  415. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  416. <thead>
  417. <tr>
  418. <td style="width: 65%;">实例</td>
  419. <td style="width: 35%;">流量</td>
  420. </tr>
  421. </thead>
  422. <tbody>
  423. {% for item in hosts_current_top_10_ret.data.rt_bytes %}
  424. {% if item.node_id | string not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  425. <tr>
  426. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  427. <a href="/host/detail/{{ item.node_id }}">
  428. {{ hosts_mapping_by_node_id[item.node_id | string].hostname }}({{ item.name }})
  429. </a>
  430. </td>
  431. <td>
  432. <!-- 速率参考链接:https://en.wikipedia.org/wiki/Data_rate_units#Examples_of_bit_rates -->
  433. {% if item.rt_bytes * 8 >= 1000**3 %}
  434. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**3) }} Gbps
  435. {% elif item.rt_bytes * 8 >= 1000**2 %}
  436. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000**2) }} Mbps
  437. {% elif item.rt_bytes * 8 >= 1000 %}
  438. {{ '%0.1f'| format(item.rt_bytes * 8 / 1000) }} kbps
  439. {% else %}
  440. {{ item.rt_bytes * 8 }} bps
  441. {% endif %}
  442. </td>
  443. </tr>
  444. {% endfor %}
  445. </tbody>
  446. </table>
  447. </div>
  448. </div>
  449. </div>
  450. <div class="col-md-4">
  451. <div class="content-box">
  452. <h3 class="content-box-header btn-warning">
  453. 内存使用率
  454. </h3>
  455. <div class="content-box-wrapper" style="padding-top: 0;">
  456. <table class="table mrg0B mrg10T" style="table-layout: fixed;">
  457. <thead>
  458. <tr>
  459. <td style="width: 65%;">实例</td>
  460. <td style="width: 35%;">使用率</td>
  461. </tr>
  462. </thead>
  463. <tbody>
  464. {% for item in hosts_current_top_10_ret.data.memory_rate %}
  465. {% if item.node_id | string not in hosts_mapping_by_node_id %}{% continue %}{% endif %}
  466. <tr>
  467. <td class="text-left" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">
  468. <a href="/host/detail/{{ item.node_id }}">
  469. {{ hosts_mapping_by_node_id[item.node_id | string].hostname }}
  470. </a>
  471. </td>
  472. <td>
  473. {{ item.memory_rate }}%
  474. </td>
  475. </tr>
  476. {% endfor %}
  477. </tbody>
  478. </table>
  479. </div>
  480. </div>
  481. </div>
  482. <div class="col-md-4">
  483. </div>
  484. </div>
  485. </div>
  486. </div>
  487. {% endblock content %}