예제 #1
0
     break;
 case 'fetch':
 default:
     if ($variable == '') {
         $cli->output("Error: you are using the ezmuninperflogger_ script as munin plugin. You should create symlinks named ezmuninperflogger_\$varname instead");
         $script->shutdown(-1);
     }
     if ($variable != 'pageviews' && !in_array($variable, $ini->variable('GeneralSettings', 'TrackVariables'))) {
         $cli->output("Error: '{$variable}' is not a tracked perf. variable");
         $script->shutdown(-1);
     }
     $logMethods = $ini->variable('GeneralSettings', 'LogMethods');
     if (in_array('csv', $logMethods)) {
         eZPerfLoggerMemStorage::resetStats();
         $ok = eZPerfLoggerLogManager::updateStatsFromLogFile($ini->variable('csvSettings', 'FileName'), 'eZPerfLoggerCSVStorage', 'eZPerfLoggerMemStorage', "muninplugin-{$variable}-csv.log", array('/^URL$/'));
         if ($samples = eZPerfLoggerMemStorage::getStatsCount()) {
             if ($variable != 'pageviews') {
                 $values = eZPerfLoggerMemStorage::getStats($variable);
                 //$values['avg'] = $values['total'] / $samples;
                 echo "{$variable}_tot.value {$values['total']}\n";
                 echo "{$variable}_min.value {$values['min']}\n";
                 echo "{$variable}_max.value {$values['max']}\n";
                 echo "pageviews.value {$samples}\n";
             } else {
                 echo "pageviews_count.value {$samples}\n";
             }
         } else {
             if ($variable != 'pageviews') {
                 // Either no logfile or no samples in range
                 // Slight difference between reporting 0 and U (unknown == null):
                 // . U means no point in the graph