nagiosql/admin/monitoring.php

113 lines
6.0 KiB
PHP
Raw Permalink Normal View History

2017-05-22 11:24:21 +02:00
<?php
///////////////////////////////////////////////////////////////////////////////
//
// NagiosQL
//
///////////////////////////////////////////////////////////////////////////////
//
2019-04-17 11:40:50 +02:00
// (c) 2005-2018 by Martin Willisegger
2017-05-22 11:24:21 +02:00
//
// Project : NagiosQL
// Component : Admin specials overview
2019-04-17 11:40:50 +02:00
// Website : https://sourceforge.net/projects/nagiosql/
// Version : 3.4.0
// GIT Repo : https://gitlab.com/wizonet/NagiosQL
2017-05-22 11:24:21 +02:00
//
///////////////////////////////////////////////////////////////////////////////
//
2019-04-17 11:40:50 +02:00
// Path settings
// ===================
$strPattern = '(admin/[^/]*.php)';
$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING));
$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING));
//
2017-05-22 11:24:21 +02:00
// Define common variables
// =======================
2019-04-17 11:40:50 +02:00
$prePageId = 2;
$preContent = 'admin/mainpages.htm.tpl';
2017-05-22 11:24:21 +02:00
//
// Include preprocessing file
// ==========================
2019-04-17 11:40:50 +02:00
require $preBasePath.'functions/prepend_adm.php';
require $preBasePath.'functions/prepend_content.php';
2017-05-22 11:24:21 +02:00
//
// Include content
// ===============
2019-04-17 11:40:50 +02:00
$conttp->setVariable('TITLE', translate('Monitoring'));
$conttp->parse('header');
$conttp->show('header');
$conttp->setVariable('DESC', translate('Define host and service supervisions as well as host and service groups.'));
$conttp->setVariable('STATISTICS', translate('Statistical datas'));
$conttp->setVariable('TYPE', translate('Group'));
$conttp->setVariable('ACTIVE', translate('Active'));
$conttp->setVariable('INACTIVE', translate('Inactive'));
2017-05-22 11:24:21 +02:00
//
// Include statistical data
// ========================
// Get read access groups
2019-04-17 11:40:50 +02:00
$strAccess = $myVisClass->getAccessGroups('read');
$intAccessGrp8 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=8');
$intAccessGrp9 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=9');
$intAccessGrp10 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=10');
$intAccessGrp11 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=11');
$intAccessGrp12 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=12');
$intAccessGrp13 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=13');
if ($myVisClass->checkAccountGroup($intAccessGrp8, 'read') == 0) {
$conttp->setVariable('NAME', translate('Hosts'));
$conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_host` '
. "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_host` '
. "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->parse('statisticrow');
2017-05-22 11:24:21 +02:00
}
2019-04-17 11:40:50 +02:00
if ($myVisClass->checkAccountGroup($intAccessGrp9, 'read') == 0) {
$conttp->setVariable('NAME', translate('Services'));
$conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_service` '
. "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_service` '
. "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->parse('statisticrow');
2017-05-22 11:24:21 +02:00
}
2019-04-17 11:40:50 +02:00
if ($myVisClass->checkAccountGroup($intAccessGrp10, 'read') == 0) {
$conttp->setVariable('NAME', translate('Host groups'));
$conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostgroup` '
. "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostgroup` '
. "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->parse('statisticrow');
2017-05-22 11:24:21 +02:00
}
2019-04-17 11:40:50 +02:00
if ($myVisClass->checkAccountGroup($intAccessGrp11, 'read') == 0) {
$conttp->setVariable('NAME', translate('Service groups'));
$conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicegroup` '
. "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicegroup` '
. "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->parse('statisticrow');
2017-05-22 11:24:21 +02:00
}
2019-04-17 11:40:50 +02:00
if ($myVisClass->checkAccountGroup($intAccessGrp12, 'read') == 0) {
$conttp->setVariable('NAME', translate('Host templates'));
$conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hosttemplate` '
. "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hosttemplate` '
. "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->parse('statisticrow');
2017-05-22 11:24:21 +02:00
}
2019-04-17 11:40:50 +02:00
if ($myVisClass->checkAccountGroup($intAccessGrp13, 'read') == 0) {
$conttp->setVariable('NAME', translate('Service templates'));
$conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicetemplate` '
. "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicetemplate` '
. "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)"));
$conttp->parse('statisticrow');
2017-05-22 11:24:21 +02:00
}
2019-04-17 11:40:50 +02:00
$conttp->parse('statistics');
$conttp->parse('main');
$conttp->show('main');
2017-05-22 11:24:21 +02:00
//
// Include Footer
// ==============
2019-04-17 11:40:50 +02:00
$maintp->setVariable('VERSION_INFO', "<a href='https://sourceforge.net/projects/nagiosql/' "
. "target='_blank'>NagiosQL</a> $setFileVersion");
$maintp->parse('footer');
$maintp->show('footer');