From 152dc52b4eaf0ac64929cc527008300a77c0fd1b Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 26 Mar 2010 18:30:27 +0000 Subject: [PATCH] fix bug where mempool >2GB was broken. (i blame sid3windr for this, he was probably distracting me with talk of printers or something) git-svn-id: http://www.observium.org/svn/observer/trunk@1047 61d68cd4-352d-0410-923a-c4978735b2b8 --- database-update.sql | 2 +- includes/discovery/functions.inc.php | 4 +++- includes/polling/mempools.inc.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/database-update.sql b/database-update.sql index 9f3496c74b..054109e91a 100644 --- a/database-update.sql +++ b/database-update.sql @@ -4,4 +4,4 @@ ALTER TABLE `processors` CHANGE `processor_descr` `processor_descr` VARCHAR( DROP TABLE `cempMemPool`; DROP TABLE `cpmCPU`; DROP TABLE `cmpMemPool`; -ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` INT( 16 ) NOT NULL ,CHANGE `mempool_free` `mempool_free` INT( 16 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` INT( 16 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` INT( 16 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` INT( 16 ) NULL DEFAULT NULL ; +ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_free` `mempool_free` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 16 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 16 ) NULL DEFAULT NULL ; diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 1993e51247..e0fda75513 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -127,7 +127,9 @@ function discover_mempool(&$valid_mempool, $device, $index, $type, $descr, $prec { echo("."); # entry = mysql_fetch_assoc(mysql_query()); - $query = "UPDATE `mempools` SET `mempool_descr` = '".$descr."', `entPhysicalIndex` = '$entPhysicalIndex', `hrDeviceIndex` = '$hrDeviceIndex' WHERE `device_id` = '".$device['device_id']."' AND `mempool_index` = '".$index."' AND `mempool_type` = '".$type."'"; + $query = "UPDATE `mempools` SET `mempool_descr` = '".$descr."', `entPhysicalIndex` = '".$entPhysicalIndex."'"' + $query .= ", `hrDeviceIndex` = '$hrDeviceIndex' "; + $query .= "WHERE `device_id` = '".$device['device_id']."' AND `mempool_index` = '".$index."' AND `mempool_type` = '".$type."'"; mysql_query($query); if($debug) { print $query . "\n"; } } diff --git a/includes/polling/mempools.inc.php b/includes/polling/mempools.inc.php index d83395a515..c5862216f0 100755 --- a/includes/polling/mempools.inc.php +++ b/includes/polling/mempools.inc.php @@ -42,7 +42,8 @@ while($mempool = mysql_fetch_array($mempool_data)) { rrdtool_update($mempoolrrd,"N:".$mempool['used'].":".$mempool['free']); $update_query = "UPDATE `mempools` SET `mempool_used` = '".$mempool['used']."'"; - $update_query .= ", `mempool_free` = '".$mempool['free']."', `mempool_total` = '".$mempool['total']."'"; + $update_query .= ", `mempool_free` = '".$mempool['free']."'"; + $update_query .= ", `mempool_total` = '".$mempool['total']."'"; $update_query .= ", `mempool_largestfree` = '".$mempool['largestfree']."'"; $update_query .= ", `mempool_lowestfree` = '".$mempool['lowestfree']."'"; $update_query .= " WHERE `mempool_id` = '".$mempool['mempool_id']."'";