From a3495b015c96d79bfc17913b5821cb25406f5f41 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sun, 14 Mar 2010 14:38:30 +0000 Subject: [PATCH] fix mempool polling. move removal of storage cache array to poll-device.php. perhaps this needs further aggregated elsewhere ? git-svn-id: http://www.observium.org/svn/observer/trunk@1027 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/polling/mempools-hrstorage.inc.php | 2 +- includes/polling/storage.inc.php | 2 +- poll-device.php | 2 ++ test-poll.php | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/polling/mempools-hrstorage.inc.php b/includes/polling/mempools-hrstorage.inc.php index 6c6f3416d..42885b07e 100755 --- a/includes/polling/mempools-hrstorage.inc.php +++ b/includes/polling/mempools-hrstorage.inc.php @@ -7,7 +7,7 @@ if(!is_array($storage_cache['hrstorage'])) { if ($debug) { print_r($storage_cache); } } else { if($debug) { echo("Cached!"); } } -$entry = $storage_cache['hrstorage'][$device[device_id]][$mempool[index]]; +$entry = $storage_cache['hrstorage'][$device[device_id]][$mempool[mempool_index]]; $mempool['units'] = $entry['hrStorageAllocationUnits']; $mempool['used'] = $entry['hrStorageUsed'] * $mempool['units']; diff --git a/includes/polling/storage.inc.php b/includes/polling/storage.inc.php index 9190e9104..56c801973 100755 --- a/includes/polling/storage.inc.php +++ b/includes/polling/storage.inc.php @@ -52,6 +52,6 @@ while($storage = mysql_fetch_array($storage_data)) { } -unset($storage_cache, $storage); +unset($storage); ?> diff --git a/poll-device.php b/poll-device.php index 94ddba2bc..2a167c733 100755 --- a/poll-device.php +++ b/poll-device.php @@ -228,6 +228,8 @@ while ($device = mysql_fetch_array($device_query)) { echo("No Changes to " . $device['hostname'] . "\n"); } + unset($storage_cache); // Clear cache of hrStorage ** MAYBE FIXME? ** + $device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5); echo("Polled in $device_time seconds\n"); diff --git a/test-poll.php b/test-poll.php index da6090710..8597ca385 100755 --- a/test-poll.php +++ b/test-poll.php @@ -5,6 +5,7 @@ include("includes/defaults.inc.php"); include("config.php"); include("includes/functions.php"); +$debug =1; $poller_start = utime(); @@ -59,6 +60,6 @@ $poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = $string = $argv[0] . " " . date("F j, Y, G:i") . " - $i devices polled in $poller_time secs"; echo("$string\n"); -shell_exec("echo '".$string."' >> /opt/observer/observer.log"); +shell_exec("echo '".$string."' >> /tmp/observer.log"); ?>