. require_once("../inc/cache.inc"); require_once("../inc/util_ops.inc"); require_once("../inc/db.inc"); require_once("../project/project.inc"); ################################################ # local functions function numerical_query($query) { // execute a database query which returns a single numerical result $result = _mysql_query("$query"); $x = _mysql_fetch_object($result); return $x->total; } function count_estimate($query) { // this use of explain is way off at least for low counts -EAM 28Sep2004 //$result = _mysql_query("explain $query"); $result = _mysql_query("$query"); $x = _mysql_fetch_object($result); // return $x->rows-1; return $x->total; } function find_oldest() { $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); $x = _mysql_fetch_object($result); return $x->create_time; } function daemon_status($host, $pidname) { $path = "../../pid_$host/$pidname.pid"; $running = false; if (is_file($path)) { $pid = file_get_contents($path); if ($pid) { // This needs to be set to work via ssh to other hosts //$foo = exec("/usr/bin/ssh $host ps w $pid"); $foo = exec("ps w $pid"); if ($foo) { if (strstr($foo, $pidname)) { $running = true; } } } } return $running; } function show_status($host, $function, $running) { echo "$function$host"; if ($running) { echo "Running\n"; } else { echo "Not running\n"; } } function show_daemon_status($host, $progname, $pidname) { $running = daemon_status($host, $pidname); show_status($host, $progname, $running); } ############################################### # BEGIN: start_cache(1800); $Nmin = $cached_max_age/60; $dbrc = db_init(1); // 1=soft, remember that DB might be down page_head(PROJECT . " - Server Status"); // Date stamp echo "
".PROJECT. " server status as of ". date("g:i A T"). " on ". date("l, j F Y ") . " (updated every $Nmin minutes).\n"; $proc_uptime=exec("cat /proc/uptime | cut -d\" \" -f-1"); $days = (int)($proc_uptime/86400); $hours=(int)($proc_uptime/3600); $hours=$hours % 24; $minutes=(int)($proc_uptime/60); $minutes=$minutes % 60; echo "
The ".PROJECT. " main server has been continuously up for ". "$days"." days "."$hours"." hours "."$minutes"." minutes.\n

"; // tables side by side echo "
\n"; echo "

Server status

"; $web_running = !file_exists("../../stop_web"); show_status("einstein", "Web server", $web_running); show_daemon_status("einstein", "Pulsar work generator (LHO)", "make_pulsar_WU_daemon_h"); show_daemon_status("einstein", "Pulsar work generator (LLO)", "make_pulsar_WU_daemon_l"); show_daemon_status("einstein", "BOINC database feeder", "feeder"); show_daemon_status("einstein", "BOINC transitioner", "transitioner"); $sched_running = !file_exists("../../stop_sched"); show_status("einstein", "BOINC scheduler", $sched_running); show_daemon_status("einstein", "Einstein validator", "einstein_validator"); show_daemon_status("einstein", "Einstein assimilator", "einstein_assimilator"); show_daemon_status("einstein", "BOINC file deleter", "file_deleter"); show_daemon_status("einstein", "BOINC database purger", "db_purge"); echo "\n
ProgramHostStatus
  \n"; echo "

Users and Computers

"; if ($dbrc) { echo "The database server is not accessable"; } else { $now=time(0); $s_day=24*3600; $d_ago=$now-$s_day; $s_week=7*$s_day; $w_ago=$now-$s_week; echo " "; $n = count_estimate("select count(*) as total from user"); echo " "; $n = count_estimate("select count(*) as total from user where total_credit>0"); echo " "; $n = count_estimate("select count(*) as total from user where create_time > $d_ago"); echo " "; echo " "; $n = count_estimate("select count(*) as total from host"); echo " "; $n = count_estimate("select count(*) as total from host where create_time > $d_ago"); echo " "; $n = count_estimate("select count(*) as total from host where total_credit>0"); echo " "; $n = count_estimate("select count(id) as total from host where rpc_time>$w_ago"); echo " "; $n = count_estimate("select sum(p_fpops) as total from host")/1000000000; // echo " // //"; printf("", $n/1000); $n = count_estimate("select sum(p_fpops) as total from host where rpc_time>$w_ago")/1000000000; // echo " // //"; printf("", $n/1000); $n = numerical_query("SELECT SUM(cpu_time * p_fpops) / $s_week AS total FROM result,host where outcome = '1' AND (received_time > $w_ago) AND (result.hostid = host.id )")/1000000000; printf("", $n/1000); echo "\n
USERSApproximate #
in database".number_format($n)."
with credit".number_format($n)."
registered in past 24 hours".number_format($n)."
HOST COMPUTERSApproximate #
in database".number_format($n)."
registered in past 24 hours".number_format($n)."
with credit".number_format($n)."
active in past 7 days".number_format($n)."
floating point speed".number_format($n)." GFLOPS
floating point speed1)%.1f TFLOPS
GFLOPS in past 7 days".number_format($n)." GFLOPS
floating point speed in past 7 days2)%.1f TFLOPS
floating point speed from results3)%.1f TFLOPS
 

Work and Results

\n"; echo " "; echo " "; $n = count_estimate("select count(*) as total from workunit"); echo " "; $n = count_estimate("select count(*) as total from workunit where canonical_resultid!=0"); echo " "; echo " "; $n = count_estimate("select count(*) as total from result"); echo " "; $n = count_estimate("select count(id) as total from result where server_state=2"); echo " "; $n = count_estimate("select count(id) as total from result where server_state=4"); echo " "; $n = count_estimate("select count(id) as total from result where server_state=5 and file_delete_state=2"); echo " "; $n = count_estimate("select count(id) as total from result where server_state=5 and outcome=1 and validate_state=1"); echo " "; $n = numerical_query("SELECT COUNT(id) AS total FROM result WHERE server_state=5 AND outcome=1 AND validate_state=1 AND ( received_time > $w_ago )"); echo " "; $n = count_estimate("select count(id) as total from result where server_state=5 and outcome=1 and validate_state=2"); echo " "; $n = time(0)-find_oldest(); $days = (int)($n/86400); $hours=(int)($n/3600); $hours=$hours % 24; $minutes=(int)($n/60); $minutes=$minutes % 60; echo " "; echo "
WORKUNITSApproximate #
in database".number_format($n)."
with canonical result".number_format($n)."
RESULTSApproximate #
in database".number_format($n)."
unsent".number_format($n)."
in progress".number_format($n)."
deleted".number_format($n)."
valid".number_format($n)."
valid last week".number_format($n)."
invalid".number_format($n)."
Oldest Unsent Result".$days." d ".$hours." h ".$minutes." m
"; } // Server restrictions // Display cgi-bin restriction status if ( file_exists("../../cgi-bin/.htaccess") ) { echo "

The ".PROJECT." scheduler is currently restricted to uwm.edu and a few other domains.

"; } echo "

"; echo "
1) the sum of the benchmarked FLops/s of all hosts in the database"; echo "
2) the sum of the benchmarked FLops/s of all hosts that have contacted the Einstein@Home scheduler within the past week"; echo "
3) the sum of the FLops of all valid results from last week divided by the number of seconds in a week"; page_tail(); end_cache(600); ?>