/** * Physical memory information and Swap Space information * * @return void */ private function _memory() { if (CommonFunctions::executeProgram('sysinfo', '-mem', $bufr, PSI_DEBUG)) { if (preg_match("/(.*)bytes free\\s+\\(used\\/max\\s+(.*)\\s+\\/\\s+(.*)\\)\\s*\n\\s+\\(cached\\s+(.*)\\)/", $bufr, $ar_buf)) { $this->sys->setMemTotal($ar_buf[3]); $this->sys->setMemFree($ar_buf[1]); $this->sys->setMemCache($ar_buf[4]); $this->sys->setMemUsed($ar_buf[2]); } } if (CommonFunctions::executeProgram('vmstat', '', $bufr, PSI_DEBUG)) { if (preg_match("/max swap space:\\s+(.*)\nfree swap space:\\s+(.*)\n/", $bufr, $ar_buf)) { if ($ar_buf[1] > 0) { $dev = new DiskDevice(); $dev->setMountPoint("/boot/common/var/swap"); $dev->setName("SWAP"); $dev->setTotal($ar_buf[1]); $dev->setFree($ar_buf[2]); $dev->setUSed($ar_buf[1] - $ar_buf[2]); $this->sys->setSwapDevices($dev); } } } }