Ticket #13 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Memstat broken on Solaris 10 update 3

Reported by: jdixon Assigned to: jdixon
Priority: major Milestone: 2.0_release
Component: modules Version: 2.0
Keywords: Cc:

Description

Reported by Bryan Allen.

Core::Memstat`local`error [Attempt to access disallowed key 'zfs' in a restricted hash at /opt/resmon2/lib/Core/Memstat.pm line 114.]

Following patch works for him:

--- Memstat.pm	2010-06-01 03:38:14.000000000 -0400
+++ Memstat.pm2	2010-06-01 03:41:02.000000000 -0400
 -111,7 +111,10 @@
             foreach (keys %$syspages) {
                 $metrics{"kstat_${_}"} = [int($syspages->{$_} * $pagesize / 1024), 'L'] unless ($_ eq 'class');
             }
-            $metrics{'kstat_cache_mem'} = [int($kstat->{'zfs'}->{0}->{'arcstats'}->{'size'} / 1024), 'L'];
+            my $release = `grep s10x_u3wos_10 /etc/release`;
+            unless ( $release ) {
+              $metrics{'kstat_cache_mem'} = [int($kstat->{'zfs'}->{0}->{'arcstats'}->{'size'} / 1024), 'L'];
+            }
             return \%metrics;
         } else {
             my $output = run_command("$vmstat_path");

Change History

06/01/10 17:38:26 changed by mark

I wouldn't use the release checking code, which would result in a grep every time. If you wanted to, put the grep in the constructor for the object so it's only run once, but I get the feeling a better way is just to wrap the code in an eval block instead and not worry if there is an error.

06/01/10 18:26:34 changed by jdixon

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [407].