Esempio n. 1
0
    } else {
        print "Requires config file to run\n";
    }
    exit;
}
if (!$config['server']) {
    print "Requires server option to run\n";
    exit;
}
if (!$config['pending_dir']) {
    print "Requires pending dir option to run\n";
    exit;
}
if (isset($config['urls']) && isset($config['script'])) {
    print "Cannot have both URLs and a script, use prepend instead";
    exit;
}
$client = new WebpagetestClient($config);
$browser_locations = $client->getLocationsXML();
// Allow use to specify locations, but make sure they're locations that exist on the server
if (isset($config['locations'])) {
    $config_locations = $config['locations'];
    $browser_locations = array_filter($browser_locations, function ($location) use($config_locations) {
        return in_array($location['id'], $config_locations);
    });
}
$target = isset($config['urls']) ? count($config['urls']) . " urls" : $config['script'];
$client->log("Started test with config: {$config_file}. Testing " . $target . " across " . count($browser_locations) . " locations.");
$runs = $client->test($browser_locations);
$results_helper = new ResultsHelper($config['pending_dir']);
$results_helper->storeRuns($runs);
Esempio n. 2
0
$options = getopt($shortopts);
$config_file = isset($options['c']) ? $options['c'] : 'default.conf';
$config = json_decode(file_get_contents(__DIR__ . '/../conf/' . $config_file), true);
if (!$config) {
    print "Requires config file to run\n";
    exit(-1);
}
if (!$config['server']) {
    print "Requires server option to run";
    exit(-1);
}
if (!$config['logging_ns']) {
    print "Requires logging ns option to run";
    exit(-1);
}
if (!$config['pending_dir']) {
    print "Requires pending dir option to run\n";
    exit;
}
$results_helper = new ResultsHelper($config['pending_dir']);
$runs = $results_helper->getRuns();
$client = new WebpagetestClient($config);
$results = $client->getResults($runs);
$logging_ns = $config['logging_ns'];
$splunkLogger = new SplunkLogger($config['splunkLog'], $logging_ns);
foreach ($results as $result) {
    $splunkLogger->log($result);
}
$graphite = $config['graphite'];
$grapher = new Grapher($graphite, $logging_ns);
$grapher->graphResults($results);