From 746c52046bc740e9e004e1589917c356a65c30f3 Mon Sep 17 00:00:00 2001 From: laf Date: Wed, 5 Aug 2015 20:05:45 +0000 Subject: [PATCH] Updated discovery to log new type + updated eventlog page to show this --- html/includes/common/eventlog.inc.php | 2 ++ html/includes/table/eventlog.inc.php | 7 ++++++- html/pages/eventlog.inc.php | 19 +++++++++++++++++++ includes/discovery/functions.inc.php | 4 ++-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/html/includes/common/eventlog.inc.php b/html/includes/common/eventlog.inc.php index 9cce9daca7..91a1fd8b1f 100644 --- a/html/includes/common/eventlog.inc.php +++ b/html/includes/common/eventlog.inc.php @@ -20,6 +20,8 @@ var grid = $("#eventlog").bootgrid({ { return { id: "eventlog", + device: "' .mres($vars['device']) .'", + type: "' .mres($vars['type']) .'", }; }, url: "/ajax_table.php" diff --git a/html/includes/table/eventlog.inc.php b/html/includes/table/eventlog.inc.php index 9cae422965..797b71d777 100644 --- a/html/includes/table/eventlog.inc.php +++ b/html/includes/table/eventlog.inc.php @@ -7,6 +7,11 @@ if (is_numeric($_POST['device'])) { $param[] = $_POST['device']; } +if (!empty($_POST['type'])) { + $where .= ' AND `E`.`type` = ?'; + $param[] = $_POST['type']; +} + if ($_POST['string']) { $where .= ' AND E.message LIKE ?'; $param[] = '%'.$_POST['string'].'%'; @@ -54,7 +59,7 @@ foreach (dbFetchRows($sql, $param) as $eventlog) { $type = ''.generate_port_link($this_if, makeshortif(strtolower($this_if['label']))).''; } else { - $type = 'System'; + $type = $eventlog['type'];; } $response[] = array( diff --git a/html/pages/eventlog.inc.php b/html/pages/eventlog.inc.php index f33a2cb888..b2b5d7425b 100644 --- a/html/pages/eventlog.inc.php +++ b/html/pages/eventlog.inc.php @@ -37,6 +37,25 @@ print_optionbar_start(); ?> +
+ + +
diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 233afbf396..c5177ff22d 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -67,10 +67,10 @@ function discover_new_device($hostname, $device='', $method='', $interface='') { $extra_log = ' (port '.$int['label'].') '; } - log_event('Device $'.$remote_device['hostname']." ($ip) $extra_log autodiscovered through $method on ".$device['hostname'], $remote_device_id, 'system'); + log_event('Device $'.$remote_device['hostname']." ($ip) $extra_log autodiscovered through $method on ".$device['hostname'], $remote_device_id, 'discovery'); } else { - log_event("$method discovery of ".$remote_device['hostname']." ($ip) failed - check ping and SNMP access", $device['device_id'], 'system'); + log_event("$method discovery of ".$remote_device['hostname']." ($ip) failed - check ping and SNMP access", $device['device_id'], 'discovery'); } return $remote_device_id;