Beispiel #1
0
function start()
{
    // /etc/artica-postfix/pids/exec.loadavg.php.start.time
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidfileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$pidfileTime}\n";
    }
    if (!$GLOBALS["VERBOSE"]) {
        if ($unix->file_time_min($pidfileTime) < 59) {
            return;
        }
    }
    $pid = @file_get_contents($pidfile);
    if ($pid < 100) {
        $pid = null;
    }
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["VERBOSE"]) {
            echo "{$pid} already executed since {$timepid}Mn\n";
        }
        if ($timepid < 15) {
            return;
        }
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    @file_put_contents($pidfile, getmypid());
    if (system_is_overloaded()) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Overloaded\n";
        }
        die;
    }
    @unlink($pidfileTime);
    @file_put_contents($pidfileTime, time());
    if ($GLOBALS["VERBOSE"]) {
        echo "cpustats\n";
    }
    cpustats();
}
    exit;
}
if (isset($_POST["LoadAvgClean"])) {
    LoadAvgClean();
    exit;
}
if (isset($_GET["apache-front-end-status"])) {
    apache_status();
    exit;
}
if (isset($_GET["squid-front-end-status"])) {
    squid_frontend_status();
    exit;
}
if (isset($_GET["cpustats"])) {
    cpustats();
    exit;
}
if (isset($_GET["graph1"])) {
    graph1();
    exit;
}
if (isset($_GET["graph2"])) {
    graph2();
    exit;
}
if (isset($_GET["graph4"])) {
    graph4();
    exit;
}
if (isset($_GET["graph6"])) {
	include_once(dirname(__FILE__) . '/ressources/class.squid.inc');
	


	$users=new usersMenus();
	if(!$users->AsProxyMonitor){
		echo FATAL_ERROR_SHOW_128("{ERROR_NO_PRIVS}");
		die();
	}
	if(isset($_GET["graph-hour"])){graph_current_hour();exit;}
	if(isset($_GET["graph-hour-day"])){graph_current_hour_day();exit;}
	if(isset($_GET["graph-hour-month"])){graph_current_month_day();exit;}
	
	if(isset($_GET["details"])){details();exit;}
	if(isset($_GET["page"])){page();exit;}
	if(isset($_GET["cpustats"])){cpustats();exit;}

	
page();


function page(){
	$q=new mysql_squid_builder();
	$timekey=date('Ymd');
	$timekeyMonth=date("Ym");
	$time=time();
	$page=CurrentPageName();
	$tpl=new templates();
	$q=new mysql_squid_builder();
	$table="squidmemory_$timekey";
	$TableMonth="squidmemoryM_$timekeyMonth";