Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
centreon
centreon-widget-global-health
Commits
f80bc2de
Unverified
Commit
f80bc2de
authored
Jul 17, 2019
by
Kevin Duret
Committed by
GitHub
Jul 17, 2019
Browse files
fix(preferences): display services filtered by hostgroup (#16)
Refs: #2 MON-3903
parent
6009da03
Changes
1
Hide whitespace changes
Inline
Side-by-side
global-health/src/global_health.php
View file @
f80bc2de
...
...
@@ -107,16 +107,19 @@ foreach ($tabStatusHost as $key => $statusHost) {
$hostArray
[
$tabStatusHost
[
$key
]][
'percent'
]
=
0
;
}
if
(
isset
(
$preferences
[
'hosts_services'
])
&&
$preferences
[
'hosts_services'
]
==
'hosts'
)
{
$hgName
=
false
;
if
(
!
empty
(
$preferences
[
'hostgroup'
]))
{
$sql
=
'select hg.hg_name from hostgroup hg where hg.hg_id = '
.
$dbb
->
escape
(
$preferences
[
'hostgroup'
]);
$dbResult
=
$db
->
query
(
$sql
);
$row
=
$dbResult
->
fetchRow
();
$hgName
=
false
;
// get hostgroup name if defined in preferences
if
(
!
empty
(
$preferences
[
'hostgroup'
]))
{
$sql
=
'select hg.hg_name from hostgroup hg where hg.hg_id = :hostgroup_id'
;
$stmt
=
$db
->
prepare
(
$sql
);
$stmt
->
bindValue
(
':hostgroup_id'
,
$preferences
[
'hostgroup'
],
PDO
::
PARAM_INT
);
$stmt
->
execute
();
if
(
$row
=
$stmt
->
fetch
())
{
$hgName
=
$row
[
'hg_name'
];
}
}
if
(
isset
(
$preferences
[
'hosts_services'
])
&&
$preferences
[
'hosts_services'
]
==
'hosts'
)
{
$innerjoingroup
=
''
;
$wheregroup
=
''
;
if
(
$hgName
)
{
...
...
@@ -124,9 +127,6 @@ if (isset($preferences['hosts_services']) && $preferences['hosts_services'] == '
' INNER JOIN hostgroups hg ON hhg.hostgroup_id = hg.hostgroup_id and hg.name = \''
.
$hgName
.
'\' '
;
}
/**$obj->DBC->escape($instance)
* Get DB informations for creating Flash
*/
$rq1
=
' SELECT count(DISTINCT h.name) cnt, h.state, SUM(h.acknowledged) as acknowledged, '
.
'SUM(CASE WHEN h.scheduled_downtime_depth >= 1 THEN 1 ELSE 0 END) AS downtime '
.
'FROM `hosts` h '
.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment