index-cls.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. 
  2. <!DOCTYPE html>
  3. <meta name="apple-mobile-web-app-capable" content="yes" />
  4. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6"/>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8">
  8. <script type='text/javascript' charset='utf-8'>
  9. // Hides mobile browser's address bar when page is done loading.
  10. window.addEventListener('load', function(e) {
  11. setTimeout(function() { window.scrollTo(0, 1); }, 1);
  12. }, false);
  13. </script>
  14. <title>ArOZ Onlineβ</title>
  15. <link rel="stylesheet" href="../../../script/tocas/tocas.css">
  16. <script src="../../../script/tocas/tocas.js"></script>
  17. <script src="../../../script/jquery.min.js"></script>
  18. </head>
  19. <body style="background-color: rgb(247, 247, 247);">
  20. <div class="ts container">
  21. <br>
  22. <div class="ts segment">
  23. <div class="ts header">
  24. Cluster Storage Manager
  25. <div class="sub header">
  26. Harddisk SMART
  27. </div>
  28. </div>
  29. </div>
  30. <div class="ts divider"></div>
  31. <div class="ts segment">
  32. <div class="ts items">
  33. <div class="item">
  34. <i id="MessageIcon" class="large inverted info rounded checkmark icon"></i>
  35. <div class="content">
  36. <div class="header" id="MessageHeader">Operating normal.</div>
  37. <div class="extra" id="MessageContent">
  38. System working.
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="ts fluid statistics">
  44. <div class="statistic">
  45. <div class="value" id="Cluster">0</div>
  46. <div class="label">Cluster online</div>
  47. </div>
  48. <div class="statistic">
  49. <div class="value" id="Installed">0</div>
  50. <div class="label">Disk installed</div>
  51. </div>
  52. <div class="statistic">
  53. <div class="value" id="Healthy">0</div>
  54. <div class="label">Disk healthy</div>
  55. </div>
  56. <div class="statistic">
  57. <div class="value" id="capacity">0 Byte</div>
  58. <div class="label">Total</div>
  59. </div>
  60. </div>
  61. <div class="ts divider"></div>
  62. <table class="ts very basic table">
  63. <thead>
  64. <tr>
  65. <th>IPs</th>
  66. <th>Model</th>
  67. <th>Mounted</th>
  68. <th>Capactiy</th>
  69. <th>SMART</th>
  70. </tr>
  71. </thead>
  72. <tbody id="SMARTtableBody">
  73. </tbody>
  74. </table>
  75. </div>
  76. <br>
  77. </div>
  78. <Script>
  79. var capacity = 0;
  80. var healthy = 0;
  81. var totalDisk = 0;
  82. var cluster = 0;
  83. var template = "<tr><td>%ip%</td><td>%model%</td><td>%mount%</td><td>%capacity%</td><td>%smart%</td></tr>";
  84. $.get( "../cluster/clusterList.config", function( raw ) {
  85. cluster = raw.split("\n").length - 1;
  86. $.each( raw.split("\n"), function( key, IP ) {
  87. $.get( "http://" + IP + "/AOB/SystemAOB/functions/drive/opr.php?opr=scan", function( raw ) {
  88. var Maindata = JSON.parse(raw);
  89. $.each( Maindata["devices"], function( key, value ) {
  90. $.get( "http://" + IP + "/AOB/SystemAOB/functions/drive/opr.php?opr=info&drive=" + value["name"], function( raw ) {
  91. var DiskData = JSON.parse(raw);
  92. var tmp = template;
  93. var smart = "OK";
  94. if(typeof DiskData["ata_smart_attributes"] === 'undefined'){
  95. smart = "Unknown";
  96. healthy = healthy - 1;
  97. }else{
  98. $.each( DiskData["ata_smart_attributes"]["table"], function( key, value ) {
  99. if(value["when_failed"] !== ""){
  100. smart = "Failed";
  101. healthy = healthy - 1;
  102. $("#MessageIcon").attr("class","large inverted negative rounded remove icon");
  103. $("#MessageHeader").text("Warning");
  104. $("#MessageContent").text("One or more disk on cluster have SMART warning.");
  105. }
  106. });
  107. }
  108. tmp = tmp.replace("%ip%",IP);
  109. tmp = tmp.replace("%mount%",DiskData["device"]["info_name"]);
  110. tmp = tmp.replace("%model%",DiskData["model_name"]);
  111. tmp = tmp.replace("%capacity%",disksize(DiskData["user_capacity"]["bytes"]));
  112. tmp = tmp.replace("%smart%",smart);
  113. capacity = capacity + DiskData["user_capacity"]["bytes"];
  114. totalDisk = totalDisk + 1;
  115. healthy = healthy + 1;
  116. $("#Cluster").text(cluster);
  117. $("#Installed").text(totalDisk);
  118. $("#Healthy").text(healthy);
  119. $("#capacity").text(disksize(capacity));
  120. $("#SMARTtableBody").append(tmp);
  121. });
  122. });
  123. });
  124. });
  125. });
  126. function disksize(size){
  127. if(size >= 1000000000000000){
  128. return Math.floor(size/1000000000000000*10)/10 + " PB";
  129. }else if(size >= 1000000000000){
  130. return Math.floor(size/1000000000000*10)/10 + " TB";
  131. }else if(size >= 1000000000){
  132. return Math.floor(size/1000000000*10)/10 + " GB";
  133. }else if(size >= 1000000){
  134. return Math.floor(size/1000000*10)/10 + " MB";
  135. }else if(size >= 1024){
  136. return Math.floor(size/1000*10)/10 + " KB";
  137. }else{
  138. return size + " Bytes";
  139. }
  140. }
  141. console.warn("%cSTOP!\n%cPlease beware not to copy and paste anything from the internet to this console as this might bring damage to your system.",'color: red;font-size: 76px','color: red');
  142. console.info(`%c ! ____ _____ ___ ____
  143. ! ! / ___|_ _/ _ \\| _ \\
  144. ! ! ! \\___ \\ | || | | | |_) |
  145. ! ! ! ___) || || |_| | __/
  146. ! ! ! |____/ |_| \\___/|_|
  147. ! ! !
  148. ! !
  149. ! ! !
  150. !!!!!!!!!!!!!!!!!!! `,'color: red;');
  151. </script>
  152. </body>
  153. </html>