Skip to content

Instantly share code, notes, and snippets.

@whatcould
Created January 19, 2009 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatcould/49130 to your computer and use it in GitHub Desktop.
Save whatcould/49130 to your computer and use it in GitHub Desktop.
munin plugin to track memory on solaris zone (joyent accelerator)
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category System
graph_title accelerator memory
graph_vlabel M
rss.label rss
swap.label swap
END
exit 0
end
def output_values
prstat = `prstat -Z 1 1`
unless $?.success?
$stderr.puts "failed executing prstat"
exit 1
end
prstat =~ /(ZONEID[^\n]*)\n(.*)/
values = $2.split(' ')
puts "rss.value #{values[3].to_i}"
puts "swap.value #{values[2].to_i}"
end
if ARGV[0] == "config"
output_config
else
output_values
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment