Updated discovery to log new type + updated eventlog page to show this

This commit is contained in:
laf
2015-08-05 20:05:45 +00:00
parent 2537767f2d
commit 746c52046b
4 changed files with 29 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ var grid = $("#eventlog").bootgrid({
{
return {
id: "eventlog",
device: "' .mres($vars['device']) .'",
type: "' .mres($vars['type']) .'",
};
},
url: "/ajax_table.php"

View File

@@ -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 = '<b>'.generate_port_link($this_if, makeshortif(strtolower($this_if['label']))).'</b>';
}
else {
$type = 'System';
$type = $eventlog['type'];;
}
$response[] = array(

View File

@@ -37,6 +37,25 @@ print_optionbar_start();
?>
</select>
</div>
<div class="form-group">
<label>
<strong>Type: </strong>
</label>
<select name="type" id="type" class="form-control input-sm">
<option value="">All types</option>
<?php
foreach (dbFetchRows("SELECT `type` FROM `eventlog` GROUP BY `type`") as $types) {
echo '<option value="'.$types['type'].'"';
if ($types['type'] === $_POST['type']) {
echo ' selected';
}
echo '>'.$types['type'].'</option>';
}
?>
</select>
</div>
<button type="submit" class="btn btn-default input-sm">Filter</button>
</form>

View File

@@ -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;