arw_monitor.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. class arw_monitorControl extends SystemControl
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct();
  7. }
  8. public function indexOp()
  9. {
  10. $ins = Cache::getInstance('cacheredis');
  11. $name = 'disk_monitor';
  12. $hash_data = $ins->hget($name, '');
  13. $result = [];
  14. foreach ($hash_data as $ip => $str)
  15. {
  16. $str = str_replace('\t', "", $str);
  17. $str = ltrim($str,'#');
  18. $arrs = explode('#', $str);
  19. foreach ($arrs as $arr) {
  20. $data = explode(':', $arr);
  21. $key = ltrim($data[0],'_');
  22. $value = $data[1];
  23. if($key == 'cur_time') {
  24. $cur_time = explode('-',$value);
  25. $value = "$cur_time[0]-$cur_time[1]-$cur_time[2] $cur_time[3]:$cur_time[4]:$cur_time[5]";
  26. }else{
  27. $key = str_replace('_', "/", $key);
  28. }
  29. $item[$key] = $value;
  30. }
  31. $result[$ip] = $item;
  32. }
  33. Tpl::output('data', $result);
  34. Tpl::showpage('arw.monitor');
  35. }
  36. }