fixed error count agents disabled

(cherry picked from commit 528a2bc957)
This commit is contained in:
daniel 2016-12-21 09:29:45 +01:00
parent 5bf60f2f97
commit 8a0a508b48
2 changed files with 14 additions and 6 deletions

View File

@ -297,7 +297,8 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
function agents_get_agents ($filter = false, $fields = false, function agents_get_agents ($filter = false, $fields = false,
$access = 'AR', $access = 'AR',
$order = array('field' => 'nombre', 'order' => 'ASC'), $order = array('field' => 'nombre', 'order' => 'ASC'),
$return = false) { $return = false,
$disabled_agent = 0) {
global $config; global $config;
@ -428,6 +429,13 @@ function agents_get_agents ($filter = false, $fields = false,
if ($where_nogroup == '') { if ($where_nogroup == '') {
$where_nogroup = '1 = 1'; $where_nogroup = '1 = 1';
} }
if ($disabled_agent == 1){
$disabled = 'disabled = 0';
}
else{
$disabled = '1 = 1';
}
$extra = false; $extra = false;
@ -438,12 +446,12 @@ function agents_get_agents ($filter = false, $fields = false,
} }
if ($extra) { if ($extra) {
$where = sprintf('(%s OR (%s)) AND (%s) AND (%s) %s', $where = sprintf('(%s OR (%s)) AND (%s) AND (%s) %s AND %s',
$sql_extra, $where, $where_nogroup, $status_sql, $search); $sql_extra, $where, $where_nogroup, $status_sql, $search, $disabled);
} }
else { else {
$where = sprintf('%s AND %s AND (%s) %s', $where = sprintf('%s AND %s AND (%s) %s AND %s',
$where, $where_nogroup, $status_sql, $search); $where, $where_nogroup, $status_sql, $search, $disabled);
} }
$sql = sprintf('SELECT %s $sql = sprintf('SELECT %s
FROM tagente FROM tagente

View File

@ -370,7 +370,7 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
$list['_monitors_alerts_fired_'] = tactical_monitor_fired_alerts (explode(',',$user_groups_ids), $user_strict,explode(',',$user_groups_ids)); $list['_monitors_alerts_fired_'] = tactical_monitor_fired_alerts (explode(',',$user_groups_ids), $user_strict,explode(',',$user_groups_ids));
$list['_monitors_alerts_'] = tactical_monitor_alerts (explode(',',$user_groups_ids), $user_strict,explode(',',$user_groups_ids)); $list['_monitors_alerts_'] = tactical_monitor_alerts (explode(',',$user_groups_ids), $user_strict,explode(',',$user_groups_ids));
$total_agentes = agents_get_agents (false, array('count(*) as total_agents'), 'AR',false, false); $total_agentes = agents_get_agents (false, array('count(*) as total_agents'), 'AR',false, false, 1);
$list['_total_agents_'] = $total_agentes[0]['total_agents']; $list['_total_agents_'] = $total_agentes[0]['total_agents'];
$list["_monitor_checks_"] = $list["_monitors_not_init_"] + $list["_monitors_unknown_"] + $list["_monitors_warning_"] + $list["_monitors_critical_"] + $list["_monitors_ok_"]; $list["_monitor_checks_"] = $list["_monitors_not_init_"] + $list["_monitors_unknown_"] + $list["_monitors_warning_"] + $list["_monitors_critical_"] + $list["_monitors_ok_"];