mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Merge pull request #2536 from paulgear/mib-poller-alpha2
MIB-based poller alpha2
This commit is contained in:
@@ -49,6 +49,13 @@ if ($device['serial']) {
|
||||
</tr>';
|
||||
}
|
||||
|
||||
if ($device['sysObjectID']) {
|
||||
echo '<tr>
|
||||
<td>Object ID</td>
|
||||
<td>'.$device['sysObjectID'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
if ($device['sysContact']) {
|
||||
echo '<tr>
|
||||
<td>Contact</td>';
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS custom graphing
|
||||
*
|
||||
* Author: Paul Gear
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// FIXME: Dummy implementation which only supports ruckuswireless processor & mempool
|
||||
|
||||
$i = 0;
|
||||
$rrd_list = array();
|
||||
if ($subtype == 'processor') {
|
||||
$rrd_list[0] = array(
|
||||
'area' => 1,
|
||||
'ds' => 'mibval',
|
||||
'descr' => 'CPU Utilization',
|
||||
'filename' => rrd_name($device['hostname'], array('ruckusZDSystemStats-CPUUtil-0')),
|
||||
);
|
||||
}
|
||||
|
||||
if ($subtype == 'mempool') {
|
||||
$rrd_list[0] = array(
|
||||
'area' => 1,
|
||||
'ds' => 'mibval',
|
||||
'descr' => 'Memory Utilization',
|
||||
'filename' => rrd_name($device['hostname'], array('ruckusZDSystemStats-MemoryUtil-0')),
|
||||
);
|
||||
}
|
||||
|
||||
$units = '%%';
|
||||
$colours = 'mixed';
|
||||
$scale_min = '0';
|
||||
$scale_max = '100';
|
||||
$nototal = 1;
|
||||
|
||||
require_once 'includes/graphs/generic_multi_line.inc.php';
|
||||
@@ -13,25 +13,35 @@
|
||||
*/
|
||||
|
||||
$rrd_list = array();
|
||||
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
|
||||
foreach (glob($prefix.'*.rrd') as $filename) {
|
||||
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
|
||||
$filenames = glob($prefix."*.rrd");
|
||||
$count = count($filenames);
|
||||
foreach ($filenames as $filename) {
|
||||
// find out what * expanded to
|
||||
$globpart = str_replace($prefix, '', $filename);
|
||||
// take off the prefix
|
||||
$instance = substr($globpart, 0, -4);
|
||||
// take off ".rrd"
|
||||
$globpart = str_replace($prefix, '', $filename); // take off the prefix
|
||||
$instance = substr($globpart, 0, -4); // take off ".rrd"
|
||||
$ds = array();
|
||||
$mibparts = explode('-', $subtype);
|
||||
$mibvar = end($mibparts);
|
||||
$ds['ds'] = name_shorten($mibvar);
|
||||
$ds['ds'] = 'mibval';
|
||||
$ds['descr'] = "$mibvar-$instance";
|
||||
$ds['filename'] = $filename;
|
||||
$rrd_list[] = $ds;
|
||||
}
|
||||
|
||||
$colours = 'mixed';
|
||||
$scale_min = '0';
|
||||
$nototal = 0;
|
||||
$simple_rrd = true;
|
||||
|
||||
require 'includes/graphs/generic_multi_line.inc.php';
|
||||
// If there are multiple matching files, use a stacked graph instead of a line graph
|
||||
if ($count > 1) {
|
||||
$nototal = 1;
|
||||
$divider = $count;
|
||||
$text_orig = 1;
|
||||
$colours = 'manycolours';
|
||||
include "includes/graphs/generic_multi_simplex_seperated.inc.php";
|
||||
}
|
||||
else {
|
||||
$colours = 'mixed';
|
||||
$nototal = 0;
|
||||
include "includes/graphs/generic_multi_line.inc.php";
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ foreach ($procs as $proc) {
|
||||
|
||||
$unit_text = 'Load %';
|
||||
|
||||
$units = '%';
|
||||
$units = '';
|
||||
$total_units = '%';
|
||||
$colours = 'mixed';
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ foreach ($rrd_list as $rrd) {
|
||||
}
|
||||
|
||||
$colour = $config['graph_colours'][$colours][$iter];
|
||||
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
|
||||
$rrd['areacolour'] = $colour."20";
|
||||
}
|
||||
|
||||
$ds = $rrd['ds'];
|
||||
$filename = $rrd['filename'];
|
||||
@@ -69,8 +72,8 @@ foreach ($rrd_list as $rrd) {
|
||||
}
|
||||
}
|
||||
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.2lf%s GPRINT:'.$id.'min:MIN:%5.2lf%s';
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s GPRINT:'.$id.":AVERAGE:'%5.2lf%s\\n'";
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.2lf%s'.$units.' GPRINT:'.$id.'min:MIN:%5.2lf%s'.$units;
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
|
||||
|
||||
$i++;
|
||||
$iter++;
|
||||
|
||||
@@ -43,12 +43,15 @@ if ($auth !== true && $auth != 1) {
|
||||
|
||||
require $config['install_dir']."/html/includes/graphs/$type/auth.inc.php";
|
||||
|
||||
if ($auth === true && is_file($config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
include $config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php";
|
||||
if ($auth === true && is_custom_graph($type, $subtype, $device)) {
|
||||
include($config['install_dir'] . "/html/includes/graphs/custom.inc.php");
|
||||
}
|
||||
else if ($auth === true && is_mib_graph($type, $subtype)) {
|
||||
include $config['install_dir']."/html/includes/graphs/$type/mib.inc.php";
|
||||
}
|
||||
elseif ($auth === true && is_file($config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php")) {
|
||||
include $config['install_dir']."/html/includes/graphs/$type/$subtype.inc.php";
|
||||
}
|
||||
else {
|
||||
graph_error("$type*$subtype ");
|
||||
// Graph Template Missing");
|
||||
|
||||
@@ -110,6 +110,8 @@ if ( dbFetchCell("SELECT 1 from `packages` LIMIT 1") ) {
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv6'))); ?>"><i class="fa fa-search fa-fw fa-lg"></i> IPv6 Search</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'mac'))); ?>"><i class="fa fa-search fa-fw fa-lg"></i> MAC Search</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'arp'))); ?>"><i class="fa fa-search fa-fw fa-lg"></i> ARP Tables</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'mibs'))); ?>"><i class="fa fa-file-text-o fa-fw fa-lg"></i> MIB definitions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -167,6 +169,8 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
}
|
||||
echo '
|
||||
<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) {
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS device MIB association browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* by Paul Gear
|
||||
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$columns = array(
|
||||
'module',
|
||||
'mib',
|
||||
'included_by',
|
||||
'last_modified',
|
||||
);
|
||||
|
||||
if (isset($_POST['device_id'])) {
|
||||
// device_id supplied - get details for a single device
|
||||
// used by device MIB page
|
||||
$params = array(
|
||||
$_POST['device_id'],
|
||||
);
|
||||
$sql = 'SELECT * FROM `device_mibs`';
|
||||
$wheresql = ' WHERE `device_id` = ?';
|
||||
$sortcolumns = 3;
|
||||
$count_sql = "SELECT COUNT(*) FROM `device_mibs`".$wheresql;
|
||||
}
|
||||
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;
|
||||
$count_sql = "SELECT COUNT(*) FROM `devices` `d`, `device_mibs` `dm`".$wheresql;
|
||||
}
|
||||
|
||||
// all columns are searchable - search across them
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||
$wheresql .= " AND ( $searchsql )";
|
||||
}
|
||||
$sql .= $wheresql;
|
||||
|
||||
// get total
|
||||
$total = dbFetchCell($count_sql, $params);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// set up default sort
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = implode(', ', array_map("mres", array_slice($columns, 0, $sortcolumns)));
|
||||
}
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
// select only the required rows
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
// load data from database into response array
|
||||
$response = array();
|
||||
foreach (dbFetchRows($sql, $params) as $mib) {
|
||||
$mibrow = array();
|
||||
foreach ($columns as $col) {
|
||||
$mibrow[$col] = $mib[$col];
|
||||
}
|
||||
if (!isset($_POST['device_id'])) {
|
||||
$device = device_by_id_cache($mib['device_id']);
|
||||
$mibrow['hostname'] = generate_device_link($device,
|
||||
$mib['hostname'], array('tab' => 'mib'));
|
||||
}
|
||||
$response[] = $mibrow;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS device MIB OID browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* by Paul Gear
|
||||
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$columns = array(
|
||||
'module',
|
||||
'mib',
|
||||
'object_type',
|
||||
'oid',
|
||||
'value',
|
||||
'numvalue',
|
||||
'last_modified',
|
||||
);
|
||||
|
||||
|
||||
$params = array(
|
||||
$_POST['device_id'],
|
||||
);
|
||||
|
||||
// start of sql definition
|
||||
$sql = 'SELECT * FROM `device_oids`';
|
||||
|
||||
$wheresql = ' WHERE `device_id` = ?';
|
||||
|
||||
// all columns are searchable - search across them
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||
$wheresql .= " AND ( $searchsql )";
|
||||
}
|
||||
$sql .= $wheresql;
|
||||
|
||||
// get total
|
||||
$count_sql = "SELECT COUNT(*) FROM `device_oids`".$wheresql;
|
||||
$total = dbFetchCell($count_sql, $params);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// sort by first three columns by default
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = implode(', ', array_map("mres", array_slice($columns, 0, 3)));
|
||||
}
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
// select only the required rows
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
// load data from database into response array
|
||||
$response = array();
|
||||
foreach (dbFetchRows($sql, $params) as $mib) {
|
||||
$mibrow = array();
|
||||
foreach ($columns as $col) {
|
||||
$mibrow[$col] = $mib[$col];
|
||||
}
|
||||
$response[] = $mibrow;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS MIB definition browser
|
||||
*
|
||||
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
|
||||
*
|
||||
* by Paul Gear
|
||||
* based on code by Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* in commit 054bf3ae209f34a2c3bc8968300722004903df1b
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$columns = array(
|
||||
'module',
|
||||
'mib',
|
||||
'object_type',
|
||||
'oid',
|
||||
'syntax',
|
||||
'description',
|
||||
'max_access',
|
||||
'status',
|
||||
'included_by',
|
||||
'last_modified',
|
||||
);
|
||||
|
||||
|
||||
// start of sql definition
|
||||
$sql = 'SELECT * FROM `mibdefs`';
|
||||
|
||||
// all columns are searchable - search across them
|
||||
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||
$searchsql = implode(' OR ', array_map("search_phrase_column", array_map("mres", $columns)));
|
||||
$wheresql .= " WHERE ( $searchsql )";
|
||||
$sql .= $wheresql;
|
||||
}
|
||||
|
||||
// get total
|
||||
$count_sql = "SELECT COUNT(`object_type`) FROM `mibdefs`".$wheresql;
|
||||
$total = dbFetchCell($count_sql);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// sort by first three columns by default
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = implode(', ', array_map("mres", array_slice($columns, 0, 3)));
|
||||
}
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
// select only the required rows
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
// load data from database into response array
|
||||
$response = array();
|
||||
foreach (dbFetchRows($sql) as $mib) {
|
||||
$mibrow = array();
|
||||
foreach ($columns as $col) {
|
||||
$mibrow[$col] = $mib[$col];
|
||||
}
|
||||
$response[] = $mibrow;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
||||
@@ -57,7 +57,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
$health = (dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(*) FROM mempools WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '".$device['device_id']."'"));
|
||||
$health = dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
dbFetchCell("SELECT COUNT(*) FROM mempools WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '" . $device['device_id'] . "'") +
|
||||
count_mib_health($device);
|
||||
|
||||
if ($health) {
|
||||
echo '<li class="'.$select['health'].'">
|
||||
@@ -367,6 +371,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
if (device_permitted($device['device_id'])) {
|
||||
echo '<li class="'.$select['mib'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'mib')).'">
|
||||
<i class="fa fa-file-text-o"></i> MIB
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
|
||||
echo '<li style="float: right;"><a href="https://'.$device['hostname'].'"><img src="images/16/http.png" alt="https" title="Launch browser to https://'.$device['hostname'].'" border="0" width="16" height="16" target="_blank"></a></li>
|
||||
<li style="float: right;"><a href="ssh://'.$device['hostname'].'"><img src="images/16/ssh.png" alt="ssh" title="SSH to '.$device['hostname'].'" border="0" width="16" height="16"></a></li>
|
||||
|
||||
@@ -22,11 +22,7 @@ foreach (dbFetchRows('SELECT * FROM device_graphs WHERE device_id = ? ORDER BY g
|
||||
}
|
||||
}
|
||||
|
||||
// These are standard graphs we should have for all systems
|
||||
$graph_enable['poller']['poller_perf'] = 'device_poller_perf';
|
||||
if (can_ping_device($attribs) === true) {
|
||||
$graph_enable['poller']['ping_perf'] = 'device_ping_perf';
|
||||
}
|
||||
enable_graphs($device, $graph_enable);
|
||||
|
||||
$sep = '';
|
||||
foreach ($graph_enable as $section => $nothing) {
|
||||
@@ -56,7 +52,6 @@ print_optionbar_end();
|
||||
|
||||
$graph_enable = $graph_enable[$vars['group']];
|
||||
|
||||
// foreach ($config['graph_types']['device'] as $graph => $entry)
|
||||
foreach ($graph_enable as $graph => $entry) {
|
||||
$graph_array = array();
|
||||
if ($graph_enable[$graph]) {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/ucd_cpu.rrd')) {
|
||||
$graph_title = 'Processor Utilisation';
|
||||
$graph_type = 'device_cpu';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/hrSystem.rrd')) {
|
||||
$graph_title = 'Running Processes';
|
||||
$graph_type = 'device_hrprocesses';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/hrSystem.rrd')) {
|
||||
$graph_title = 'Users Logged On';
|
||||
$graph_type = 'device_hrusers';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/ipSystemStats-ipv6.rrd')) {
|
||||
$graph_title = 'IPv6 IP Packet Statistics';
|
||||
$graph_type = 'device_ipSystemStats_v6';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'IPv6 IP Fragmentation Statistics';
|
||||
$graph_type = 'device_ipSystemStats_v6_frag';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/ipSystemStats-ipv4.rrd')) {
|
||||
$graph_title = 'IPv4 IP Packet Statistics';
|
||||
$graph_type = 'device_ipSystemStats_v4';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-ip.rrd')) {
|
||||
$graph_title = 'IP Statistics';
|
||||
$graph_type = 'device_ip';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'IP Fragmented Statistics';
|
||||
$graph_type = 'device_ip_fragmented';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-tcp.rrd')) {
|
||||
$graph_title = 'TCP Statistics';
|
||||
$graph_type = 'device_tcp';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-udp.rrd')) {
|
||||
$graph_title = 'UDP Statistics';
|
||||
$graph_type = 'device_udp';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-snmp.rrd')) {
|
||||
$graph_title = 'SNMP Packets Statistics';
|
||||
$graph_type = 'device_snmp_packets';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'SNMP Message Type Statistics';
|
||||
$graph_type = 'device_snmp_statistics';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-icmp.rrd')) {
|
||||
$graph_title = 'ICMP Statistics';
|
||||
$graph_type = 'device_icmp';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'ICMP Informational Statistics';
|
||||
$graph_type = 'device_icmp_informational';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-icmp.rrd')) {
|
||||
$graph_title = 'ICMP Informational Statistics';
|
||||
$graph_type = 'device_icmp_informational';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/netstats-snmp.rrd')) {
|
||||
$graph_title = 'SNMP Packets Statistics';
|
||||
$graph_type = 'device_snmp_packets';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
|
||||
$graph_title = 'SNMP Message Type Statistics';
|
||||
$graph_type = 'device_snmp_statistics';
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_title = 'Device Uptime';
|
||||
$graph_type = 'device_uptime';
|
||||
|
||||
require 'includes/print-device-graph.php';
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
$storage = dbFetchCell('select count(*) from storage WHERE device_id = ?', array($device['device_id']));
|
||||
$diskio = dbFetchCell('select count(*) from ucd_diskio WHERE device_id = ?', array($device['device_id']));
|
||||
$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id']));
|
||||
$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id']));
|
||||
$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id'])) + count_mib_mempools($device);
|
||||
$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id'])) + count_mib_processors($device);
|
||||
|
||||
$charge = dbFetchCell("select count(*) from sensors WHERE sensor_class='charge' AND device_id = ?", array($device['device_id']));
|
||||
$temperatures = dbFetchCell("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = ?", array($device['device_id']));
|
||||
|
||||
@@ -4,8 +4,16 @@ $graph_type = 'mempool_usage';
|
||||
|
||||
$i = '1';
|
||||
|
||||
if (count_mib_mempools($device) > 0) {
|
||||
$mempools = get_mib_mempools($device);
|
||||
$graph_type = 'device_mempool';
|
||||
}
|
||||
else {
|
||||
$mempools = dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($device['device_id']));
|
||||
}
|
||||
|
||||
// FIXME css alternating colours
|
||||
foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($device['device_id'])) as $mempool) {
|
||||
foreach ($mempools as $mempool) {
|
||||
if (!is_integer($i / 2)) {
|
||||
$row_colour = $list_colour_a;
|
||||
}
|
||||
@@ -15,30 +23,49 @@ foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($devi
|
||||
|
||||
$text_descr = rewrite_entity_descr($mempool['mempool_descr']);
|
||||
|
||||
$mempool_url = 'graphs/id='.$mempool['mempool_id'].'/type=mempool_usage/';
|
||||
$mini_url = 'graph.php?id='.$mempool['mempool_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=f4f4f4';
|
||||
if ($graph_type == 'device_mempool') {
|
||||
$id = 'device';
|
||||
$val = $device['device_id'];
|
||||
}
|
||||
else {
|
||||
$id = 'id';
|
||||
$val = $mempool['mempool_id'];
|
||||
}
|
||||
$mempool_url = 'graphs/'.$id.'='.$val.'/type='.$graph_type.'/';
|
||||
$mini_url = 'graph.php?'.$id.'='.$val.'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=f4f4f4';
|
||||
|
||||
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname'].' - '.$text_descr;
|
||||
$mempool_popup .= "</div><img src=\'graph.php?id=".$mempool['mempool_id'].'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now']."&width=400&height=125\'>";
|
||||
$mempool_popup .= "</div><img src=\'graph.php?'.$id.'=".$val.'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now']."&width=400&height=125\'>";
|
||||
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
|
||||
|
||||
$total = formatStorage($mempool['mempool_total']);
|
||||
$used = formatStorage($mempool['mempool_used']);
|
||||
$free = formatStorage($mempool['mempool_free']);
|
||||
|
||||
$perc = round(($mempool['mempool_used'] / $mempool['mempool_total'] * 100));
|
||||
// don't bother recalculating if mempools use percentage
|
||||
if ($mempool['percentage'] === true) {
|
||||
$perc = round($mempool['mempool_used']);
|
||||
}
|
||||
else {
|
||||
$perc = round(($mempool['mempool_used'] / $mempool['mempool_total'] * 100));
|
||||
}
|
||||
|
||||
$background = get_percentage_colours($percent);
|
||||
$right_background = $background['right'];
|
||||
$left_background = $background['left'];
|
||||
|
||||
$graph_array['id'] = $mempool['mempool_id'];
|
||||
$graph_array[$id] = $val;
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo "<div class='panel panel-default'>
|
||||
<div class='panel-heading'>
|
||||
<h3 class='panel-title'>$text_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>
|
||||
</div>";
|
||||
<div class='panel-heading'>";
|
||||
if ($mempool['percentage'] === true) {
|
||||
echo " <h3 class='panel-title'>$text_descr <div class='pull-right'>$perc% used</div></h3>";
|
||||
}
|
||||
else {
|
||||
echo " <h3 class='panel-title'>$text_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>";
|
||||
}
|
||||
echo " </div>";
|
||||
echo "<div class='panel-body'>";
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo "</div></div>";
|
||||
|
||||
@@ -3,21 +3,36 @@
|
||||
$graph_type = 'processor_usage';
|
||||
|
||||
$i = '1';
|
||||
foreach (dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($device['device_id'])) as $proc) {
|
||||
$proc_url = 'graphs/id='.$proc['processor_id'].'/type=processor_usage/';
|
||||
|
||||
$mini_url = 'graph.php?id='.$proc['processor_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=80&height=20&bg=f4f4f4';
|
||||
if (count_mib_processors($device) > 0) {
|
||||
$processors = get_mib_processors($device);
|
||||
$graph_type = 'device_processor';
|
||||
}
|
||||
else {
|
||||
$processors = dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($device['device_id']));
|
||||
}
|
||||
|
||||
$text_descr = $proc['processor_descr'];
|
||||
foreach ($processors as $proc) {
|
||||
if ($graph_type == 'device_processor') {
|
||||
$id = 'device';
|
||||
$val = $device['device_id'];
|
||||
}
|
||||
else {
|
||||
$id = 'id';
|
||||
$val = $proc['processor_id'];
|
||||
}
|
||||
$proc_url = 'graphs/'.$id.'='.$val.'/type='.$graph_type.'/';
|
||||
$base_url = 'graph.php?'.$id.'='.$val.'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'];
|
||||
$mini_url = $base_url.'&width=80&height=20&bg=f4f4f4';
|
||||
|
||||
$text_descr = rewrite_entity_descr($text_descr);
|
||||
$text_descr = rewrite_entity_descr($proc['processor_descr']);
|
||||
|
||||
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname'].' - '.$text_descr;
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=".$proc['processor_id'].'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now']."&width=400&height=125\'>";
|
||||
$proc_popup .= "</div><img src=\'".$base_url."&width=400&height=125\'>";
|
||||
$proc_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
|
||||
$percent = round($proc['processor_usage']);
|
||||
|
||||
$graph_array['id'] = $proc['processor_id'];
|
||||
$graph_array[$id] = $val;
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo "<div class='panel panel-default'>
|
||||
@@ -27,4 +42,4 @@ foreach (dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($de
|
||||
echo "<div class='panel-body'>";
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo "</div></div>";
|
||||
}//end foreach
|
||||
}//end foreach
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS device MIB browser
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
if (!isset($vars['section'])) {
|
||||
$vars['section'] = "mib";
|
||||
}
|
||||
?>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> Device MIB associations</h4>
|
||||
<div class="table-responsive">
|
||||
<table id="mibs" class="table table-hover table-condensed mibs">
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> Device MIB values</h4>
|
||||
<div class="table-responsive">
|
||||
<table id="oids" class="table table-hover table-condensed mibs">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="module">Module</th>
|
||||
<th data-column-id="mib">MIB</th>
|
||||
<th data-column-id="object_type">Object type</th>
|
||||
<th data-column-id="oid">OID</th>
|
||||
<th data-column-id="value">Value</th>
|
||||
<th data-column-id="numvalue">Numeric Value</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",
|
||||
device_id: '<?php echo htmlspecialchars($device['device_id']); ?>',
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var grid2 = $("#oids").bootgrid({
|
||||
ajax: true,
|
||||
rowCount: [50,100,250,-1],
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "device_oids",
|
||||
device_id: '<?php echo htmlspecialchars($device['device_id']); ?>',
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS global MIB 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><i class="fa fa-file-text-o"></i> All MIB definitions</h4>
|
||||
<div class="table-responsive">
|
||||
<table id="mibs" class="table table-hover table-condensed mibs">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="module">Module</th>
|
||||
<th data-column-id="mib">MIB</th>
|
||||
<th data-column-id="object_type">Object Type</th>
|
||||
<th data-column-id="oid">Object Id</th>
|
||||
<th data-column-id="syntax">Syntax</th>
|
||||
<th data-column-id="description">Description</th>
|
||||
<!-- th data-column-id="max_access">Maximum Access</th>
|
||||
<th data-column-id="status">Status</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: "mibs",
|
||||
view: '<?php echo $vars['view']; ?>'
|
||||
};
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
},
|
||||
templates: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user