Skip to content

Instantly share code, notes, and snippets.

@walf443
Created March 15, 2012 03:56
Show Gist options
  • Save walf443/2041777 to your computer and use it in GitHub Desktop.
Save walf443/2041777 to your computer and use it in GitHub Desktop.
diff --git a/lib/CloudForecast/Data/Mysqlcachehit.pm b/lib/CloudForecast/Data/Mysqlcachehit.pm
index 4ef3ae6..238dca8 100644
--- a/lib/CloudForecast/Data/Mysqlcachehit.pm
+++ b/lib/CloudForecast/Data/Mysqlcachehit.pm
@@ -93,13 +93,13 @@ fetcher {
(1.0 - $status{'key_reads'} / $status{'key_read_requests'} ) * 100;
my $query_cache = sprintf '%.2f',
- ($status{'qcache_hits'} / ($status{'qcache_inserts'} + $status{'qcache_hits'} + $status{'qcache_not_cached'})
+ ($status{'qcache_hits'} / ( ($status{'qcache_inserts'} + $status{'qcache_hits'} + $status{'qcache_not_cached'
my $table_lock_immediate = sprintf '%.2f',
- ($status{'table_locks_immediate'} / ($status{'table_locks_immediate'} + $status{'table_locks_waited'}) ) * 10
+ ($status{'table_locks_immediate'} / ( ($status{'table_locks_immediate'} + $status{'table_locks_waited'}) || 1
my $thread_cache = sprintf '%.2f',
- (1.0 - $status{'threads_created'} / $status{'connections'} ) * 100;
+ (1.0 - $status{'threads_created'} / ( $status{'connections'} || 1 ) ) * 100;
my $tmp_table_on_memory = sprintf '%.2f',
($status{'created_tmp_tables'} / (($status{'created_tmp_tables'} + $status{'created_tmp_disk_tables'}) || 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment