|
@@ -1,7 +1,7 @@
|
|
|
<?php
|
|
<?php
|
|
|
session_start();
|
|
session_start();
|
|
|
#
|
|
#
|
|
|
-global $miner, $port, $readonly;
|
|
|
|
|
|
|
+global $miner, $port, $readonly, $notify;
|
|
|
$miner = '127.0.0.1'; # hostname or IP address
|
|
$miner = '127.0.0.1'; # hostname or IP address
|
|
|
$port = 4028;
|
|
$port = 4028;
|
|
|
#
|
|
#
|
|
@@ -9,6 +9,12 @@ $port = 4028;
|
|
|
# Set $readonly to false then it will check cgminer 'privileged'
|
|
# Set $readonly to false then it will check cgminer 'privileged'
|
|
|
$readonly = false;
|
|
$readonly = false;
|
|
|
#
|
|
#
|
|
|
|
|
+# Set $notify to false to NOT attempt to display the notify command
|
|
|
|
|
+# Set $notify to true to attempt to display the notify command
|
|
|
|
|
+# If your older version of cgminer returns an 'Invalid command'
|
|
|
|
|
+# coz it doesn't have notify - it just shows the error status table
|
|
|
|
|
+$notify = true;
|
|
|
|
|
+#
|
|
|
$here = $_SERVER['PHP_SELF'];
|
|
$here = $_SERVER['PHP_SELF'];
|
|
|
#
|
|
#
|
|
|
function htmlhead()
|
|
function htmlhead()
|
|
@@ -27,6 +33,8 @@ function htmlhead()
|
|
|
<style type='text/css'>
|
|
<style type='text/css'>
|
|
|
td { color:blue; font-family:verdana,arial,sans; font-size:13pt; }
|
|
td { color:blue; font-family:verdana,arial,sans; font-size:13pt; }
|
|
|
td.h { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#d0ffff }
|
|
td.h { color:blue; font-family:verdana,arial,sans; font-size:13pt; background:#d0ffff }
|
|
|
|
|
+td.err { color:black; font-family:verdana,arial,sans; font-size:13pt; background:#ff3050 }
|
|
|
|
|
+td.warn { color:black; font-family:verdana,arial,sans; font-size:13pt; background:#ffb050 }
|
|
|
td.sta { color:green; font-family:verdana,arial,sans; font-size:13pt; }
|
|
td.sta { color:green; font-family:verdana,arial,sans; font-size:13pt; }
|
|
|
</style>
|
|
</style>
|
|
|
</head><body bgcolor=#ecffff>
|
|
</head><body bgcolor=#ecffff>
|
|
@@ -177,55 +185,87 @@ function getparam($name, $both = false)
|
|
|
#
|
|
#
|
|
|
function fmt($section, $name, $value)
|
|
function fmt($section, $name, $value)
|
|
|
{
|
|
{
|
|
|
|
|
+ $errorclass = ' class=err';
|
|
|
|
|
+ $warnclass = ' class=warn';
|
|
|
$b = ' ';
|
|
$b = ' ';
|
|
|
|
|
|
|
|
|
|
+ $ret = $value;
|
|
|
|
|
+ $class = '';
|
|
|
|
|
+
|
|
|
switch ($section.'.'.$name)
|
|
switch ($section.'.'.$name)
|
|
|
{
|
|
{
|
|
|
case 'GPU.Last Share Time':
|
|
case 'GPU.Last Share Time':
|
|
|
case 'PGA.Last Share Time':
|
|
case 'PGA.Last Share Time':
|
|
|
- return date('H:i:s', $value);
|
|
|
|
|
|
|
+ $ret = date('H:i:s', $value);
|
|
|
break;
|
|
break;
|
|
|
case 'SUMMARY.Elapsed':
|
|
case 'SUMMARY.Elapsed':
|
|
|
$s = $value % 60;
|
|
$s = $value % 60;
|
|
|
$value -= $s;
|
|
$value -= $s;
|
|
|
$value /= 60;
|
|
$value /= 60;
|
|
|
if ($value == 0)
|
|
if ($value == 0)
|
|
|
- {
|
|
|
|
|
- return $s.'s';
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $ret = $s.'s';
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
$m = $value % 60;
|
|
$m = $value % 60;
|
|
|
$value -= $m;
|
|
$value -= $m;
|
|
|
$value /= 60;
|
|
$value /= 60;
|
|
|
if ($value == 0)
|
|
if ($value == 0)
|
|
|
- {
|
|
|
|
|
- return sprintf("%dm$b%02ds", $m, $s);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $ret = sprintf("%dm$b%02ds", $m, $s);
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
$h = $value % 24;
|
|
$h = $value % 24;
|
|
|
$value -= $h;
|
|
$value -= $h;
|
|
|
$value /= 24;
|
|
$value /= 24;
|
|
|
if ($value == 0)
|
|
if ($value == 0)
|
|
|
- return sprintf("%dh$b%02dm$b%02ds", $h, $m, $s);
|
|
|
|
|
|
|
+ $ret = sprintf("%dh$b%02dm$b%02ds", $h, $m, $s);
|
|
|
else
|
|
else
|
|
|
- return sprintf("%ddays$b%02dh$b%02dm$b%02ds", $value, $h, $m, $s);
|
|
|
|
|
|
|
+ $ret = sprintf("%ddays$b%02dh$b%02dm$b%02ds", $value, $h, $m, $s);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 'NOTIFY.Last Well':
|
|
|
|
|
+ if ($value == '0')
|
|
|
|
|
+ {
|
|
|
|
|
+ $ret = 'Never';
|
|
|
|
|
+ $class = $warnclass;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ $ret = date('H:i:s', $value);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'NOTIFY.Last Not Well':
|
|
|
|
|
+ if ($value == '0')
|
|
|
|
|
+ $ret = 'Never';
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ $ret = date('H:i:s', $value);
|
|
|
|
|
+ $class = $errorclass;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'NOTIFY.Reason Not Well':
|
|
|
|
|
+ if ($value != 'None')
|
|
|
|
|
+ $class = $errorclass;
|
|
|
|
|
+ break;
|
|
|
case 'GPU.Utility':
|
|
case 'GPU.Utility':
|
|
|
case 'PGA.Utility':
|
|
case 'PGA.Utility':
|
|
|
case 'SUMMARY.Utility':
|
|
case 'SUMMARY.Utility':
|
|
|
- return $value.'/m';
|
|
|
|
|
|
|
+ $ret = $value.'/m';
|
|
|
break;
|
|
break;
|
|
|
case 'GPU.Temperature':
|
|
case 'GPU.Temperature':
|
|
|
case 'PGA.Temperature':
|
|
case 'PGA.Temperature':
|
|
|
- return $value.'°C';
|
|
|
|
|
|
|
+ $ret = $value.'°C';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return $value;
|
|
|
|
|
|
|
+ if ($section == 'NOTIFY')
|
|
|
|
|
+ {
|
|
|
|
|
+ $code = preg_split('/ /', $name);
|
|
|
|
|
+ if (count($code) > 1)
|
|
|
|
|
+ if ($code[0] == 'Thread' || $code[0] == 'Dev')
|
|
|
|
|
+ if ($value != '0')
|
|
|
|
|
+ $class = $errorclass;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return array($ret, $class);
|
|
|
}
|
|
}
|
|
|
#
|
|
#
|
|
|
global $poolcmd;
|
|
global $poolcmd;
|
|
@@ -302,7 +342,10 @@ function details($cmd, $list)
|
|
|
echo '<tr>';
|
|
echo '<tr>';
|
|
|
|
|
|
|
|
foreach ($values as $name => $value)
|
|
foreach ($values as $name => $value)
|
|
|
- echo '<td>'.fmt($section, $name, $value).'</td>';
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ list($showvalue, $class) = fmt($section, $name, $value);
|
|
|
|
|
+ echo "<td$class>$showvalue</td>";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if ($cmd == 'pools' && $readonly === false)
|
|
if ($cmd == 'pools' && $readonly === false)
|
|
|
{
|
|
{
|
|
@@ -444,7 +487,7 @@ function process($cmds, $rd, $ro)
|
|
|
#
|
|
#
|
|
|
function display()
|
|
function display()
|
|
|
{
|
|
{
|
|
|
- global $error, $readonly;
|
|
|
|
|
|
|
+ global $error, $readonly, $notify;
|
|
|
|
|
|
|
|
$error = null;
|
|
$error = null;
|
|
|
|
|
|
|
@@ -464,8 +507,12 @@ function display()
|
|
|
|
|
|
|
|
$cmds = array( 'devs' => 'device list',
|
|
$cmds = array( 'devs' => 'device list',
|
|
|
'summary' => 'summary information',
|
|
'summary' => 'summary information',
|
|
|
- 'pools' => 'pool list',
|
|
|
|
|
- 'config' => 'cgminer config');
|
|
|
|
|
|
|
+ 'pools' => 'pool list');
|
|
|
|
|
+
|
|
|
|
|
+ if ($notify)
|
|
|
|
|
+ $cmds['notify'] = 'device status';
|
|
|
|
|
+
|
|
|
|
|
+ $cmds['config'] = 'cgminer config';
|
|
|
|
|
|
|
|
process($cmds, $rd, $ro);
|
|
process($cmds, $rd, $ro);
|
|
|
|
|
|