コード例 #1
0
ファイル: pss.php プロジェクト: krishnakanthpps/webpagetest
/**
* Load the location information
* 
*/
function LoadLocations()
{
    $locations = LoadLocationsIni();
    FilterLocations($locations, 'pss');
    // strip out any sensitive information
    foreach ($locations as $index => &$loc) {
        if (isset($loc['browser'])) {
            $testCount = 16;
            if (array_key_exists('relayServer', $loc)) {
                $loc['backlog'] = 0;
                $loc['avgTime'] = 30;
                $loc['testers'] = 1;
                $loc['wait'] = ceil($testCount * 30 / 60);
            } else {
                GetPendingTests($index, $count, $avgTime);
                if (!$avgTime) {
                    $avgTime = 30;
                }
                // default to 30 seconds if we don't have any history
                $loc['backlog'] = $count;
                $loc['avgTime'] = $avgTime;
                $loc['testers'] = GetTesterCount($index);
                $loc['wait'] = -1;
                if ($loc['testers']) {
                    if ($loc['testers'] > 1) {
                        $testCount = 16;
                    }
                    $loc['wait'] = ceil(($testCount + $count / $loc['testers']) * $avgTime / 60);
                }
            }
        }
        unset($loc['localDir']);
        unset($loc['key']);
        unset($loc['remoteDir']);
        unset($loc['relayKey']);
    }
    return $locations;
}
コード例 #2
0
ファイル: pss_mobile.php プロジェクト: risyasin/webpagetest
/**
* Load the location information
* 
*/
function LoadLocations()
{
    $locations = parse_ini_file('./settings/locations.ini', true);
    // only include the mobile browsers
    foreach ($locations as $index => &$loc) {
        if (array_key_exists('browser', $loc)) {
            if (!array_key_exists('type', $loc) || stripos($loc['type'], 'nodejs') === false && stripos($loc['type'], 'mobile') == false) {
                unset($locations[$index]);
            }
        }
    }
    FilterLocations($locations, 'pss');
    // strip out any sensitive information
    foreach ($locations as $index => &$loc) {
        if (isset($loc['browser'])) {
            $testCount = 26;
            if (array_key_exists('relayServer', $loc)) {
                $loc['backlog'] = 0;
                $loc['avgTime'] = 30;
                $loc['testers'] = 1;
                $loc['wait'] = ceil($testCount * 30 / 60);
            } else {
                GetPendingTests($index, $count, $avgTime);
                if (!$avgTime) {
                    $avgTime = 30;
                }
                // default to 30 seconds if we don't have any history
                $loc['backlog'] = $count;
                $loc['avgTime'] = $avgTime;
                $loc['testers'] = GetTesterCount($index);
                $loc['wait'] = -1;
                if ($loc['testers']) {
                    if ($loc['testers'] > 1) {
                        $testCount = 16;
                    }
                    $loc['wait'] = ceil(($testCount + $count / $loc['testers']) * $avgTime / 60);
                }
            }
        }
        unset($loc['localDir']);
        unset($loc['key']);
        unset($loc['remoteDir']);
        unset($loc['relayKey']);
    }
    return $locations;
}
コード例 #3
0
ファイル: blink.php プロジェクト: Pankajchandan/WPT-server
/**
* Load the location information
* 
*/
function LoadLocations()
{
    $locations = parse_ini_file('./settings/locations.ini', true);
    FilterLocations($locations, 'blink', array('IE', '6', '7', '8', '9', 'dynaTrace'));
    //FilterLocations( $locations);
    // strip out any sensitive information
    foreach ($locations as $index => &$loc) {
        if (isset($loc['browser'])) {
            GetPendingTests($index, $count, $avgTime);
            if (!$avgTime) {
                $avgTime = 30;
            }
            // default to 30 seconds if we don't have any history
            $loc['backlog'] = $count;
            $loc['avgTime'] = $avgTime;
            $loc['testers'] = GetTesterCount($index);
            $loc['wait'] = -1;
            if ($loc['testers']) {
                $testCount = 20;
                if ($loc['testers'] > 1) {
                    $testCount = 10;
                }
                $loc['wait'] = ceil(($testCount + $count / $loc['testers']) * $avgTime / 60);
            }
        }
        unset($loc['localDir']);
        unset($loc['key']);
        unset($loc['remoteDir']);
    }
    return $locations;
}
コード例 #4
0
 $updated = filemtime($fileName);
 $now = time();
 $elapsed = 0;
 if ($now > $updated) {
     $elapsed = $now - $updated;
 }
 $minutes = (int) ($elapsed / 60);
 if ($minutes < 4320 && isset($locations[$loc]) && !isset($locations[$loc]['hidden'])) {
     $alert = null;
     if ($minutes > 60) {
         $alert = "has not checked for new jobs in {$minutes} minutes.";
         $collected .= "{$loc} - {$minutes} minutes";
     } elseif (isset($locations[$loc]['agents'])) {
         $configured = $locations[$loc]['agents'];
         $expected = isset($locations[$loc]['min-agents']) ? $locations[$loc]['min-agents'] : $configured;
         $testers = GetTesterCount($loc);
         if ($testers < $expected) {
             $missing = $configured - $testers;
             $alert = "has {$missing} agents offline ({$testers} connected, minimum of {$expected} of the {$configured} required).";
             $collected .= "{$loc} - {$missing} agents offline";
         }
     }
     if (isset($alert)) {
         $count++;
         // if it has been over 60 minutes, send out a notification
         // figure out who to notify
         $to = '';
         if (array_key_exists('notify', $locations[$loc]) && strlen($locations[$loc]['notify'])) {
             $to = $locations[$loc]['notify'];
             $collected .= " : notified {$to}";
         }
コード例 #5
0
ファイル: scrub-ec2.php プロジェクト: lucasRolff/webpagetest
     foreach ($volumes->body->volumeSet->item as $item) {
         if ($item->status == 'available') {
             $id = strval($item->volumeId);
             $ec2->delete_volume($id);
         }
     }
 }
 foreach ($amiData as $ami => &$regionData) {
     $location = $regionData['location'];
     echo "\n{$region} ({$location}):\n";
     // load the valid testers in this location
     $testers = array();
     $locations = explode(',', $location);
     $locCount = count($locations);
     foreach ($locations as $loc) {
         $testers[$id]['locCount'] = GetTesterCount($loc);
     }
     // if any testers have been known for more than 10 minutes and
     // they aren't showing up for all of the locations, reboot them
     $reboot = array();
     foreach ($testers as $id => $info) {
         $lifetime = 0;
         if (array_key_exists('first_contact', $info) && $info['first_contact'] < $now) {
             $lifetime = $now - $info['first_contact'];
         }
         $busy = false;
         if (array_key_exists('test', $info) && strlen($info['test'])) {
             $busy = true;
         }
         if ($info['locCount'] < $locCount && !$busy && $lifetime > 600) {
             echo "{$id} needs to be rebooted\n";