* 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'); ?>
* 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) { echo 'ERROR: ' . $Backend->getBackend()->getAlias() . ': ' . $e->getMessage(); } }
/** * Devolver las paradas programadas serializados y codificados en base64 * * @return string * @throws \Exception */ public function getDowntimes() { $SMD = new sysMonDash(); $SMD->setCallType(sysMonDash::CALL_TYPE_API); return base64_encode(serialize($SMD->getRawDowntimes())); }