From 8c23653b156d86447572caef1a5dba8a5b3a45a5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 22 Feb 2017 15:27:33 +0100 Subject: usr-lib-nagios-plugins: White-space cleanups. --- usr-lib-nagios-plugins/check_mem.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'usr-lib-nagios-plugins/check_mem.pl') diff --git a/usr-lib-nagios-plugins/check_mem.pl b/usr-lib-nagios-plugins/check_mem.pl index 5f70757..f59d003 100755 --- a/usr-lib-nagios-plugins/check_mem.pl +++ b/usr-lib-nagios-plugins/check_mem.pl @@ -62,7 +62,7 @@ tell_nagios($used_memory_kb,$free_memory_kb,$caches_kb); sub tell_nagios { my ($used,$free,$caches) = @_; - + # Calculate Total Memory my $total = $free + $used; print "$total Total\n" if ($opt_v); @@ -76,7 +76,7 @@ sub tell_nagios { $perf_warn = int(${total} * ( 100 - $opt_w ) / 100); $perf_crit = int(${total} * ( 100 - $opt_c ) / 100); } - + my $perfdata = "|TOTAL=${total}KB;;;; USED=${used}KB;${perf_warn};${perf_crit};; FREE=${free}KB;;;; CACHES=${caches}KB;;;;"; if ($opt_f) { @@ -120,7 +120,7 @@ sub usage() { print "check_mem.pl comes with absolutely NO WARRANTY either implied or explicit\n"; print "This program is licensed under the terms of the\n"; print "MIT License (check source code for details)\n"; - exit $exit_codes{'UNKNOWN'}; + exit $exit_codes{'UNKNOWN'}; } sub get_memory_info { @@ -246,7 +246,7 @@ sub get_memory_info { } } $used_memory_kb = $total_memory_kb - $free_memory_kb; - + } else { # We have kstat my $kstat = Sun::Solaris::Kstat->new(); @@ -256,14 +256,14 @@ sub get_memory_info { # to me how to determine UFS's cache size. There's inode_cache, # and maybe the physmem variable in the system_pages module?? # In the real world, it looks to be so small as not to really matter, - # so we don't grab it. If someone can give me code that does this, + # so we don't grab it. If someone can give me code that does this, # I'd be glad to put it in. my $arc_size = (exists ${kstat}->{zfs} && ${kstat}->{zfs}->{0}->{arcstats}->{size}) ? - ${kstat}->{zfs}->{0}->{arcstats}->{size} / 1024 + ${kstat}->{zfs}->{0}->{arcstats}->{size} / 1024 : 0; $caches_kb += $arc_size; my $pagesize = `pagesize`; - + $total_memory_kb = $phys_pages * $pagesize / 1024; $free_memory_kb = $free_pages * $pagesize / 1024; $used_memory_kb = $total_memory_kb - $free_memory_kb; @@ -317,7 +317,7 @@ sub get_memory_info { my $command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`; chomp $command_line; my @memlist = split(/ /, $command_line); - + # Define the calculating scalars $used_memory_kb = $memlist[0]/1024; $free_memory_kb = $memlist[1]/1024; @@ -334,7 +334,7 @@ sub init { else { getopts('c:fuCvw:'); } - + # Shortcircuit the switches if (!$opt_w or $opt_w == 0 or !$opt_c or $opt_c == 0) { print "*** You must define WARN and CRITICAL levels!\n"; @@ -344,7 +344,7 @@ sub init { print "*** You must select to monitor either USED or FREE memory!\n"; &usage; } - + # Check if levels are sane if ($opt_w <= $opt_c and $opt_f) { print "*** WARN level must not be less than CRITICAL when checking FREE memory!\n"; -- cgit v1.2.3