<?php /** * Entrance of Blessing Skin Server * * @package Blessing Skin Server * @author printempw <*****@*****.**> */ @ini_set('display_errors', 'on'); // check PHP version if (version_compare(PHP_VERSION, '5.5.9', '<')) { exit('[Error] Blessing Skin Server needs PHP version >= 5.5.9, you are now using ' . PHP_VERSION); } require __DIR__ . '/bootstrap/autoload.php'; // check the runtime environment runtime_check(array('extensions' => array('pdo_mysql', 'openssl', 'gd'))); // handle the request require __DIR__ . '/bootstrap/handler.php';
/** * 服务器探针.测试支持CENTOS.REDHAT. * - 获取服务器负载 * - 获取所有网卡状态 * - 获取CPU使用率 * - 获取磁盘使用率 * - 获取内存使用率 * 该探针需要PHP支持EXEC函数,可以在CGI模式下运行,依赖系统内置的IFCONFI,TOP,UPTIME,DF工具获取数据. * * @copyright (c) 2013, mMonitor.org * @version 1.0.1 * @author Actrace * @date 2013-11-26 14:48:41 */ if (runtime_check()) { echo json_encode(array('Load' => get_load(), 'Network' => get_network_status(), 'Memory' => get_mem_status(), 'Disk' => get_disk_status(), 'Cpu' => get_cpu_status())); } else { echo 'need function[exec]'; } function get_load() { exec('uptime', $return, $res); preg_match_all('|load average: (.*), (.*), (.*)|', $return[0], $macth); return $macth; } function get_network() { exec('ifconfig', $return, $res); $tmp = ''; $res = array();