Skip to content

Instantly share code, notes, and snippets.

@johntdyer
Created December 23, 2011 14:42
Show Gist options
  • Select an option

  • Save johntdyer/1514375 to your computer and use it in GitHub Desktop.

Select an option

Save johntdyer/1514375 to your computer and use it in GitHub Desktop.
def self.jmx(opts={})
%w(net/http nokogiri).each{|lib| require lib}
opts={
:port=>47520,
:ip=>'localhost',
:bean=>'com.micromethod.sipmethod:name=sip,type=server.service',
:item=>'ActiveSession'
}.merge!(opts)
jmx = system("java -jar /usr/bin/jmxsh.jar /usr/bin/active_sessions.tcl #{opts[:ip]} #{opts[:port]} #{opts[:bean]} #{opts[:item]} 2>&1")
if jmx.start_with?('Error')
puts "[PRISM]===> JMX Request failed [#{jmx}]"
1
else
puts "[PRISM]===> JMX response [#{jmx.chomp}]"
jmx.to_i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment