mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Merge pull request #2706 from paulgear/mib-poller-display
Don't display MIB poller menu items if MIB polling is disabled
This commit is contained in:
@@ -34,7 +34,7 @@ enabling MIB-based polling on my test Ruckus ZD1000 wireless controller with
|
||||
one (1) AP and one (1) user on that AP resulted in a 5 MB increase in RRD
|
||||
space usage for that device. Each RRD file is around 125 KB in size (on
|
||||
x64-64 systems) and is pre-allocated, so after the first discovery and poller
|
||||
run of each devicewith MIB-based polling enabled, disk space should be stable.
|
||||
run of each device with MIB-based polling enabled, disk space should be stable.
|
||||
However, monitoring disk usage is your responsibility. (The good news: you
|
||||
can do this with LibreNMS. :-)
|
||||
|
||||
|
||||
@@ -110,8 +110,14 @@ 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>
|
||||
<?php
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -168,10 +174,13 @@ if ($_SESSION['userlevel'] >= '10') {
|
||||
');
|
||||
}
|
||||
echo '
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation" class="divider"></li>';
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
echo '
|
||||
<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) {
|
||||
echo '<li><a href="'.generate_url(array('page'=>'device-groups')).'"><i class="fa fa-th fa-fw fa-lg"></i> Manage Groups</a></li>';
|
||||
|
||||
@@ -371,7 +371,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
if (device_permitted($device['device_id'])) {
|
||||
if (device_permitted($device['device_id']) && is_mib_poller_enabled($device)) {
|
||||
echo '<li class="'.$select['mib'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'mib')).'">
|
||||
<i class="fa fa-file-text-o"></i> MIB
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
if (!isset($vars['section'])) {
|
||||
$vars['section'] = "mib";
|
||||
}
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> Device MIB associations</h4>
|
||||
@@ -86,3 +87,8 @@ if (!isset($vars['section'])) {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
print_mib_poller_disabled();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
||||
<h4>MIB associations for all devices</h4>
|
||||
@@ -47,3 +48,8 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
print_mib_poller_disabled();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
||||
<h4><i class="fa fa-file-text-o"></i> All MIB definitions</h4>
|
||||
@@ -52,3 +54,8 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
print_mib_poller_disabled();
|
||||
}
|
||||
|
||||
+32
-5
@@ -737,12 +737,31 @@ function round_Nth($val = 0, $round_to) {
|
||||
} // end round_Nth
|
||||
|
||||
|
||||
/*
|
||||
* @return true if this device should be polled with MIB-based discovery
|
||||
*/
|
||||
function is_mib_poller_enabled($device)
|
||||
{
|
||||
if (!is_module_enabled('poller', 'mib')) {
|
||||
d_echo("MIB polling module disabled globally.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_dev_attrib_enabled($device, 'poll_mib')) {
|
||||
d_echo('MIB module disabled for '.$device['hostname']."\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // is_mib_poller_enabled
|
||||
|
||||
|
||||
/*
|
||||
* FIXME: Dummy implementation
|
||||
*/
|
||||
function count_mib_mempools($device)
|
||||
{
|
||||
if ($device['os'] == 'ruckuswireless') {
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -754,7 +773,7 @@ function count_mib_mempools($device)
|
||||
*/
|
||||
function count_mib_processors($device)
|
||||
{
|
||||
if ($device['os'] == 'ruckuswireless') {
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -780,7 +799,7 @@ function get_mibval($device, $oid)
|
||||
function get_mib_mempools($device)
|
||||
{
|
||||
$mempools = array();
|
||||
if ($device['os'] == 'ruckuswireless') {
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
$mempool = array();
|
||||
$mibvals = get_mibval($device, '.1.3.6.1.4.1.25053.1.2.1.1.1.15.14.0');
|
||||
$mempool['mempool_descr'] = $mibvals['object_type'];
|
||||
@@ -801,7 +820,7 @@ function get_mib_mempools($device)
|
||||
function get_mib_processors($device)
|
||||
{
|
||||
$processors = array();
|
||||
if ($device['os'] == 'ruckuswireless') {
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless') {
|
||||
$proc = array();
|
||||
$mibvals = get_mibval($device, '.1.3.6.1.4.1.25053.1.2.1.1.1.15.13.0');
|
||||
$proc['processor_descr'] = $mibvals['object_type'];
|
||||
@@ -819,7 +838,7 @@ function get_mib_processors($device)
|
||||
*/
|
||||
function is_custom_graph($type, $subtype, $device)
|
||||
{
|
||||
if ($device['os'] == 'ruckuswireless' && $type == 'device') {
|
||||
if (is_mib_poller_enabled($device) && $device['os'] == 'ruckuswireless' && $type == 'device') {
|
||||
switch ($subtype) {
|
||||
case 'cpumem':
|
||||
case 'mempool':
|
||||
@@ -955,6 +974,14 @@ function search_phrase_column($c)
|
||||
} // search_phrase_column
|
||||
|
||||
|
||||
function print_mib_poller_disabled() {
|
||||
echo '<h4>MIB polling is not enabled</h4>
|
||||
<p>
|
||||
Set <tt>$config[\'poller_modules\'][\'mib\'] = 1;</tt> in <tt>config.php</tt> to enable.
|
||||
</p>';
|
||||
} // print_mib_poller_disabled
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the path to an RRD for the Ceph application
|
||||
* @param string $gtype The type of rrd we're looking for
|
||||
|
||||
@@ -1211,24 +1211,6 @@ function load_device_mibs($device)
|
||||
} // load_device_mibs
|
||||
|
||||
|
||||
/*
|
||||
* @return true if this device should be polled with MIB-based discovery
|
||||
*/
|
||||
function is_mib_poller_enabled($device)
|
||||
{
|
||||
if (!is_module_enabled('poller', 'mib')) {
|
||||
d_echo("MIB polling module disabled globally.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_dev_attrib_enabled($device, 'poll_mib')) {
|
||||
d_echo('MIB module disabled for '.$device['hostname']."\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // is_mib_poller_enabled
|
||||
|
||||
/*
|
||||
* Run MIB-based polling for $device. Update $graphs with the results.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user