From da16136ac74b610f137f32474ffb4083050a8a15 Mon Sep 17 00:00:00 2001 From: OKUMURA Takahiro Date: Thu, 1 Oct 2015 15:05:28 +0900 Subject: [PATCH] Resolve uninitialized values to suppress the error like following: ``` 2015/10/01-14:40:47 [7080] Error output from memory_ext: 2015/10/01-14:40:47 [7080] Use of uninitialized value in addition (+) at /etc/munin/plugins/memory_ext line 200. 2015/10/01-14:40:47 [7080] Use of uninitialized value in addition (+) at /etc/munin/plugins/memory_ext line 200. 2015/10/01-14:40:47 [7080] Use of uninitialized value in addition (+) at /etc/munin/plugins/memory_ext line 201. 2015/10/01-14:40:47 [7080] Use of uninitialized value in addition (+) at /etc/munin/plugins/memory_ext line 201. 2015/10/01-14:40:47 [7080] Use of uninitialized value in subtraction (-) at /etc/munin/plugins/memory_ext line 203. 2015/10/01-14:40:47 [7080] Use of uninitialized value in print at /etc/munin/plugins/memory_ext line 205. 2015/10/01-14:40:47 [7080] Use of uninitialized value in print at /etc/munin/plugins/memory_ext line 207. 2015/10/01-14:40:47 [7080] Use of uninitialized value in print at /etc/munin/plugins/memory_ext line 209. 2015/10/01-14:40:47 [7080] Use of uninitialized value in print at /etc/munin/plugins/memory_ext line 210. 2015/10/01-14:40:47 [7080] Use of uninitialized value in print at /etc/munin/plugins/memory_ext line 211. ``` --- memory_ext | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/memory_ext b/memory_ext index 28cb87e..041b1c5 100755 --- a/memory_ext +++ b/memory_ext @@ -197,8 +197,8 @@ if ($ARGV[0] and $ARGV[0] eq "config") # Any optional value needs to be initialized to zero if it's used in a calculation below # and is has not been set by &fetch_meminfo -$anon = $mems{'Active(anon)'} + $mems{'Inactive(anon)'}; -$file = $mems{'Active(file)'} + $mems{'Inactive(file)'}; +my $anon = $mems{'Active(anon)'} + $mems{'Inactive(anon)'}; +my $file = $mems{'Active(file)'} + $mems{'Inactive(file)'}; print "anon.value ", $anon - $mems{'SwapCached'} - $mems{'Shmem'}, "\n"; print "page_tables.value ", $mems{'PageTables'}, "\n";