mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add Q-BRIDGE-MIB support
git-svn-id: http://www.observium.org/svn/observer/trunk@589 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -86,7 +86,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'network'; } # FIXME: could also be a Netscreen...
|
||||
}
|
||||
|
||||
if($device['os'] == "powerconnect" || $device['os'] == "ios" || $device['os'] == "iosxe" || $device['os'] == "catos" || $device['os'] == "asa" || $device['os'] == "pix") {
|
||||
if($device['os'] == "ios" || $device['os'] == "iosxe" || $device['os'] == "catos" || $device['os'] == "asa" || $device['os'] == "pix") {
|
||||
include("includes/discovery/cisco-vlans.php");
|
||||
include("includes/discovery/bgp-peers.php");
|
||||
include("includes/discovery/cisco-mac-accounting.php");
|
||||
@@ -100,8 +100,9 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'network'; };
|
||||
}
|
||||
|
||||
if ($device['os'] == "procurve")
|
||||
if ($device['os'] == "procurve" || $device['os'] == "powerconnect")
|
||||
{
|
||||
include("includes/discovery/q-bridge-mib.php");
|
||||
if ($device['type'] == "unknown") { $device['type'] = 'network'; };
|
||||
}
|
||||
|
||||
|
||||
57
includes/discovery/q-bridge-mib.php
Normal file
57
includes/discovery/q-bridge-mib.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
echo("VLANs : ");
|
||||
|
||||
$vlanversion_cmd = $config['snmpget'] . " -m Q-BRIDGE-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " ";
|
||||
$vlanversion_cmd .= $device['hostname'].":".$device['port'] . " Q-BRIDGE-MIB::dot1qVlanVersionNumber.0";
|
||||
$vlanversion = trim(`$vlanversion_cmd 2>/dev/null`);
|
||||
|
||||
echo $vlanversion;
|
||||
|
||||
if($vlanversion == 'version1') {
|
||||
|
||||
echo("VLAN $vlanversion ");
|
||||
|
||||
$vlans_cmd = $config['snmpwalk'] . " -m Q-BRIDGE-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$vlans_cmd .= "dot1qVlanFdbId";
|
||||
|
||||
$vlans = trim(`$vlans_cmd | grep -v o`);
|
||||
|
||||
foreach(explode("\n", $vlans) as $vlan_oid) {
|
||||
|
||||
list($oid,$vlan) = split(' ',$vlan_oid);
|
||||
$oid_ex = explode('.',$oid);
|
||||
$oid = $oid_ex[count($oid_ex)-1];
|
||||
|
||||
$vlan_descr_cmd = $config['snmpget'] . " -m Q-BRIDGE-MIB -O nvq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$vlan_descr_cmd .= "dot1qVlanStaticName.$oid";
|
||||
$vlan_descr = shell_exec($vlan_descr_cmd);
|
||||
|
||||
$vlan_descr = trim(str_replace("\"", "", $vlan_descr));
|
||||
|
||||
if(mysql_result(mysql_query("SELECT COUNT(vlan_id) FROM `vlans` WHERE `device_id` = '" . $device['device_id'] . "' AND `vlan_domain` = '' AND `vlan_vlan` = '" . $vlan . "'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `vlans` (`device_id`,`vlan_domain`,`vlan_vlan`, `vlan_descr`) VALUES (" . $device['device_id'] . ",'','$vlan', '$vlan_descr')");
|
||||
echo("+");
|
||||
} else { echo("."); }
|
||||
|
||||
$this_vlans[] = $vlan;
|
||||
|
||||
}
|
||||
|
||||
$device_vlans = mysql_query("SELECT * FROM `vlans` WHERE `device_id` = '" . $device['device_id'] . "' AND `vlan_domain` = '" . $vtp_domain . "'");
|
||||
while($dev_vlan = mysql_fetch_array($device_vlans)) {
|
||||
unset($vlan_exists);
|
||||
foreach($this_vlans as $test_vlan) {
|
||||
if($test_vlan == $dev_vlan['vlan_vlan']) { $vlan_exists = 1; }
|
||||
}
|
||||
if(!$vlan_exists) {
|
||||
mysql_query("DELETE FROM `vlans` WHERE `vlan_id` = '" . $dev_vlan['vlan_id'] . "'");
|
||||
echo("-");
|
||||
#echo("Deleted VLAN ". $dev_vlan['vlan_vlan'] ."\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($this_vlans);
|
||||
|
||||
echo("\n");
|
||||
Reference in New Issue
Block a user