protected function _postStatistics()
 {
     $cryptoglance = new CryptoGlance();
     $algorithms = $cryptoglance->supportedAlgorithms();
     // build out machine statistics
     $postData = array();
     foreach ($this->_rigs->getUpdate() as $rigId => $rig) {
         // Each device needs to be posted as a whole different machine.
         foreach ($rig['devs'] as $devId => $dev) {
             $rigData = array();
             $rigData['MachineName'] = $rig['overview']['name'];
             $rigData['MinerName'] = 'CryptoGlance';
             $rigData['CoinSymbol'] = '';
             $rigData['CoinName'] = '';
             $rigData['Algorithm'] = $algorithms[$rig['overview']['algorithm']];
             // Device Specific
             $rigData['Kind'] = $dev['type'];
             $rigData['Name'] = $dev['name'];
             $rigData['FullName'] = $dev['name'] . ' ' . $dev['id'];
             $rigData['PoolIndex'] = $rig['summary']['active_pool']['id'];
             $rigData['PoolName'] = $rig['summary']['active_pool']['url'];
             $rigData['Index'] = $devId;
             $rigData['DeviceID'] = $dev['id'];
             $rigData['Enabled'] = $dev['enabled'] == 'Y' ? 'true' : 'false';
             $rigData['Status'] = $dev['health'];
             $rigData['Temperature'] = $dev['temperature']['celsius'];
             // GPU STUFF
             $rigData['FanSpeed'] = $dev['fan_speed']['raw'];
             $rigData['FanPercent'] = $dev['fan_speed']['percent'];
             $rigData['GpuClock'] = $dev['engine_clock'];
             $rigData['MemoryClock'] = $dev['memory_clock'];
             $rigData['GpuVoltage'] = $dev['gpu_voltage'];
             $rigData['GpuActivity'] = 0;
             $rigData['PowerTune'] = $dev['powertune'];
             // END GPU STUFF
             $rigData['AverageHashrate'] = $dev['hashrate_avg'] * 1000;
             $rigData['CurrentHashrate'] = $dev['hashrate_5s'] * 1000;
             $rigData['AcceptedShares'] = $dev['accepted']['raw'];
             $rigData['RejectedShares'] = $dev['rejected']['raw'];
             $rigData['HardwareErrors'] = $dev['hw_errors']['raw'];
             $rigData['Utility'] = $dev['utility'];
             $rigData['Intensity'] = null;
             // $rigData['AcceptedSharesPercent'] = $dev['accepted']['percent'];
             $rigData['RejectedSharesPercent'] = $dev['rejected']['percent'];
             $rigData['HardwareErrorsPercent'] = $dev['hw_errors']['percent'];
             $postData[] = $rigData;
             unset($rigData);
         }
     }
     $url = $this->_url . 'MiningStatisticsInput' . $this->_urlParams;
     curlCall($url, json_encode($postData));
 }
Example #2
0
} else {
    if (!extension_loaded('curl')) {
        die('The curl extension is not loaded.');
    } else {
        if (ini_set('session.use_only_cookies', 1) === FALSE) {
            die('Error: We require that sessions only use cookies. Consult your PHP config to resolve this issue.');
        }
    }
}
require_once 'config.php';
// App Setup
set_time_limit(120);
// Allow up to 2 minutes for all APIs to return information
ini_set("display_errors", 1);
error_reporting(E_ERROR);
//error_reporting(E_ALL);
date_default_timezone_set("GMT");
session_name('cryptoGlance');
// feel free to rename this!
// Gets cookies params
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams['lifetime'], $cookieParams['path'], $cookieParams['domain'], false, true);
session_start();
define('DATA_PATH', getcwd() . DIRECTORY_SEPARATOR . DATA_FOLDER . DIRECTORY_SEPARATOR);
require_once 'cryptoglance.php';
$cryptoGlance = new CryptoGlance();
$settings = $cryptoGlance->getSettings();
// Current Build:
define('CURRENT_VERSION', 'v2.1');
// Misc function used throughout cryptoglance
require_once 'functions.php';