Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.54 KB | None | 0 0
  1. <?php
  2.  
  3. ##|+PRIV
  4. ##|*IDENT=page-diagnostics-system-activity
  5. ##|*NAME=Diagnostics: System Activity
  6. ##|*DESCR=Allows access to the 'Diagnostics: System Activity' page
  7. ##|*MATCH=diag_system_activity.php*
  8. ##|-PRIV
  9.  
  10. require_once("guiconfig.inc");
  11.  
  12.     $tg_backgroundupdate = 'true';
  13.  
  14. if ($_REQUEST['getactivity']) {
  15.     $text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`;
  16.     echo $text;
  17.     exit;
  18. }
  19.  
  20. if ($input_errors) {
  21.     print_input_errors($input_errors);
  22. }
  23.  
  24. ?>
  25. <script type="text/javascript">
  26. //<![CDATA[
  27. events.push(function() {
  28.     ajaxbusy = false;
  29.  
  30.     function getcpuactivity() {
  31.  
  32.         if (ajaxbusy) {
  33.             return;
  34.         }
  35.  
  36.         ajaxbusy = true;
  37.  
  38.         ajaxRequest = $.ajax(
  39.             {
  40.                 url: '/diag_system_activity.php',
  41.                 type: 'post',
  42.                 data: {
  43.                     getactivity: 'yes'
  44.                 },
  45.                 dataType: "html",
  46.             }
  47.         );
  48.  
  49.         // Deal with the results of the above ajax call
  50.         ajaxRequest.done(function (response, textStatus, jqXHR) {
  51.             $('#xhrOutput').html(response);
  52.             ajaxbusy = false;
  53.         });
  54.  
  55.         setTimeout(getcpuactivity, 5000);
  56.     };
  57.  
  58.     getcpuactivity();
  59.  
  60. });
  61. //]]>
  62. </script>
  63.  
  64. <div class="panel panel-default">
  65.     <div class="panel-heading"><h2 class="panel-title"><?=gettext('CPU Activity')?></h2></div>
  66.     <div class="panel panel-body">
  67.         <pre id="xhrOutput"><?=gettext("Gathering CPU activity, please wait...")?></pre>
  68.     </div>
  69. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement