From 68c79d4ad7b9bfedf578ccdb940bb8da23d044ee Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Thu, 15 Dec 2005 17:19:56 +0000 Subject: [PATCH] On David's request, added the E@H 'server_status.php' page. Note that this is not linked to from the sample project home page. It also contains at least some E@H-specific stuff, but David promised to clean this up (:-). svn path=/trunk/boinc/; revision=9071 --- checkin_notes | 8 + html/user/server_status.php | 307 ++++++++++++++++++++++++++++++++++++ 2 files changed, 315 insertions(+) create mode 100644 html/user/server_status.php diff --git a/checkin_notes b/checkin_notes index d6c700d945..6f05b0643a 100755 --- a/checkin_notes +++ b/checkin_notes @@ -14489,8 +14489,16 @@ Bruce 15 Dec 2005 - Made 'last scheduler contact' values a link to the posted server-side scheduler logs. On projects that don't post logs, these links will simply give a 'not found' error if the user clicks on them. + - On David's request, added the E@H 'server_status.php' page. Note that + this is not linked to from the sample project home page. It also contains + at least some E@H-specific stuff, but David promised to clean this up (:-). html/ inc/ host.inc + user/ + server_status.php [NEW FILE ADDED] + + + diff --git a/html/user/server_status.php b/html/user/server_status.php new file mode 100644 index 0000000000..c39cce425e --- /dev/null +++ b/html/user/server_status.php @@ -0,0 +1,307 @@ +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); +?>