Exemplo n.º 1
0
 public function getFacts()
 {
     $disk_used = $this->getDiskSpaceUsage();
     $db_used = $this->getDBSpaceUsage();
     $facts = array('disk_used_mb' => round($disk_used / (1024 * 1024), 2), 'disk_used' => Utils::humanize($disk_used), 'db_used_mb' => round($db_used / (1024 * 1024), 2), 'db_used' => Utils::humanize($db_used));
     return $facts;
 }
Exemplo n.º 2
0
 public function getFacts()
 {
     $disk_size = disk_total_space(getcwd());
     $disk_free = disk_free_space(getcwd());
     $facts = array();
     $facts['disksize_mb'] = round($disk_size / (1024 * 1024), 2);
     $facts['diskfree_mb'] = round($disk_free / (1024 * 1024), 2);
     $facts['disksize'] = Utils::humanize($disk_size);
     $facts['diskfree'] = Utils::humanize($disk_free);
     return $facts;
 }
Exemplo n.º 3
0
 public function getFacts()
 {
     $old_error_reporting = error_reporting(0);
     $linfo = new Info();
     $parser = $linfo->getParser();
     $cpu_info = $parser->getCpu();
     $uptime = $parser->getUptime();
     $uptime_s = time() - $uptime['bootedTimestamp'];
     $distro = $parser->getDistro();
     $ram = $parser->getRam();
     error_reporting($old_error_reporting);
     return array('fqdn' => $parser->getHostName(), 'processors' => array('models' => array_column($cpu_info, 'Model'), 'count' => count($cpu_info)), 'system_uptime' => array('seconds' => $uptime_s, 'hours' => floor($uptime_s / 3600), 'days' => floor($uptime_s / (3600 * 24)), 'uptime' => $uptime['text']), 'architecture' => $parser->getCPUArchitecture(), 'os' => array('name' => $distro['name'], 'lsb' => array('distdescription' => $distro['name'] . ' ' . $parser->getOS() . ' ' . $distro['version'])), 'memoryfree_mb' => round($ram['free'] / (1024 * 1024), 2), 'memorysize_mb' => round($ram['total'] / (1024 * 1024), 2), 'swapfree_mb' => round($ram['swapFree'] / (1024 * 1024), 2), 'swapsize_mb' => round($ram['swapTotal'] / (1024 * 1024), 2), 'memoryfree' => Utils::humanize($ram['free']), 'memorysize' => Utils::humanize($ram['total']), 'swapfree' => Utils::humanize($ram['swapFree']), 'swapsize' => Utils::humanize($ram['swapTotal']));
 }
Exemplo n.º 4
0
 /**
  * @dataProvider humanizeProvider
  */
 public function testHumanize($expected, $input)
 {
     $this->assertEquals($expected, Utils::humanize($input));
 }