mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'ent-9233-Historico-de-traps-2' into 'develop'
show historical traps in snmp console See merge request artica/pandorafms!5235
This commit is contained in:
commit
8097001b19
@ -302,7 +302,7 @@ if (empty($all_address_agents)) {
|
|||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ttrap
|
FROM ttrap
|
||||||
WHERE (
|
WHERE (
|
||||||
`source` IN ('.implode(',', $address_by_user_groups).") OR
|
`source` IN ('.implode(',', $address_by_user_groups).") OR
|
||||||
`source`='' OR
|
`source`='' OR
|
||||||
@ -671,8 +671,17 @@ $filter_resume['group_by'] = $group_by;
|
|||||||
$filter_resume['hours_ago'] = $hours_ago;
|
$filter_resume['hours_ago'] = $hours_ago;
|
||||||
$filter_resume['trap_type'] = $trap_types[$trap_type];
|
$filter_resume['trap_type'] = $trap_types[$trap_type];
|
||||||
|
|
||||||
$traps = db_get_all_rows_sql($sql);
|
$traps = db_get_all_rows_sql($sql, true);
|
||||||
$trapcount = (int) db_get_value_sql($sql_count);
|
$trapcount = (int) db_get_value_sql($sql_count, false, true);
|
||||||
|
|
||||||
|
// Re-sort traps by timestamp if history db is enabled.
|
||||||
|
if ($config['history_db_enabled'] == 1) {
|
||||||
|
usort($traps, function($a, $b)
|
||||||
|
{
|
||||||
|
return strtotime($a['timestamp']) < strtotime($b['timestamp']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// No traps.
|
// No traps.
|
||||||
if (empty($traps)) {
|
if (empty($traps)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user