BrightTree
Chia Dashboard
0) { if($row['creating'] == 1) { $pstatus = $row['pstatus']; } } ?>
IP:
Status:
Version:
Plotcount:
Plotting:
Plotsize:
 
DriveFreeCount
- ยข -
3239:1832.9:4.67:1853.75 2:137:165:43:hdd-24
3239:1832.9:4.67:1853.75 split on
Left is current job info, Right is statistics on all jobs in logs Job info [0] - Phase [1] - Current count of plot process [2] - Max plots to plot from plotting script [3] - Percent complete of current plot Statistics [0] - Total number of plots (in log files) lost some logs so not every plot accounted for [1] - Average seconds for plot job [2] - Estimated TiB plotted each day [3] - Total seconds to make last plot */ if(strlen($pstatus) > 0) { $pr = explode(":",str_replace("
",":",$pstatus)); $runval = (count($pr) >=9 && is_numeric($pr[8])) ? $pr[8] : 0; $lastrun = (count($pr) >=9) ? number_format($runval/60 ,1) : ""; $currentjob = $pr[1]; $totaljob = $pr[2]; $currentphase = $pr[0]; $currentpercent = $pr[3]; $currentdrive = $pr[4]; $k32plots = $pr[5]; $averageminutes = number_format($pr[6] / 60,1); $TiBperday = $pr[7]; $summary = "Plotting..."; $summary .= "
"; $summary .= "" . $currentdrive . ""; $summary .= "" . $currentjob . " / " . $totaljob . "
"; $summary .= "Phase " . $currentphase . " - " . $currentpercent . " %
"; $summary .= $k32plots . " K32 Plots, "; $summary .= $averageminutes . " minutes
"; $summary .= $TiBperday . " TiB/day, "; $summary .= $lastrun . " last run"; $summary .= "
"; $summary .= ""; } return $summary; } function build_sidebar() { $pool_rank = get_pool_rank(); $pool_plotcount = get_pool_plotcount(); $my_plotcount = get_my_plotcount(); $pool_plotsize = get_pool_plotsize(); $pool_unpaid = get_pool_unpaid(); $pool_paid = get_pool_paid(); $chia_netspace = get_chia_netspace(); $pool_netspace = get_pool_netspace(); $my_netspace = get_my_netspace($pool_plotsize); $pool_ttw = get_pool_ttw(); $my_ttw = get_my_ttw(); $chia_qty = get_chia_qty(); $chia_price = get_chia_price(); $chia_balance = get_chia_balance($chia_qty, $chia_price); $hddcoin_qty = get_hddcoin_qty(); $hddcoin_price = get_hddcoin_price(); $hddcoin_balance = get_hddcoin_balance($hddcoin_qty, $hddcoin_price); $todaysbest_price = get_todaysbest_price(); $todaysbest_url = get_todaysbest_url(); ?> 0) { $df_name = $df[0]; // rename a couple drives that have long names switch($df_name) { case "BLACKGATE": $df_name = "black"; break; case "BLUEGATE": $df_name = "blue"; break; case "ssd-tb" : $df_name = "ssdtb"; break; case "ssd-ta" : $df_name = "ssdta"; break; } /* DRIVES sample hdd-a__141G|hdd-c__242G|hdd-b__140G|hdd-e__242G|hdd-g__243G|hdd-j__445G|hdd-i__343G|hdd-h__243G|hdd-f__242G|hdd-d__242G|hdd-k__343G|ext-01_____255G|BLACKGATE__280G| PLOTREPORT sample hdd-a:89|hdd-b:124|hdd-c:123|hdd-d:123|hdd-e:123|hdd-f:123|hdd-g:123|hdd-h:123|hdd-i:162|hdd-j:161|hdd-k:162|BLACKGATE:34|ext-01:71~hdd-a:75|hdd-b:40|hdd-c:40|hdd-d:40|hdd-e:40|hdd-f:40|hdd-g:40|hdd-h:40|hdd-i:0|hdd-j:0|hdd-k:0|BLACKGATE:0|ext-01:0 */ $percent = 0; if(is_numeric($df[1])) { $ss = size_from_serverdrives($df[0],$serverdrives); // pass the drive name and array of drives to the function to get the amount of space free $ss = ($ss == 0) ? 1 : $ss; // since the size has a "G" in it for Gigabytes, strip that out. // If current plot count plus the size / 100 is not greater than 0, the we dont calc the percent, we just accept the default value of zero. if(($df[1] + intval(str_replace("G","",$ss)/100)) > 0) { // calcuate the percent the drive is full // value of (count / ( count + value of( freespace / 100) * 100) // current / ( total possible) * 100 // Example 18 TB drive: 136 current plots. 3000G freespace. // (136 / (136 + 3000/100) * 100) which comes out to 81.92 % $percent = intval($df[1] / ($df[1] + intval(str_replace("G","",$ss)/100)) * 100); } } $progress_color = ($currentplotdrive == $df[0]) ? "progressyellow" : "progressblue"; $percent = ($progress_color == "progressyellow" && $percent < 5) ? 5 : $percent; //determine freespace is less than 100GB, if this is the case then we are full with plots and should use a red progress bar. $progress_color = ($percent > 99) ? "progressred" : $progress_color; $col .= ""; $col .= "
" . $df_name . "
"; $col .= "" . size_from_serverdrives($df[0],$serverdrives) . ""; $col .= "" . $df[1] . ""; $col .= ""; } } $col .= build_plotsummary($pstatus); return $col; } function size_from_serverdrives($drive,$serverdrives) { /* $drive hdd-a $serverdrives hdd-a__242G|hdd-c__242G|hdd-b__242G|hdd-e__242G|hdd-g__243G|hdd-j__445G|hdd-i__343G|hdd-h__242G|hdd-f__242G|hdd-d__242G|hdd-k__343G|ext-01_____255G|BLACKGATE__280G| */ $result = ""; $serverdrives = str_replace("______",":",$serverdrives); $serverdrives = str_replace("_____",":",$serverdrives); $serverdrives = str_replace("____",":",$serverdrives); $serverdrives = str_replace("___",":",$serverdrives); $serverdrives = str_replace("__",":",$serverdrives); $serverdrives = str_replace("_",":",$serverdrives); $sd = explode('|',$serverdrives); foreach($sd as $d) { $f = explode(':',$d); if($f[0] == $drive) { $result = $f[1]; if(strpos($result,"T")) { $temp = substr($result,0,strlen($result)-1); $result = $temp * 1000 . "G"; } break; // found drive so break out of foreach loop } } return $result; } function get_pool_rank() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='pool-rank';"; $pool_rank = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $pool_rank; } function get_pool_plotcount() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='pool-plotcount';"; $pool_plotcount = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $pool_plotcount; } function get_my_plotcount() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='my-plotcount';"; $my_plotcount = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $my_plotcount; } function get_pool_plotsize() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='pool-plotsize';"; $pool_plotsize = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return number_format($pool_plotsize,2); } function get_pool_unpaid() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='pool-unpaid';"; $pool_unpaid = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $pool_unpaid; } function get_pool_paid() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='pool-paid';"; $pool_paid = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $pool_paid; } function get_my_netspace() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $my_net = number_format(mysqli_query($link,"select value from dictionary where name='my-netspace';")->fetch_object()->value,2); mysqli_close($link); return number_format($my_net,2); } function get_pool_netspace() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $spacepool_net = number_format(mysqli_query($link,"select value from dictionary where name='spacepool-netspace';")->fetch_object()->value,2); mysqli_close($link); return $spacepool_net; } function get_chia_netspace() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $chia_net = number_format(mysqli_query($link,"select value from dictionary where name='chia-netspace';")->fetch_object()->value,2); mysqli_close($link); return $chia_net; } function get_pool_ttw() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $spacepool_ttw = mysqli_query($link,"select value from dictionary where name='spacepool-time-to-win';")->fetch_object()->value; mysqli_close($link); return number_format($spacepool_ttw,0) . "s (" . number_format($spacepool_ttw/60,) . "m)"; } function get_my_ttw() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $chia_ttw = mysqli_query($link,"select value from dictionary where name='chia-ttw';")->fetch_object()->value; mysqli_close($link); return str_replace("_"," ",$chia_ttw); } function get_chia_qty() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='wallet';"; $chia_qty = number_format(mysqli_query($link,$sql)->fetch_object()->value,2); mysqli_close($link); return $chia_qty; } function get_chia_price() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='price';"; $chia_price = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $chia_price; } function get_chia_balance($chia_qty, $chia_price) { return number_format($chia_qty * $chia_price,2);; } function get_hddcoin_qty() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='hddcoin-wallet';"; $hddcoin_qty = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $hddcoin_qty; } function get_hddcoin_price() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='hddcoin-price';"; $hddcoin_price = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $hddcoin_price; } function get_hddcoin_balance($hddcoin_qty, $hddcoin_price) { return number_format($hddcoin_qty * $hddcoin_price,2);; } function get_todaysbest_price() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='diskprice';"; $diskprice = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); $dpf = explode(",",$diskprice); $todaysbest_price = str_replace("@","$",$dpf[14]); return $todaysbest_price; } function get_todaysbest_url() { // disappointingly the scrape of their website didn't give the URL to the actual Amazon listing // for the drive, so I'm just linking to the diskprices.com site and it should be the top listing. $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='diskprice';"; $diskprice = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); $dpf = explode(",",$diskprice); $todaysbest_url = "" . $dpf[7] . "/TB " . $dpf[37] . " " . substr(str_replace("_"," ", get_todaysbest_price()),0,25) . ""; return $todaysbest_url; } function get_server_plotreport($servername) { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select plotreport from servers where name='$servername';"; $plotreport = mysqli_query($link,$sql)->fetch_object()->plotreport; mysqli_close($link); return $plotreport; } function get_server_drives($servername) { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select drives from servers where name='$servername';"; $drives = mysqli_query($link,$sql)->fetch_object()->drives; mysqli_close($link); return $drives; } function get_server_currentplotdrive($servername) { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select currentplotdrive from servers where name='$servername';"; $currentplotdrive = mysqli_query($link,$sql)->fetch_object()->currentplotdrive; mysqli_close($link); return $currentplotdrive; } function get_farmsummary() { $link = mysqli_connect(HOST, USER, PASSWORD, DB); $sql = "select value from dictionary where name='farm-summary';"; $farmsummary = mysqli_query($link,$sql)->fetch_object()->value; mysqli_close($link); return $farmsummary; }