コード例 #1
0
ファイル: api.php プロジェクト: nuxsmin/sysMonDash
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with sysMonDash.  If not, see <http://www.gnu.org/licenses/>.
 */
use SMD\Api\Api;
use SMD\Core\Init;
use SMD\Http\Request;
use SMD\Http\Response;
use SMD\Util\Json;
define('APP_ROOT', '.');
require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php';
Init::start();
$apiToken = Request::analyze('token');
$action = Request::analyze('action', 0);
$Api = new Api();
if (!$Api->checkToken($apiToken)) {
    Response::printJSON('Token inválido');
}
$data = null;
switch ($action) {
    case Api::ACTION_EVENTS:
        $data = $Api->getEvents();
        break;
    case Api::ACTION_DOWNTIMES:
        $data = $Api->getDowntimes();
        break;
    case Api::ACTION_CHECK:
        Response::printJSON('V ' . implode('.', \SMD\Util\Util::getVersion(true)), 0);
        break;
コード例 #2
0
ファイル: saveConfig.php プロジェクト: nuxsmin/sysMonDash
$showColLastCheck = Request::analyze('col_last_check', false, false, true);
$showColHost = Request::analyze('col_host', false, false, true);
$showColService = Request::analyze('col_service', false, false, true);
$showColInfo = Request::analyze('col_info', false, false, true);
$showColBackend = Request::analyze('col_backend', false, false, true);
$showScheduled = Request::analyze('hide_scheduled', false, false, true);
$regexHostShow = Request::analyze('regex_host_show');
$regexServicesNoShow = Request::analyze('regex_services_no_show');
$criticalItems = Request::analyze('critical_items');
$specialClientURL = Request::analyze('special_client_url');
$specialRemoteServerURL = Request::analyze('special_remote_server_url');
$specialMonitorServerUrl = Request::analyze('special_monitor_server_url');
$specialAPIToken = Request::analyze('special_api_token');
$specialConfigPass = Request::analyze('special_config_pass');
try {
    $Backends = Html::processFormBackends(Request::analyze('backend'));
} catch (Exception $e) {
    Response::printJSON(\SMD\Core\Language::t($e->getMessage()));
}
$ConfigData = new ConfigData();
$ConfigData->setLanguage($siteLanguage);
$ConfigData->setPageTitle($siteTitle);
$ConfigData->setRefreshValue($eventRefresh);
$ConfigData->setNewItemTime($eventNewItemTime);
$ConfigData->setMaxDisplayItems($eventMaxItems);
$ConfigData->setNewItemAudioEnabled($eventNewItemAudio);
$ConfigData->setColLastcheck($showColLastCheck);
$ConfigData->setColHost($showColHost);
$ConfigData->setColService($showColService);
$ConfigData->setColStatusInfo($showColInfo);
$ConfigData->setColBackend($showColBackend);
コード例 #3
0
ファイル: functions.php プロジェクト: nuxsmin/sysMonDash
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with sysMonDash.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
use SMD\Backend\BackendInterface;
use SMD\Core\Init;
use SMD\Core\sysMonDash;
use SMD\Util\Util;
define('APP_ROOT', '.');
require APP_ROOT . DIRECTORY_SEPARATOR . 'Base.php';
Init::start();
$raw = \SMD\Http\Request::analyze('raw', 0);
$allHeaders = \SMD\Http\Request::analyze('allheaders', false, false, true);
echo '<pre>';
if ($raw === 1) {
    $SMD = new sysMonDash();
    foreach ($SMD->getBackends() as $Backend) {
        try {
            /** @var BackendInterface $Backend */
            $Backend->setAllHeaders($allHeaders);
            echo 'Backend: ', $Backend->getBackend()->getAlias(), PHP_EOL;
            echo 'Hosts', PHP_EOL;
            print_r(Util::arraySortByProperty($Backend->getHostsProblems(), 'lastHardStateChange'));
            echo 'Services', PHP_EOL;
            print_r(Util::arraySortByProperty($Backend->getServicesProblems(), 'lastHardStateChange'));
            echo 'Downtimes', PHP_EOL;
            print_r(Util::arraySortByProperty($Backend->getScheduledDowntimes(), 'startTime', false));
        } catch (Exception $e) {
コード例 #4
0
ファイル: getData.php プロジェクト: nuxsmin/sysMonDash
 * You should have received a copy of the GNU General Public License
 * along with sysMonDash.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
use SMD\Core\Config;
use SMD\Core\Init;
use SMD\Core\Language;
use SMD\Core\sysMonDash;
use SMD\Http\Request;
use SMD\Util\Util;
define('APP_ROOT', '..');
require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php';
Init::start();
Request::checkCORS();
$type = Request::analyze('t', VIEW_FRONTLINE);
$timeout = Request::analyze('to', Config::getConfig()->getRefreshValue());
$SMD = new sysMonDash();
$SMD->setViewType($type);
ob_start();
// Array con los avisos filtrados
$res = $SMD->getItems();
if ($type !== 1) {
    $showAll = '<a href="index.php?t=' . VIEW_ALL . '" title="' . Language::t('Mostrar los avisos ocultos') . '">' . Language::t('Mostrar Todos') . '</a>';
} else {
    $showAll = '<a href="index.php?t=' . VIEW_FRONTLINE . '" title="' . Language::t('Mostrar sólo avisos importantes') . '">' . Language::t('Mostrar Menos') . '</a>';
}
?>
    <table id="tblBoard" width="90%" border="0" class="boldtable" align="center">
        <thead class="head">
        <th width="3%"><?php 
echo Language::t('Nivel');
コード例 #5
0
ファイル: config.php プロジェクト: nuxsmin/sysMonDash
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with sysMonDash.  If not, see <http://www.gnu.org/licenses/>.
 */
use SMD\Core\Config;
use SMD\Core\Init;
use SMD\Core\Language;
use SMD\Core\Session;
use SMD\Http\Request;
use SMD\Util\Util;
define('APP_ROOT', '.');
require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php';
Init::start();
$hash = Request::analyze('h');
$hashOk = $hash === Session::getConfig()->getHash() || Session::getConfig()->getHash() === '';
$passOK = sha1($hash) === (string) Session::getConfig()->getConfigPassword();
?>
<!DOCTYPE html>
<html>
<head xmlns="http://www.w3.org/1999/html">
    <meta charset="UTF-8">
    <title><?php 
echo Language::t(Config::getConfig()->getPageTitle());
?>
</title>
    <meta name="author" content="Rubén Domínguez">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/png" href="imgs/logo_small.png">
    <link rel="stylesheet" type="text/css" href="css/reset.min.css">
コード例 #6
0
ファイル: checkConfig.php プロジェクト: nuxsmin/sysMonDash
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with sysMonDash.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
use Exts\Zabbix\ZabbixApiLoader;
use SMD\Core\Init;
use SMD\Http\Request;
use SMD\Http\Response;
use SMD\Util\Util;
define('APP_ROOT', '..');
require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php';
Init::start();
$action = Request::analyze('action');
$data = Request::analyze('data');
if (!$action || !$data) {
    Response::printJSON('Petición inválida');
} else {
    $data = json_decode($data);
    if (json_last_error() !== 0) {
        Response::printJSON('Petición inválida');
    }
}
try {
    switch ($action) {
        case 'smdBackend':
            $url = $data->url . '?action=' . $data->action . '&token=' . $data->token;
            $json = Util::getDataFromUrl($url);
            break;
        case 'zabbixBackend':
コード例 #7
0
ファイル: index.php プロジェクト: nuxsmin/sysMonDash
 * You should have received a copy of the GNU General Public License
 * along with sysMonDash.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
use SMD\Core\Config;
use SMD\Core\Init;
use SMD\Core\Language;
use SMD\Core\Session;
use SMD\Http\Request;
use SMD\Util\Util;
define('APP_ROOT', '.');
require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php';
Init::start();
$type = Request::analyze('t', VIEW_FRONTLINE);
$timeout = Request::analyze('to', Config::getConfig()->getRefreshValue());
$scroll = Request::analyze('scroll', $type === VIEW_FRONTLINE || $type === VIEW_DISPLAY ? 1 : 0);
$ajaxFile = '/ajax/getData.php?t=' . $type . '&to=' . $timeout;
Session::setCssHash(Util::getCssHash());
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>sysMonDash :: <?php 
echo Config::getConfig()->getPageTitle();
?>
</title>
    <meta name="author" content="Rubén Domínguez">
    <link rel="icon" type="image/png" href="imgs/logo_small.png">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/reset.min.css">