mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-04 16:12:20 +02:00
Fix for Cisco kit where match prefix is switched off.
This commit is contained in:
@@ -31,9 +31,22 @@ foreach ($device['vlans'] as $domain_id => $vlans)
|
|||||||
if ($device['os_group'] == "cisco" || $device['os'] == "ios") // This shit only seems to work on IOS
|
if ($device['os_group'] == "cisco" || $device['os'] == "ios") // This shit only seems to work on IOS
|
||||||
{
|
{
|
||||||
# Probably does not work with snmpv3. I have no real idea about what this code is really doing
|
# Probably does not work with snmpv3. I have no real idea about what this code is really doing
|
||||||
|
$device_details = $device;
|
||||||
|
$device_details['snmpcontext'] = $vlan_id;
|
||||||
$vlan_device = array_merge($device, array('community' => $device['community']."@".$vlan_id));
|
$vlan_device = array_merge($device, array('community' => $device['community']."@".$vlan_id));
|
||||||
$vlan_data = snmpwalk_cache_oid($vlan_device, "dot1dStpPortEntry", array(), "BRIDGE-MIB:Q-BRIDGE-MIB");
|
$vlan_data = snmpwalk_cache_oid($device_details, "dot1dStpPortEntry", array(), "BRIDGE-MIB:Q-BRIDGE-MIB");
|
||||||
$vlan_data = snmpwalk_cache_oid($vlan_device, "dot1dBasePortEntry", $vlan_data, "BRIDGE-MIB:Q-BRIDGE-MIB");
|
if ($exec_response['status'] != 0)
|
||||||
|
{
|
||||||
|
unset($device_details);
|
||||||
|
if( $device['snmpver'] == 'v3')
|
||||||
|
{
|
||||||
|
print_error("ERROR: For 'vlan-' context to work correctly on cisco device with SNMPv3, please add 'match prefix' into snmp config.");
|
||||||
|
} else {
|
||||||
|
print_error("ERROR: No support for per-VLAN community");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$vlan_data = snmpwalk_cache_oid($device_details, "dot1dBasePortEntry", $vlan_data, "BRIDGE-MIB:Q-BRIDGE-MIB");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("VLAN $vlan_id \n");
|
echo("VLAN $vlan_id \n");
|
||||||
|
|||||||
+17
-1
@@ -765,12 +765,28 @@ function snmp_cache_portName($device, $array)
|
|||||||
function snmp_gen_auth (&$device)
|
function snmp_gen_auth (&$device)
|
||||||
{
|
{
|
||||||
global $debug;
|
global $debug;
|
||||||
|
$vlan = FALSE;
|
||||||
|
|
||||||
|
if (isset($device['snmpcontext']))
|
||||||
|
{
|
||||||
|
if (is_numeric($device['snmpcontext']) && $device['snmpcontext'] > 0 && $device['snmpcontext'] < 4096 )
|
||||||
|
{
|
||||||
|
$vlan = $device['snmpcontext'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$cmd = "";
|
$cmd = "";
|
||||||
|
|
||||||
if ($device['snmpver'] === "v3")
|
if ($device['snmpver'] === "v3")
|
||||||
{
|
{
|
||||||
$cmd = " -v3 -n \"\" -l " . $device['authlevel'];
|
$cmd = " -v3 -l " . $device['authlevel'];
|
||||||
|
|
||||||
|
if(is_numeric($vlan))
|
||||||
|
{
|
||||||
|
$cmd .= ' -n "vlan-' . $vlan . '"';
|
||||||
|
} else {
|
||||||
|
$cmd .= ' -n ""';
|
||||||
|
}
|
||||||
|
|
||||||
if ($device['authlevel'] === "noAuthNoPriv")
|
if ($device['authlevel'] === "noAuthNoPriv")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user