mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
git-svn-id: http://www.observium.org/svn/observer/trunk@89 61d68cd4-352d-0410-923a-c4978735b2b8
30 lines
957 B
PHP
30 lines
957 B
PHP
#!/usr/bin/php
|
|
<?
|
|
|
|
include("config.php");
|
|
include("includes/functions.php");
|
|
|
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND os = 'IOS'");
|
|
while ($device = mysql_fetch_array($device_query)) {
|
|
|
|
echo("Discovering VLANs on " . $device['hostname'] . "\n");
|
|
|
|
$vlans_cmd = "snmpwalk -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " ";
|
|
$vlans_cmd .= "1.3.6.1.4.1.9.9.46.1.3.1.1.2.1 | sed s/.1.3.6.1.4.1.9.9.46.1.3.1.1.2.1.//g | cut -f 1 -d\" \"";
|
|
|
|
$vlans = trim(`$vlans_cmd | grep -v o`);
|
|
|
|
foreach(explode("\n", $vlans) as $vlan) {
|
|
|
|
$vlan_descr_cmd = "snmpget -O nvq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " ";
|
|
$vlan_descr_cmd .= ".1.3.6.1.4.1.9.9.46.1.3.1.1.4.1." . $vlan;
|
|
$vlan_descr = `$vlan_descr_cmd`;
|
|
|
|
$vlan_descr = trim(str_replace("\"", "", $vlan_descr));
|
|
|
|
echo("VLAN $vlan ($vlan_descr)\n");
|
|
|
|
}
|
|
|
|
}
|