Permalink
Browse files

Added SmartOS support

  • Loading branch information...
1 parent 8ae3a9c commit 43e2a7f7c82ac72ebd4ad0ee8e35b79d3952cf05 @Napsty Napsty committed Jan 10, 2014
Showing with 20 additions and 0 deletions.
  1. +20 −0 check_mem/check_mem.pl
View
@@ -205,6 +205,26 @@ sub get_memory_info {
$used_memory_kb = $total_memory_kb - $free_memory_kb;
$caches_kb = ($mem_cache / 1024);
}
+ elsif ( $uname =~ /joyent/ ) {
+ # The SmartOS case. 2014-01-10 www.claudiokuenzler.com
+ # free mem = pagesfree * pagesize
+ my $pagesize = `pagesize`;
+ my $phys_pages = `kstat -p unix:0:system_pages:pagestotal | awk '{print \$NF}'`;
+ my $free_pages = `kstat -p unix:0:system_pages:pagesfree | awk '{print \$NF}'`;
+ my $arc_size = `kstat -p zfs:0:arcstats:size | awk '{print \$NF}'`;
+ my $arc_size_kb = $arc_size / 1024;
+
+ print "Pagesize is $pagesize" if ($opt_v);
+ print "Total pages is $phys_pages" if ($opt_v);
+ print "Free pages is $free_pages" if ($opt_v);
+ print "Arc size is $arc_size" if ($opt_v);
+
+ $caches_kb += $arc_size_kb;
+
+ $total_memory_kb = $phys_pages * $pagesize / 1024;
+ $free_memory_kb = $free_pages * $pagesize / 1024;
+ $used_memory_kb = $total_memory_kb - $free_memory_kb;
+ }
elsif ( $uname =~ /SunOS/ ) {
eval "use Sun::Solaris::Kstat";
if ($@) { #Kstat not available

0 comments on commit 43e2a7f

Please sign in to comment.