diff --git a/www/include/monitoring/status/Common/commonJS.php b/www/include/monitoring/status/Common/commonJS.php index 8f1e47c5596..ba349b8daa5 100644 --- a/www/include/monitoring/status/Common/commonJS.php +++ b/www/include/monitoring/status/Common/commonJS.php @@ -58,6 +58,7 @@ var _search = 'historySearchService[$url]) ? $centreon->historySearchService[$url] : ""));?>'; var _host_search = 'historySearch[$url]) ? $centreon->historySearch[$url] : "")); ?>'; +var _sg_search = 'historySearch[$url]) ? $centreon->historySearch[$url] : "")); ?>'; var _output_search = 'historySearchOutput[$url]) ? $centreon->historySearchOutput[$url] : "")); ?>'; var _num=''; diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php index a4a653a7e63..07cd9def285 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySG.php @@ -80,14 +80,30 @@ $tpl->assign('pollerStr', _('Poller')); $tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing')); $tpl->assign("mon_status_information", _("Status information")); - - + + /* + * Get servicegroups list + */ + $query = "SELECT DISTINCT sg.sg_name FROM servicegroup sg"; + $DBRESULT = $pearDB->query($query); + $sgSearchSelect = ''; + $tpl->assign("sgSearchSelect", $sgSearchSelect); + + $form = new HTML_QuickForm('select_form', 'GET', "?p=".$p); - - $tpl->assign("order", strtolower($order)); $tab_order = array("sort_asc" => "sort_desc", "sort_desc" => "sort_asc"); $tpl->assign("tab_order", $tab_order); + + + + ##Toolbar select $lang["lgd_more_actions"] diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php index aa1c0dd3554..17260f8821b 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceGridBySGJS.php @@ -125,6 +125,10 @@ function mainLoopLocal() { } } _oldInputFieldValue = _currentInputFieldValue; + + jQuery("#sg_search").on('change', function(){ + monitoring_refresh(); + }); setTimeout("mainLoopLocal()", 250); } @@ -136,10 +140,17 @@ function initM(_time_reload, _sid, _o ){ construct_HostGroupSelectList('hostgroups_selected'); if (document.getElementById("host_search") && document.getElementById("host_search").value) { - _search = document.getElementById("host_search").value; + _host_search = document.getElementById("host_search").value; viewDebugInfo('search: '+document.getElementById("host_search").value); - } else if (document.getElementById("host_search").lenght == 0) { - _search = ""; + } else if (document.getElementById("host_search").lenght === 0) { + _host_search = ""; + } + + if (document.getElementById("sg_search") && document.getElementById("sg_search").value) { + _sg_search = document.getElementById("sg_search").value; + viewDebugInfo('search: '+document.getElementById("sg_search").value); + } else if (document.getElementById("sg_search").lenght == 0) { + _sg_search = ""; } if (_first){ @@ -157,12 +168,13 @@ function goM(_time_reload, _sid, _o) { _lock = 1; var proc = new Transformation(); proc.setCallback(monitoringCallBack); - proc.setXml(_addrXML+"?"+'sid='+_sid+'&search='+_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); + proc.setXml(_addrXML+"?"+'sid='+_sid+'&host_search='+_host_search+'&sg_search='+_sg_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); proc.setXslt(_addrXSL); proc.transform("forAjax"); if (_counter == 0) { document.getElementById("host_search").value = _host_search; + document.getElementById("sg_search").value = _sg_search; _counter += 1; } diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php index d762195df25..4bc97c341d4 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySG.php @@ -48,6 +48,7 @@ !isset($_GET["search_type_service"]) ? $search_type_service = 1 : $search_type_service = $_GET["search_type_service"]; !isset($_GET["sort_type"]) ? $sort_type = "host_name" : $sort_type = $_GET["sort_type"]; !isset($_GET["host_search"]) ? $host_search = 0 : $host_search = $_GET["host_search"]; + !isset($_GET["sg_search"]) ? $sg_search = 0 : $sg_search = $_GET["sg_search"]; /* * Check search value in Host search field @@ -55,6 +56,13 @@ if (isset($_GET["host_search"])) { $centreon->historySearch[$url] = $_GET["host_search"]; } + + /* + * Check search value in Service Group search field + */ + if (isset($_GET["sg_search"])) { + $centreon->historySearch[$url] = $_GET["sg_search"]; + } $tab_class = array("0" => "list_one", "1" => "list_two"); $rows = 10; @@ -79,6 +87,21 @@ $tpl->assign('pollerStr', _('Poller')); $tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing')); $tpl->assign("mon_status_information", _("Status information")); + + + /* + * Get servicegroups list + */ + $query = "SELECT DISTINCT sg.sg_name FROM servicegroup sg"; + $DBRESULT = $pearDB->query($query); + $sgSearchSelect = ''; + $tpl->assign("sgSearchSelect", $sgSearchSelect); $form = new HTML_QuickForm('select_form', 'GET', "?p=".$p); diff --git a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php index 0808129be7b..ba0b995f489 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php +++ b/www/include/monitoring/status/ServicesServiceGroups/serviceSummaryBySGJS.php @@ -104,6 +104,7 @@ function mainLoopLocal() { if (!_lock) { set_search_host(escapeURI(_currentInputFieldValue)); _host_search = _currentInputFieldValue; + _sg_search = _currentInputFieldValue; monitoring_refresh(); @@ -115,6 +116,10 @@ function mainLoopLocal() { } } _oldInputFieldValue = _currentInputFieldValue; + + jQuery("#sg_search").on('change', function(){ + monitoring_refresh(); + }); setTimeout("mainLoopLocal()", 250); } @@ -128,9 +133,16 @@ function initM(_time_reload, _sid, _o ){ if (document.getElementById("host_search") && document.getElementById("host_search").value) { _host_search = document.getElementById("host_search").value; viewDebugInfo('search: '+document.getElementById("host_search").value); - } else if (document.getElementById("host_search").lenght == 0) { + } else if (document.getElementById("host_search").lenght === 0) { _host_search = ""; } + + if (document.getElementById("sg_search") && document.getElementById("sg_search").value) { + _sg_search = document.getElementById("sg_search").value; + viewDebugInfo('search: '+document.getElementById("sg_search").value); + } else if (document.getElementById("sg_search").lenght == 0) { + _sg_search = ""; + } if (_first){ mainLoopLocal(); @@ -147,12 +159,13 @@ function goM(_time_reload, _sid, _o) { _lock = 1; var proc = new Transformation(); proc.setCallback(monitoringCallBack); - proc.setXml(_addrXML+"?"+'sid='+_sid+'&search='+_host_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); + proc.setXml(_addrXML+"?"+'sid='+_sid+'&host_search='+_host_search+'&sg_search='+_sg_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time='); proc.setXslt(_addrXSL); proc.transform("forAjax"); if (_counter == 0) { document.getElementById("host_search").value = _host_search; + document.getElementById("sg_search").value = _sg_search; _counter += 1; } diff --git a/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml b/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml index ba11b38213b..703c4281fe2 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml +++ b/www/include/monitoring/status/ServicesServiceGroups/templates/serviceGrid.ihtml @@ -6,6 +6,7 @@ {$search} + {$sgSearchSelect} {if $poller_listing} {$pollerStr}: diff --git a/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceGridBySGXML.php b/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceGridBySGXML.php index 988fe85394c..8b132d99cc7 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceGridBySGXML.php +++ b/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceGridBySGXML.php @@ -38,7 +38,8 @@ ini_set("display_errors", "Off"); - include_once "@CENTREON_ETC@/centreon.conf.php"; + //include_once "@CENTREON_ETC@/centreon.conf.php"; + include_once "/etc/centreon/centreon.conf.php"; include_once $centreon_path . "www/class/centreonXMLBGRequest.class.php"; include_once $centreon_path . "www/include/monitoring/status/Common/common-Func.php"; @@ -74,7 +75,8 @@ $limit = $obj->checkArgument("limit", $_GET, 20); $instance = $obj->checkArgument("instance", $_GET, $obj->defaultPoller); $hostgroups = $obj->checkArgument("hostgroups", $_GET, $obj->defaultHostgroups); - $search = $obj->checkArgument("search", $_GET, ""); + $hSearch = $obj->checkArgument("host_search", $_GET, ""); + $sgSearch = $obj->checkArgument("sg_search", $_GET, ""); $sort_type = $obj->checkArgument("sort_type", $_GET, "host_name"); $order = $obj->checkArgument("order", $_GET, "ASC"); $dateFormat = $obj->checkArgument("date_time_format_status", $_GET, "d/m/Y H:i:s"); @@ -98,9 +100,14 @@ } $rq1 = ""; $rq1 .= " h.host_id = s.host_id AND s.host_id = sgm.host_id "; - if ($search != ""){ - $rq1 .= " AND h.name like '%" . $search . "%' "; + if ($hSearch != ""){ + $rq1 .= " AND h.name like '%" . $hSearch . "%' "; } + + if ($sgSearch != ""){ + $rq1 .= " AND sg.name like '=" . $sgSearch . "' "; + } + $rq1 .= $obj->access->queryBuilder("AND", "s.service_id", $obj->access->getServicesString("ID", $obj->DBC)); $rq1 .= " AND s.enabled = 1 AND s.service_id = sgm.service_id AND sgm.servicegroup_id = sg.servicegroup_id"; diff --git a/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceSummaryBySGXML.php b/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceSummaryBySGXML.php index 76215def0fd..8c316fe9257 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceSummaryBySGXML.php +++ b/www/include/monitoring/status/ServicesServiceGroups/xml/broker/serviceSummaryBySGXML.php @@ -38,7 +38,8 @@ ini_set("display_errors", "Off"); - include_once "@CENTREON_ETC@/centreon.conf.php"; + //include_once "@CENTREON_ETC@/centreon.conf.php"; + include_once "/etc/centreon/centreon.conf.php"; include_once $centreon_path . "www/class/centreonXMLBGRequest.class.php"; include_once $centreon_path . "www/include/monitoring/status/Common/common-Func.php"; @@ -72,7 +73,8 @@ $limit = $obj->checkArgument("limit", $_GET, 20); $instance = $obj->checkArgument("instance", $_GET, $obj->defaultPoller); $hostgroups = $obj->checkArgument("hostgroups", $_GET, $obj->defaultHostgroups); - $search = $obj->checkArgument("search", $_GET, ""); + $hSearch = $obj->checkArgument("host_search", $_GET, ""); + $sgSearch = $obj->checkArgument("sg_search", $_GET, ""); $sort_type = $obj->checkArgument("sort_type", $_GET, "host_name"); $order = $obj->checkArgument("order", $_GET, "ASC"); $dateFormat = $obj->checkArgument("date_time_format_status", $_GET, "d/m/Y H:i:s"); @@ -96,9 +98,14 @@ } $rq1 = ""; $rq1 .= " h.host_id = s.host_id AND s.host_id = sgm.host_id "; - if ($search != ""){ - $rq1 .= " AND h.name like '%" . $search . "%' "; + if ($hSearch != ""){ + $rq1 .= " AND h.name like '%" . $hSearch . "%' "; } + + if ($sgSearch != ""){ + $rq1 .= " AND sg.name like '=" . $sgSearch . "' "; + } + $rq1 .= $obj->access->queryBuilder("AND", "s.service_id", $obj->access->getServicesString("ID", $obj->DBC)); $rq1 .= " AND s.enabled = 1 AND s.service_id = sgm.service_id AND sgm.servicegroup_id = sg.servicegroup_id";