mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more warning cleanups
git-svn-id: http://www.observium.org/svn/observer/trunk@705 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -56,11 +56,18 @@ if (file_exists('.svn'))
|
||||
{
|
||||
echo("Applying database updates to from r$db_rev to r" . trim($dbu_rev) . "...\n");
|
||||
shell_exec("scripts/update-sql.php database-update.sql");
|
||||
mysql_query("INSERT INTO dbSchema VALUES ($dbu_rev) ON DUPLICATE KEY UPDATE revision=$dbu_rev");
|
||||
if ($dbrev == 0)
|
||||
{
|
||||
mysql_query("INSERT INTO dbSchema VALUES ($dbu_rev)");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE dbSchema set revision=$dbu_rev");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($options['d'])) { echo("DEBUG!\n"); $debug = 1; }
|
||||
if(isset($options['d'])) { echo("DEBUG!\n"); $debug = 1; } else { $debug = 0; }
|
||||
|
||||
|
||||
$devices_discovered = 0;
|
||||
@@ -69,7 +76,7 @@ $device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where O
|
||||
while ($device = mysql_fetch_array($device_query)) {
|
||||
|
||||
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
|
||||
if($os_groups[$device[os]]) {$device['os_group'] = $os_groups[$device[os]]; echo "(".$device['os_group'].")";}
|
||||
if($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; echo "(".$device['os_group'].")";}
|
||||
echo("\n");
|
||||
|
||||
## Discover OS Changes
|
||||
|
@@ -5,8 +5,8 @@ $community = $device['community'];
|
||||
echo("CISCO-CDP-MIB: ");
|
||||
|
||||
unset($cdp_array);
|
||||
$cdp_array = snmpwalk_cache_twopart_oid("cdpCache", $device, $cdp_array, "CISCO-CDP-MIB");
|
||||
$cdp_array = $cdp_array[$device[device_id]];
|
||||
$cdp_array = snmpwalk_cache_twopart_oid("cdpCache", $device, array(), "CISCO-CDP-MIB");
|
||||
$cdp_array = $cdp_array[$device['device_id']];
|
||||
if($cdp_array) {
|
||||
unset($cdp_links);
|
||||
foreach( array_keys($cdp_array) as $key) {
|
||||
@@ -29,7 +29,7 @@ if($debug) {echo("$cdp_links");}
|
||||
echo("\nLLDP-MIB: ");
|
||||
|
||||
unset($lldp_array);
|
||||
$lldp_array = snmpwalk_cache_threepart_oid("lldpRemoteSystemsData", $device, $lldp_array, "LLDP-MIB");
|
||||
$lldp_array = snmpwalk_cache_threepart_oid("lldpRemoteSystemsData", $device, array(), "LLDP-MIB");
|
||||
$lldp_array = $lldp_array[$device['device_id']];
|
||||
if($lldp_array) {
|
||||
unset($lldp_links);
|
||||
@@ -53,7 +53,7 @@ if($lldp_array) {
|
||||
}
|
||||
if($debug) {echo("$lldp_links");}
|
||||
|
||||
$discovered_links = $cdp_links . $lldp_links;
|
||||
$discovered_links = (isset($cdp_links) ? $cdp_links : '') . (isset($lldp_links) ? $lldp_links : '');
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
@@ -10,9 +10,9 @@
|
||||
$entity_array = snmpwalk_cache_oid("entPhysicalEntry", $device, $empty, "ENTITY-MIB");
|
||||
$entity_array = snmpwalk_cache_oid("entSensorValues", $device, $entity_array, "CISCO-ENTITY-SENSOR-MIB");
|
||||
|
||||
if(!$entity_array[$device[device_id]]) { $entity_array[$device[device_id]] = array(); }
|
||||
if(!$entity_array[$device['device_id']]) { $entity_array[$device['device_id']] = array(); }
|
||||
|
||||
foreach($entity_array[$device[device_id]] as $entPhysicalIndex => $entry) {
|
||||
foreach($entity_array[$device['device_id']] as $entPhysicalIndex => $entry) {
|
||||
|
||||
$entPhysicalDescr = $entry['entPhysicalDescr'];
|
||||
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
|
||||
|
@@ -35,7 +35,7 @@
|
||||
if($device['os'] == "catos" && strstr($if, "vlan") ) { $nullintf = 1; }
|
||||
$ifDescr = fixifName($ifDescr);
|
||||
if (preg_match('/serial[0-9]:/', $if)) { $nullintf = 1; }
|
||||
if(!$config['allow_ng']) {
|
||||
if(isset($config['allow_ng']) && !$config['allow_ng']) {
|
||||
if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = 1; }
|
||||
}
|
||||
if ($debug) echo("\n $if ");
|
||||
@@ -45,7 +45,7 @@
|
||||
# Add Interface
|
||||
echo("+");
|
||||
} else {
|
||||
if($interface['deleted']) {
|
||||
if(isset($interface['deleted']) && $interface['deleted']) {
|
||||
mysql_query("UPDATE `interfaces` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
echo("*");
|
||||
} else {
|
||||
@@ -73,7 +73,7 @@
|
||||
while ($test_if = mysql_fetch_array($query)) {
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
while ($i < count($int_exists) && !$exists) {
|
||||
while ($i < count($int_exists) && !isset($exists)) {
|
||||
$this_if = $test_if['ifIndex'];
|
||||
if ($int_exists[$i] == $this_if) { $exists = 1; }
|
||||
$i++;
|
||||
|
@@ -37,7 +37,7 @@
|
||||
mysql_query($query);
|
||||
} else { echo("."); }
|
||||
}
|
||||
$storage_exists[] = $device[device_id]." $hrStorageIndex";
|
||||
$storage_exists[] = $device['device_id']." $hrStorageIndex";
|
||||
} else { echo("X"); };
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ $query = mysql_query($sql);
|
||||
while ($store = mysql_fetch_array($query)) {
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
while ($i < count($storage_exists) && !$exists) {
|
||||
while ($i < count($storage_exists) && !isset($exists)) {
|
||||
$thisstore = $store['host_id'] . " " . $store['hrStorageIndex'];
|
||||
if ($storage_exists[$i] == $thisstore) { $exists = 1; }
|
||||
$i++;
|
||||
|
Reference in New Issue
Block a user