123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
-
- <!DOCTYPE html>
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6"/>
- <html>
- <head>
- <meta charset="UTF-8">
- <script type='text/javascript' charset='utf-8'>
- // Hides mobile browser's address bar when page is done loading.
- window.addEventListener('load', function(e) {
- setTimeout(function() { window.scrollTo(0, 1); }, 1);
- }, false);
- </script>
- <title>ArOZ Onlineβ</title>
- <link rel="stylesheet" href="../../../script/tocas/tocas.css">
- <script src="../../../script/tocas/tocas.js"></script>
- <script src="../../../script/jquery.min.js"></script>
- </head>
- <body style="background-color: rgb(247, 247, 247);">
- <div class="ts container">
- <br>
- <div class="ts segment">
- <div class="ts header">
- Cluster Storage Manager
- <div class="sub header">
- Harddisk SMART
- </div>
- </div>
- </div>
- <div class="ts divider"></div>
- <div class="ts segment">
- <div class="ts items">
- <div class="item">
- <i id="MessageIcon" class="large inverted info rounded checkmark icon"></i>
- <div class="content">
- <div class="header" id="MessageHeader">Operating normal.</div>
- <div class="extra" id="MessageContent">
- System working.
- </div>
- </div>
- </div>
- </div>
-
- <div class="ts fluid statistics">
- <div class="statistic">
- <div class="value" id="Cluster">0</div>
- <div class="label">Cluster online</div>
- </div>
- <div class="statistic">
- <div class="value" id="Installed">0</div>
- <div class="label">Disk installed</div>
- </div>
- <div class="statistic">
- <div class="value" id="Healthy">0</div>
- <div class="label">Disk healthy</div>
- </div>
- <div class="statistic">
- <div class="value" id="capacity">0 Byte</div>
- <div class="label">Total</div>
- </div>
- </div>
- <div class="ts divider"></div>
- <table class="ts very basic table">
- <thead>
- <tr>
- <th>IPs</th>
- <th>Model</th>
- <th>Mounted</th>
- <th>Capactiy</th>
- <th>SMART</th>
- </tr>
- </thead>
- <tbody id="SMARTtableBody">
- </tbody>
- </table>
- </div>
- <br>
- </div>
- <Script>
- var capacity = 0;
- var healthy = 0;
- var totalDisk = 0;
- var cluster = 0;
- var template = "<tr><td>%ip%</td><td>%model%</td><td>%mount%</td><td>%capacity%</td><td>%smart%</td></tr>";
- $.get( "../cluster/clusterList.config", function( raw ) {
- cluster = raw.split("\n").length - 1;
- $.each( raw.split("\n"), function( key, IP ) {
- if(IP !== ""){
- $.get( "fetchCluster.php?ip=" + IP + "&opr=scan", function( raw ) {
- var Maindata = JSON.parse(raw);
- $.each( Maindata["devices"], function( key, value ) {
- $.get( "fetchCluster.php?ip=" + IP + "&opr=info&drive=" + value["name"], function( raw ) {
- var DiskData = JSON.parse(raw);
- var tmp = template;
- var smart = "OK";
-
- if(typeof DiskData["ata_smart_attributes"] === 'undefined'){
- smart = "Unknown";
- healthy = healthy - 1;
- }else{
- var flag = false;
- $.each( DiskData["ata_smart_attributes"]["table"], function( key, value ) {
- if(value["when_failed"] !== "" && flag == false){
- smart = "Failed";
- healthy = healthy - 1;
- flag = true;
- $("#MessageIcon").attr("class","large inverted negative rounded remove icon");
- $("#MessageHeader").text("Warning");
- $("#MessageContent").text("One or more disk on cluster have SMART warning.");
- }
- });
- }
-
-
- tmp = tmp.replace("%ip%",IP);
- tmp = tmp.replace("%mount%",DiskData["device"]["info_name"]);
- tmp = tmp.replace("%model%",DiskData["model_name"]);
- tmp = tmp.replace("%capacity%",disksize(DiskData["user_capacity"]["bytes"]));
- tmp = tmp.replace("%smart%",smart);
-
- capacity = capacity + DiskData["user_capacity"]["bytes"];
- totalDisk = totalDisk + 1;
- healthy = healthy + 1;
- $("#Cluster").text(cluster);
- $("#Installed").text(totalDisk);
- $("#Healthy").text(healthy);
- $("#capacity").text(disksize(capacity));
-
- $("#SMARTtableBody").append(tmp);
- });
-
- });
- });
- }
- });
- });
- function disksize(size){
- if(size >= 1000000000000000){
- return Math.floor(size/1000000000000000*10)/10 + " PB";
- }else if(size >= 1000000000000){
- return Math.floor(size/1000000000000*10)/10 + " TB";
- }else if(size >= 1000000000){
- return Math.floor(size/1000000000*10)/10 + " GB";
- }else if(size >= 1000000){
- return Math.floor(size/1000000*10)/10 + " MB";
- }else if(size >= 1024){
- return Math.floor(size/1000*10)/10 + " KB";
- }else{
- return size + " Bytes";
- }
- }
- 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');
- console.info(`%c ! ____ _____ ___ ____
- ! ! / ___|_ _/ _ \\| _ \\
- ! ! ! \\___ \\ | || | | | |_) |
- ! ! ! ___) || || |_| | __/
- ! ! ! |____/ |_| \\___/|_|
- ! ! !
- ! !
- ! ! !
- !!!!!!!!!!!!!!!!!!! `,'color: red;');
- </script>
- </body>
- </html>
|