From 7f823b6d498a68ad725d5f381678c7fe37714f67 Mon Sep 17 00:00:00 2001 From: laf Date: Sun, 1 Mar 2015 12:23:31 +0000 Subject: [PATCH] Adding more updates found by f0o --- includes/discovery/functions.inc.php | 4 +++- includes/discovery/hr-device.inc.php | 2 +- sql-schema/040.sql | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 sql-schema/040.sql diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index d37c59fb6e..a3a16c897f 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -484,7 +484,6 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec if (dbFetchCell("SELECT COUNT(processor_id) FROM `processors` WHERE `processor_index` = ? AND `device_id` = ? AND `processor_type` = ?",array($index,$device['device_id'], $type)) == '0') { $insert_data = array( - 'entPhysicalIndex' => $entPhysicalIndex, 'device_id' => $device['device_id'], 'processor_descr' => $descr, 'processor_index' => $index, @@ -496,6 +495,9 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec if (!empty($hrDeviceIndex)) { $insert_data['hrDeviceIndex'] = $hrDeviceIndex; } + if( !empty($entPhysicalIndex) ) { + $insert_data['entPhysicalIndex'] = $entPhysicalIndex; + } $inserted = dbInsert($insert_data, 'processors'); echo("+"); diff --git a/includes/discovery/hr-device.inc.php b/includes/discovery/hr-device.inc.php index b5e4d8a6a9..2f55b7f62e 100755 --- a/includes/discovery/hr-device.inc.php +++ b/includes/discovery/hr-device.inc.php @@ -31,7 +31,7 @@ if (is_array($hrDevices)) } else { - $inserted_rows = dbInsert(array('hrDeviceIndex' => mres($hrDevice['hrDeviceIndex']), 'device_id' => mres($device['device_id']), 'hrDeviceType' => mres($hrDevice['hrDeviceType']),'hrDeviceDescr' => mres($hrDevice['hrDeviceDescr']), 'hrDeviceStatus' => mres($hrDevice['hrDeviceStatus']), 'hrDeviceErrors' => mres($hrDevice['hrDeviceErrors'])), 'hrDevice'); + $inserted_rows = dbInsert(array('hrDeviceIndex' => mres($hrDevice['hrDeviceIndex']), 'device_id' => mres($device['device_id']), 'hrDeviceType' => mres($hrDevice['hrDeviceType']),'hrDeviceDescr' => mres($hrDevice['hrDeviceDescr']), 'hrDeviceStatus' => mres($hrDevice['hrDeviceStatus']), 'hrDeviceErrors' => (int) mres($hrDevice['hrDeviceErrors'])), 'hrDevice'); echo("+"); if ($debug) { print_r($hrDevice); echo("$inserted_rows row inserted"); } } diff --git a/sql-schema/040.sql b/sql-schema/040.sql new file mode 100644 index 0000000000..d3d954ff81 --- /dev/null +++ b/sql-schema/040.sql @@ -0,0 +1,8 @@ +ALTER TABLE `devices` CHANGE `agent_uptime` `agent_uptime` INT( 11 ) NOT NULL DEFAULT '0'; +ALTER TABLE `devices` CHANGE `type` `type` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''; +ALTER TABLE `ports` CHANGE `ifVrf` `ifVrf` INT( 11 ) NOT NULL DEFAULT '0'; +ALTER TABLE `storage` CHANGE `storage_free` `storage_free` BIGINT( 20 ) NOT NULL DEFAULT '0'; +ALTER TABLE `storage` CHANGE `storage_used` `storage_used` BIGINT( 20 ) NOT NULL DEFAULT '0'; +ALTER TABLE `storage` CHANGE `storage_perc` `storage_perc` INT NOT NULL DEFAULT '0'; +ALTER TABLE `processors` CHANGE `entPhysicalIndex` `entPhysicalIndex` INT( 11 ) NOT NULL DEFAULT '0'; +ALTER TABLE `hrDevice` CHANGE `hrDeviceErrors` `hrDeviceErrors` INT( 11 ) NOT NULL DEFAULT '0';