mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
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:
commit
999162f380
@ -145,10 +145,22 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
|
|||||||
else {
|
else {
|
||||||
$temp = array();
|
$temp = array();
|
||||||
foreach ($type as $item) {
|
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) {
|
if ($agents == null) {
|
||||||
@ -160,14 +172,11 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
|
|||||||
else {
|
else {
|
||||||
$idAgents = array_values($agents);
|
$idAgents = array_values($agents);
|
||||||
|
|
||||||
if($type=='alert_fired'){
|
|
||||||
$idAgents = array_keys($agents);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_get_all_rows_sql('SELECT id_evento
|
$result = db_get_all_rows_sql('SELECT id_evento
|
||||||
FROM tevento
|
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');
|
ORDER BY id_evento DESC LIMIT 1');
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
@ -139,7 +139,7 @@ if (is_ajax ()) {
|
|||||||
$alert = get_parameter('alert_fired');
|
$alert = get_parameter('alert_fired');
|
||||||
if ($alert == 'true') {
|
if ($alert == 'true') {
|
||||||
$resultAlert = alerts_get_event_status_group($idGroup,
|
$resultAlert = alerts_get_event_status_group($idGroup,
|
||||||
'alert_fired', $query, $agents);
|
array('alert_fired','alert_ceased'), $query, $agents);
|
||||||
}
|
}
|
||||||
$critical = get_parameter('critical');
|
$critical = get_parameter('critical');
|
||||||
if ($critical == 'true') {
|
if ($critical == 'true') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user