status.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) Copyright (C) 2008 - 2013 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. function numbersFormatting($bytes){
  25. $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
  26. $base = 1024;
  27. $class = min((int)log($bytes , $base) , count($si_prefix) - 1);
  28. return sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
  29. }
  30. function exec_ogp_module()
  31. {
  32. global $db;
  33. include_once ("modules/status/config.php");
  34. include_once ("modules/status/include/os.php");
  35. //CPU Usage
  36. if ($modulecpu == "1") {
  37. include_once ("modules/status/include/cpu.php");
  38. }
  39. //RAM Usage
  40. if ($modulememory == "1") {
  41. include_once ("modules/status/include/ram.php");
  42. }
  43. //HDD Space
  44. if ($modulestorage == "1") {
  45. include_once ("modules/status/include/hdd.php");
  46. }
  47. //System Uptime
  48. if ($modulesystemuptime == "1")
  49. {
  50. include_once ("modules/status/include/uptime.php");
  51. }
  52. // System task information snapshot
  53. if ($modulesystemtasks == "1")
  54. {
  55. include_once ("modules/status/include/task.php");
  56. }
  57. if ($modulesystemuptime == "1")
  58. {
  59. echo "<div id=\"column4\" style=\"font-size:12pt;width:59%;float:left;margin-left:1%;\" >
  60. <div class=\"dragbox bloc rounded\" >
  61. <h4>".get_lang('system_uptime')."</h4>
  62. <div class=\"dragbox-content\">
  63. <center>
  64. <b>".get_lang('system_up_time').": " . @$indexuptime . "<br>
  65. ".get_lang('system_up_since').": " . @$indexuptimesince . "
  66. </b></center>
  67. </div>
  68. </div>
  69. </div>";
  70. }
  71. if ($modulecpu == "1" and $nocpushow != "1")
  72. {
  73. echo "<div id=\"column4\" style=\"width:49.5%;float:right;margin-top:1%;\" >
  74. <div class=\"dragbox bloc rounded\">
  75. <h4>".get_lang('cpu_usage')."</h4>
  76. <div class=\"dragbox-content\">";
  77. ksort($cores);
  78. foreach($cores as $cpu => $percent)
  79. {
  80. echo "<b>CPU" . $cpu . " ".get_lang('cpu_load').": " . $percent . " %</b><br>
  81. <img src=\"modules/status/include/bar.php?rating=" . $percent . "\" style=\"width:100%;border:1px solid tranparent;\" />";
  82. }
  83. echo '</div>
  84. </div>
  85. </div>';
  86. }
  87. if ($modulememory == "1") {
  88. echo "<div id=\"column4\" style=\"width:49.5%;float:left;margin-top:1%;\" >
  89. <div class=\"dragbox bloc rounded\" >
  90. <h4>".get_lang('ram_usage')."</h4>
  91. <div class=\"dragbox-content\">
  92. <b>".get_lang('ram_used').": " . $ramusage . "<br></b>
  93. <img src=\"modules/status/include/bar.php?rating=" . $rampercent . "\" style=\"width:100%;border:1px solid tranparent;\">
  94. </div>
  95. </div></div>";
  96. }
  97. if ($modulestorage == "1")
  98. {
  99. echo "<div id=\"column4\" style=\"width:100%;float:left;margin-top:1%;\" >
  100. <div class=\"dragbox bloc rounded\" >
  101. <h4>".get_lang('storage_space')."</h4>
  102. <div class=\"dragbox-content\">
  103. <b>".get_lang('storage_total').": " . $diskspace . "<br>
  104. ".get_lang('storage_used').": " . $diskinuse . "<br>
  105. <img src= \"modules/status/include/bar.php?rating=" . $hddbarusage . "\" style=\"width:100%;border:1px solid tranparent;\"><br>
  106. ".get_lang('storage_free').": " . $hddfreespace . "</b>
  107. </div>
  108. </div>
  109. </div>";
  110. }
  111. if($modulesystemtasks == "1"){
  112. echo "<div id=\"column4\" style=\"width:100%;float:left;margin-top:1%;\" >
  113. <div class=\"dragbox bloc rounded\" >
  114. <h4>".get_lang('process_monitor')."</h4>
  115. <div class=\"dragbox-content\">";
  116. if(isset($taskoutput) && is_array($taskoutput) && isset($taskoutput["task"]) && !empty($taskoutput["task"])){
  117. echo "<pre>" . $taskoutput["task"] . "</pre>";
  118. }
  119. echo ' </div>
  120. </div>
  121. </div>';
  122. }
  123. }
  124. ?>