Example #1
0
     $rig_notifications[$rig] = $notification_data;
     $config->set_value('rigs', $rig_notifications, $notify_cfg_key);
 }
 $notification_resend_delay = $notification_data['notification_resend_delay'];
 // Only proceed when we want to notify something and don#t want to reboot, because when we want to reboot, any notifications are not important anymore.
 if ($notify_hw || $notify_gpu_min || $notify_gpu_max || $notify_hashrate || $notify_load || $notify_reboot || $notify_cgminer_restart) {
     try {
         // Get the system config, here are the max and min values stored.
         //
         // Get the cgminer api.
         if (!isset($system_config['rigs'][$rig])) {
             continue;
         }
         $rig_cfg = $system_config['rigs'][$rig];
         $api = new PHPMinerRPC($rig_cfg['http_ip'], $rig_cfg['http_port'], $rig_cfg['rpc_key']);
         $api->test_connection();
         $active_pool = null;
         // Get all active devices.
         $devices = $api->get_devices_details();
         foreach ($devices as $k => $device) {
             // Get device data.
             $gpu_id = $device['ID'];
             $gpu_name = trim($device['Model']);
             // Only process if it was configurated within the system settings.
             if (!isset($rig_cfg['gpu_' . $gpu_id])) {
                 unset($devices[$k]);
                 continue;
             }
             // Get gpu data.
             $info = $api->get_gpu($device['ID']);
             $device['gpu_info'] = current($info);