update info of state in events

This commit is contained in:
Daniel Maya 2017-09-22 15:01:17 +02:00
parent 07ba50e499
commit 4c4a89ecf1

View File

@ -3886,15 +3886,16 @@ function reporting_get_event_histogram_meta ($width) {
$user_groups_ids = array_keys($user_groups); $user_groups_ids = array_keys($user_groups);
if (empty($user_groups)) { if (empty($user_groups)) {
$groups_condition = ' 1 = 0 '; $groups_condition = ' AND 1 = 0 ';
} }
else { else {
$groups_condition = ' id_grupo IN (' . implode(',', $user_groups_ids) . ') '; $groups_condition = ' AND id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
} }
if (!check_acl ($config['id_user'], 0, "PM")) { if (!check_acl ($config['id_user'], 0, "PM")) {
$groups_condition .= " AND id_grupo != 0"; $groups_condition .= " AND id_grupo != 0";
} }
$status_condition = " AND estado = 0 ";
$cont = 0; $cont = 0;
for ($i = 0; $i < $interval; $i++) { for ($i = 0; $i < $interval; $i++) {
@ -3923,49 +3924,45 @@ function reporting_get_event_histogram_meta ($width) {
$full_legend[$cont] = $name; $full_legend[$cont] = $name;
$top = $datelimit + ($periodtime * ($i + 1)); $top = $datelimit + ($periodtime * ($i + 1));
$event = db_get_row_filter ('tmetaconsole_event',
array (
'utimestamp > '.$bottom,
'utimestamp < '.$top,
$groups_condition),
'criticity, utimestamp');
if (!empty($event['utimestamp'])) { $time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
$data[$cont]['utimestamp'] = $periodtime; $sql = sprintf('SELECT criticity,utimestamp
switch ($event['criticity']) { FROM tmetaconsole_event
case 0: WHERE %s %s %s
$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE; ORDER BY criticity DESC',
break; $time_condition, $groups_condition, $status_condition);
case 1:
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL; $events = db_get_all_rows_sql($sql);
break;
case 2: $events_criticity = array();
$data[$cont]['data'] = EVENT_CRIT_NORMAL; foreach ($events as $key => $value) {
break; array_push($events_criticity,$value['criticity']);
case 3: }
$data[$cont]['data'] = EVENT_CRIT_WARNING;
break; if (!empty($events)) {
case 4: if(array_search('4',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_CRITICAL; $data[$cont]['data'] = EVENT_CRIT_CRITICAL;
break; }else if (array_search('3',$events_criticity) !== false){
case 5: $data[$cont]['data'] = EVENT_CRIT_WARNING;
$data[$cont]['data'] = EVENT_CRIT_MINOR; }else if(array_search('6',$events_criticity) !== false){
break;
case 6:
$data[$cont]['data'] = EVENT_CRIT_MAJOR; $data[$cont]['data'] = EVENT_CRIT_MAJOR;
break; }else if(array_search('5',$events_criticity) !== false){
case 20: $data[$cont]['data'] = EVENT_CRIT_MINOR;
}else if(array_search('20',$events_criticity) !== false){
$data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL; $data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL;
break; }else if(array_search('34',$events_criticity) !== false){
case 34:
$data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL; $data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL;
break; }else if(array_search('2',$events_criticity) !== false){
default: $data[$cont]['data'] = EVENT_CRIT_NORMAL;
$data[$cont]['data'] = 1; }else if(array_search('0',$events_criticity) !== false){
break; $data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
}else {
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
} }
}
else { $data[$cont]['utimestamp'] = $periodtime;
} else {
$data[$cont]['utimestamp'] = $periodtime; $data[$cont]['utimestamp'] = $periodtime;
$data[$cont]['data'] = 1; $data[$cont]['data'] = 1;
} }