mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add global MIB association table
This commit is contained in:
@ -169,6 +169,8 @@ if ($_SESSION['userlevel'] >= '10') {
|
|||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
|
<li><a href='.generate_url(array('page'=>'mib_assoc')).'><i class="fa fa-file-text-o fa-fw fa-lg"></i> MIB associations</a></li>
|
||||||
|
<li role="presentation" class="divider"></li>
|
||||||
';
|
';
|
||||||
|
|
||||||
if ($config['navbar']['manage_groups']['hide'] === 0) {
|
if ($config['navbar']['manage_groups']['hide'] === 0) {
|
||||||
|
@ -22,14 +22,25 @@ $columns = array(
|
|||||||
'last_modified',
|
'last_modified',
|
||||||
);
|
);
|
||||||
|
|
||||||
$params = array(
|
if (isset($_POST['device_id'])) {
|
||||||
$_POST['device_id'],
|
// device_id supplied - get details for a single device
|
||||||
);
|
// used by device MIB page
|
||||||
|
$params = array(
|
||||||
// start of sql definition
|
$_POST['device_id'],
|
||||||
$sql = 'SELECT * FROM `device_mibs`';
|
);
|
||||||
|
$sql = 'SELECT * FROM `device_mibs`';
|
||||||
$wheresql = ' WHERE `device_id` = ?';
|
$wheresql = ' WHERE `device_id` = ?';
|
||||||
|
$sortcolumns = 3;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// device_id not supplied - get details for a all devices
|
||||||
|
// used by all device MIBs page
|
||||||
|
$params = array();
|
||||||
|
$sql = 'SELECT `d`.`hostname` as `hostname`, `dm`.* FROM `devices` `d`, `device_mibs` `dm`';
|
||||||
|
$wheresql = ' WHERE `d`.`device_id` = `dm`.`device_id`';
|
||||||
|
array_unshift($columns, 'hostname');
|
||||||
|
$sortcolumns = 4;
|
||||||
|
}
|
||||||
|
|
||||||
// all columns are searchable - search across them
|
// all columns are searchable - search across them
|
||||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||||
@ -45,9 +56,9 @@ if (empty($total)) {
|
|||||||
$total = 0;
|
$total = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort by first three columns by default
|
// set up default sort
|
||||||
if (!isset($sort) || empty($sort)) {
|
if (!isset($sort) || empty($sort)) {
|
||||||
$sort = implode(', ', array_map("quote_sql_word", array_slice($columns, 0, 3)));
|
$sort = implode(', ', array_map("quote_sql_word", array_slice($columns, 0, $sortcolumns)));
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY $sort";
|
$sql .= " ORDER BY $sort";
|
||||||
|
|
||||||
|
49
html/pages/mib_assoc.inc.php
Normal file
49
html/pages/mib_assoc.inc.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* LibreNMS global MIB association viewer
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||||
|
*
|
||||||
|
* Author: Paul Gear
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version. Please see LICENSE.txt at the top level of
|
||||||
|
* the source code distribution for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h4>MIB associations for all devices</h4>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="mibs" class="table table-hover table-condensed mibs">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-column-id="hostname">Hostname</th>
|
||||||
|
<th data-column-id="module">Module</th>
|
||||||
|
<th data-column-id="mib">MIB</th>
|
||||||
|
<th data-column-id="included_by">Included by</th>
|
||||||
|
<th data-column-id="last_modified">Last Modified</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var grid = $("#mibs").bootgrid({
|
||||||
|
ajax: true,
|
||||||
|
rowCount: [50,100,250,-1],
|
||||||
|
post: function ()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
id: "device_mibs",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
url: "/ajax_table.php",
|
||||||
|
formatters: {
|
||||||
|
},
|
||||||
|
templates: {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
Reference in New Issue
Block a user