Merge branch '38-no-funciona-event-alerts-sobre-alertas-de-snmp-traps-integria-4383' into 'develop'

Alert in sound console with snmp alerts events - #38

See merge request !291
This commit is contained in:
vgilc 2017-04-07 12:50:31 +02:00
commit 999162f380
2 changed files with 16 additions and 7 deletions

View File

@ -145,10 +145,22 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
else {
$temp = array();
foreach ($type as $item) {
$temp[] = '"' . $item . '"';
array_push ( $temp , $item );
}
$typeWhere = ' AND event_type IN (' . implode(',', $temp) . ')';
$typeWhere = ' AND event_type IN (';
foreach ($temp as $ele) {
$typeWhere .= "'".$ele."'";
if($ele != end($temp)){
$typeWhere .= ",";
}
}
$typeWhere .= ')';
}
if ($agents == null) {
@ -160,14 +172,11 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
else {
$idAgents = array_values($agents);
if($type=='alert_fired'){
$idAgents = array_keys($agents);
}
}
$result = db_get_all_rows_sql('SELECT id_evento
FROM tevento
WHERE estado = 0 AND id_agente IN (' . implode(',', $idAgents) . ') ' . $typeWhere . $query . '
WHERE estado = 0 AND id_agente IN (0,' . implode(',', $idAgents) . ') ' . $typeWhere . $query . '
ORDER BY id_evento DESC LIMIT 1');
if ($result === false) {

View File

@ -139,7 +139,7 @@ if (is_ajax ()) {
$alert = get_parameter('alert_fired');
if ($alert == 'true') {
$resultAlert = alerts_get_event_status_group($idGroup,
'alert_fired', $query, $agents);
array('alert_fired','alert_ceased'), $query, $agents);
}
$critical = get_parameter('critical');
if ($critical == 'true') {