Beispiel #1
0
    $logdate = $logdate2 = 0;
    if (file_exists($logfile)) {
        $logdate = filemtime($logfile);
    }
    if (file_exists($logfile2)) {
        $logdate2 = filemtime($logfile2);
    }
    $cachedate = $clusterfile->mtime();
    if ($cachedate >= $logdate && $cachedate >= $logdate2) {
        $cachefound = true;
        $clusterfile->fetch();
    }
}
if (!$cachefound) {
    $scale = 60;
    $scalenames = array(60 => 'minute', 60 * 60 => 'hour', 60 * 60 * 24 => 'day');
    // *** Parse storage.log files ***
    $data = ezLogsGrapher::asum(ezLogsGrapher::parseLog($logfile, $scale), ezLogsGrapher::parseLog($logfile2, $scale));
    ksort($data);
    // *** build graph and store it ***
    $graphname = sysInfoTools::ezpI18ntr('SysInfo', 'files per ' . $scalenames[$scale]);
    $graph = ezLogsGrapher::graph($data, $graphname, $scale);
    if ($graph != false) {
        $clusterfile->fileStoreContents($cachefile, $graph);
    } else {
        $errormsg = ezLogsGrapher::lastError();
    }
}
// *** output ***
$tpl->setVariable('graphsource', $cachefile);
$tpl->setVariable('errormsg', $errormsg);
Beispiel #2
0
        eZDebug::writeWarning("Sysinfo view uses an unsupported response type: {$response_type}");
}
// fetch template to render results
$Result = array();
$Result['content'] = $tpl->fetch("design:sysinfo/{$view}.tpl");
// for requests which 'come from cluster', remove pagelayout, as they will be shown inside an iframe
if ($isClusterSlaveRequest) {
    /// @todo rewrite links
    // remove pagelayout
    $Result['pagelayout'] = 'design:clusterview_pagelayout.tpl';
    // shall we remove debug info as well?
} else {
    // build nav menu & left-hand menu
    $Result['left_menu'] = 'design:parts/sysinfo/menu.tpl';
    $url1stlevel = array(array('url' => 'sysinfo/index', 'text' => sysInfoTools::ezpI18ntr('SysInfo', 'System information')));
    if ($view == 'index') {
        $url1stlevel[0]['url'] = false;
        $url2ndlevel = array();
    } else {
        $url2ndlevel = array(array('url' => false, 'text' => sysInfoTools::ezpI18ntr('SysInfo', ezSysinfoModule::viewName($view))));
    }
    if ($extra_path != '') {
        if (ezSysinfoModule::viewActive($view)) {
            $url2ndlevel[0]['url'] = "sysinfo/{$view}";
        }
        $url3rdlevel = array(array('url' => false, 'text' => $extra_path));
    } else {
        $url3rdlevel = array();
    }
    $Result['path'] = array_merge($url1stlevel, $url2ndlevel, $url3rdlevel);
}
Beispiel #3
0
                  }*/
                /*$last = end( array_keys( $data ) );
                  $data[$last + $scale] = 0;*/
                $graphname = sysInfoTools::ezpI18ntr('SysInfo', 'messages per ' . $scalenames[$scale]);
                $graph = ezLogsGrapher::graph($data, $graphname, $scale);
                if ($graph != false) {
                    $clusterfile->fileStoreContents($cachefile, $graph);
                    $cachefiles[$logname] = $cachefile;
                } else {
                    $errormsg = ezLogsGrapher::lastError();
                }
            } else {
                eZDebug::writedebug("No valid date labels in log {$logfile}", __METHOD__);
            }
        }
    }
}
if ($Params['viewmode'] == 'json') {
    $response_type = $Params['viewmode'];
    $response_data = $cachefiles;
    return;
}
// *** output ***
$tpl->setVariable('graphsources', $cachefiles);
$tpl->setVariable('errormsg', $errormsg);
$Result = array();
$Result['content'] = $tpl->fetch("design:sysinfo/logchurn.tpl");
//var_dump($cacheFilesList);
$Result['left_menu'] = 'design:parts/sysinfo/menu.tpl';
$Result['path'] = array(array('url' => false, 'text' => sysInfoTools::ezpI18ntr('SysInfo', 'Log churn')));