Petrb has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/70603


Change subject: implemented check for free v_mem
......................................................................

implemented check for free v_mem

Change-Id: Ibf180515461ee8c3fb8dd4a9ef4a96f89a3d1e4f
---
M www/content/status.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/toollabs 
refs/changes/03/70603/1

diff --git a/www/content/status.php b/www/content/status.php
index 4e9987c..6a9747f 100644
--- a/www/content/status.php
+++ b/www/content/status.php
@@ -50,6 +50,15 @@
 
   $rawjobs = toarray(simplexml_load_string(`PATH=/bin:/usr/bin /usr/bin/qstat 
-u '*' -r -xml`));
   $rawhosts = toarray(simplexml_load_string(`PATH=/bin:/usr/bin /usr/bin/qhost 
-F h_vmem -xml`));
+  $vmem = toarray(simplexml_load_string(`PATH=/bin:/usr/bin /usr/bin/qstat -F 
h_vmem -xml`));
+  foreach ($vmem['queue_info'] as $vm) {
+         $server = $vm['name'];
+         $server = substr($server, strpos($server, "@") + 1);
+         $server = substr($server, 0, strpos($server, "."));
+         if ( $server !== false ) {
+             $h_vmem[$server] = $vm['resource'];
+         }
+  }
 ?>
 <H1>Wikimedia Tool Labs</H1>
 This is the web server for the Tool Labs project, the home of 
community-maintained external tools supporting Wikimedia projects and their 
users.
@@ -117,6 +126,7 @@
          <SPAN CLASS="hostname"><?= $host ?></SPAN>
           <SPAN><B>Load:</B> <?= (int)($h['use']*1000)/10 ?>%</SPAN>
           <SPAN><B>Memory:</B> <?= (int)($h['mem']*1000)/10 ?>%</SPAN>
+          <SPAN><B>Free vmem:</B> <? echo $h_vmem[$host]; ?></SPAN>
         </DIV>
       <TABLE CLASS="hostjobs"><?
       foreach($jobs as $jobid => $j):

-- 
To view, visit https://gerrit.wikimedia.org/r/70603
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf180515461ee8c3fb8dd4a9ef4a96f89a3d1e4f
Gerrit-PatchSet: 1
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: Petrb <benap...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to