mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updated discovery to log new type + updated eventlog page to show this
This commit is contained in:
@@ -20,6 +20,8 @@ var grid = $("#eventlog").bootgrid({
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
id: "eventlog",
|
id: "eventlog",
|
||||||
|
device: "' .mres($vars['device']) .'",
|
||||||
|
type: "' .mres($vars['type']) .'",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
url: "/ajax_table.php"
|
url: "/ajax_table.php"
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ if (is_numeric($_POST['device'])) {
|
|||||||
$param[] = $_POST['device'];
|
$param[] = $_POST['device'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($_POST['type'])) {
|
||||||
|
$where .= ' AND `E`.`type` = ?';
|
||||||
|
$param[] = $_POST['type'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($_POST['string']) {
|
if ($_POST['string']) {
|
||||||
$where .= ' AND E.message LIKE ?';
|
$where .= ' AND E.message LIKE ?';
|
||||||
$param[] = '%'.$_POST['string'].'%';
|
$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>';
|
$type = '<b>'.generate_port_link($this_if, makeshortif(strtolower($this_if['label']))).'</b>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$type = 'System';
|
$type = $eventlog['type'];;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response[] = array(
|
$response[] = array(
|
||||||
|
|||||||
@@ -37,6 +37,25 @@ print_optionbar_start();
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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>
|
<button type="submit" class="btn btn-default input-sm">Filter</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ function discover_new_device($hostname, $device='', $method='', $interface='') {
|
|||||||
$extra_log = ' (port '.$int['label'].') ';
|
$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 {
|
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;
|
return $remote_device_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user