Skip to content

Ramblings

Musings of Matt Williams
  • Blog
  • About
  • Chibi
  • Ruby Blender
  • Archives
  • Log in
 
Less
More
Trim
Untrim
« Older
Home
Loading
Newer »
Archive for the 'howto' Category
14May09 SSL Joys
gotchas howto tips
0 Comments

The nice thing about standards is that there are so many of them to choose from. Andrew S. Tanenbaum

I’ve been working with a Apache proxy to force SSL and https.  Well, I haven’t had any control over the certificates.  And they can come in so many versions, especially given that Microsoft wants to do things its own way and the Apache web server instance is sitting on a windows virtual instance.

I’ve gotten the private key in two different formats, .pfx and .pvk.

.pfx can be converted to the pem file format which Apache is expecting via the following:

openssl pkcs12 -nodes -in infile.pfx -out out.pem

You then need to edit it, stripping out everything but the private key.  Once that’s accomplished you’re good to go.

.pvk, however, isn’t supported in openssl until version 1.0.  Joy!

Enhanced by Zemanta
22Sep08 JRuby + jmx4r + rrd4j == Easy reporting on app servers (part I)
howto jruby monitoring programming
3 Comments

This is a how-to for using jmx and rrd4j, a java implementation of rrdtool, to report on app server statistics.

Thanks to Jeff Mesnil(author of jmx4r), Werner Schuster (JMX the Ruby way with jmx4r), sishen (JRobin sucks), and the rrd4j team.

You’ll need the following:

  1. JVM 1.5 or higher — JRE is not enough, you also need the JDK. Remember to set your JAVA_HOME — JRuby needs it.
  2. JRuby — I’m using 1.1.4. Note: You need to be sure to set the JRUBY_HOME and make sure that ${JRUBY_HOME}/bin comes in $PATH prior to any other ruby installation. Otherwise, your results will be indeterminate.
  3. jmx4r — this is a gem and can be installed by
    jruby -S gem install jmx4r
  4. rrd4j — in order to get this, you need to create an account on java.net. Once you’ve done that, you can download the library via subversion:
    svn co https://rrd4j.dev.java.net/svn/rrd4j/trunk rrd4j --username <em>username</em>

    Replace username with your java.net username. You’ll need ant to build it:

    cd rrd4j/rrd4j; ant

    Or you can download the jars: rrd4j jars

  5. An application which responds to jmx queries — this example is using jconsole since it is a standard part of the java distribution in 1.5 and after.

Before we do much else, let’s verify that jconsole is working:

jconsole -J-Dcom.sun.management.jmxremote.port=64850 -J-Dcom.sun.management.jmxremote.authenticate=false -J-Dcom.sun.management.jmxremote.ssl=false

Choose for the port some large nuimber…  Your screen will look something like this for 1.5 (ignore the cutoff bits, I’m writing this on chibi):

Portion of a JConsole screen

Portion of a JConsole screen

Ok, now that we’ve got that going, let’s attempt connecting via jmx4r…

$ jruby -S jirb
irb(main):001:0&gt; require 'rubygems'
=&gt; true
irb(main):002:0&gt; require 'jmx4r'
=&gt; true
irb(main):003:0&gt; require 'java'
=&gt; false
irb(main):004:0&gt; JMX::MBean.establish_connection :host =&gt; "localhost", :port =&gt; 64850
=&gt; #&lt;#:0x1bd06a0 @java_object=javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection@12f9ee1&gt;
irb(main):005:0&gt; memory =JMX::MBean.find_by_name "java.lang:type=Memory"
=&gt; #"NonHeapMemoryUsage", "verbose"=&gt;"Verbose", "object_pending_finalization_count"=&gt;"ObjectPendingFinalizationCount", "heap_memory_usage"=&gt;"HeapMemoryUsage"}, @mbsc=#&lt;#:0x1bd06a0 @java_object=javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection@12f9ee1&gt;, @operations={"gc"=&gt;["gc", []]}, @object_name=#&gt;
irb(main):006:0&gt; memory.heap_memory_usage
=&gt; #
irb(main):012:0&gt; memory.heap_memory_usage.keys
=&gt; #&lt;#:0x129dcc0 @java_object=[committed, init, max, used]&gt;
irb(main):015:0&gt; memory.heap_memory_usage.to_s
=&gt; "javax.management.openmbean.CompositeDataSupport(compositeType=javax.management.openmbean.CompositeType(name=java.lang.management.MemoryUsage,items=((itemName=committed,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=init,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=max,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)),(itemName=used,itemType=javax.management.openmbean.SimpleType(name=java.lang.Long)))),contents={committed=7569408, init=0, max=66650112, used=3952968})"
irb(main):020:0&gt; memory.heap_memory_usage["committed"]
=&gt; 7569408
irb(main):021:0&gt; #trigger a gc
irb(main):022:0* memory.gc
=&gt; nil
irb(main):023:0&gt; memory =JMX::MBean.find_by_name "java.lang:type=Memory"
=&gt; #"NonHeapMemoryUsage", "verbose"=&gt;"Verbose", "object_pending_finalization_count"=&gt;"ObjectPendingFinalizationCount", "heap_memory_usage"=&gt;"HeapMemoryUsage"}, @mbsc=#&lt;#:0x1bd06a0 @java_object=javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection@12f9ee1&gt;, @operations={"gc"=&gt;["gc", []]}, @object_name=#&gt;
irb(main):024:0&gt; memory.heap_memory_usage["committed"]
=&gt; 7569408
irb(main):026:0&gt; memory.heap_memory_usage["max"]
=&gt; 66650112
irb(main):027:0&gt; memory.heap_memory_usage["used"]
=&gt; 4210824
irb(main):028:0&gt; exit
$

Cool! now we’re making progress!

 
Browse Archives »
  • administrivia (6)
  • books (1)
  • Computers (2)
  • css (3)
  • eating crow (1)
  • games (1)
  • glassfish (1)
  • gotchas (18)
  • howto (2)
  • idiocy (3)
  • javascript (4)
  • jboss (6)
  • jruby (7)
  • Just Enough Programming (7)
  • life hacking (2)
  • mini sagas (1)
  • miscellany (1)
  • monitoring (1)
  • mysql (1)
  • philosophy (4)
  • php (1)
  • programming (17)
  • rails (7)
  • rants (2)
  • refactoring (1)
  • ruby (14)
  • tips (9)
  • tools (2)
  • torquebox (1)
  • Uncategorized (9)
  • UNIX (1)
  • utilities (3)
  • web (5)
  • web design (3)
 

Latest

  • JBoss Client Jars for Messaging
  • rsh hates nohup
  • Torquebox and Cygwin: Take I
  • Rails & JRuby in a Jar
  • Fractal Terrain Generation
  • Quick thought on programming and distractions
  • Using jnp as a JBoss heartbeat
  • z-index and events
  • JBoss port confusion
  • SSL Joys

Flickr

layout_newm3headerTerrain Testa

Blogroll

  • Development Blog
  • Documentation
  • Plugins
  • Suggest Ideas
  • Support Forum
  • Themes
  • WordPress Planet

Search

Browse by Category

  • administrivia (6)
  • books (1)
  • Computers (2)
  • css (3)
  • eating crow (1)
  • games (1)
  • glassfish (1)
  • gotchas (18)
  • howto (2)
  • idiocy (3)
  • javascript (4)
  • jboss (6)
  • jruby (7)
  • Just Enough Programming (7)
  • life hacking (2)
  • mini sagas (1)
  • miscellany (1)
  • monitoring (1)
  • mysql (1)
  • philosophy (4)
  • php (1)
  • programming (17)
  • rails (7)
  • rants (2)
  • refactoring (1)
  • ruby (14)
  • tips (9)
  • tools (2)
  • torquebox (1)
  • Uncategorized (9)
  • UNIX (1)
  • utilities (3)
  • web (5)
  • web design (3)

Browse by Tag

  • 1.2.6
  • 2.1
  • administrivia
  • autotest
  • books
  • controller
  • css
  • feed-normalizer
  • feeds
  • gotchas
  • idiocy
  • irb
  • Java
  • javascript
  • jboss
  • jruby
  • just enough programming
  • mini sagas
  • open-uri
  • philosophy
  • php
  • pragmatism
  • programming
  • quotations
  • rails
  • rants
  • reading
  • restful_authentication
  • rspec
  • rss
  • ruby
  • rubygems
  • scriptaculous
  • setup
  • simplicity
  • sprites
  • statemachine
  • tips
  • treetop
  • utilities
  • web
  • web design
  • websense
  • yaml
  • zentest

Browse by Month

  • November 2010 (1)
  • August 2010 (1)
  • June 2010 (1)
  • March 2010 (1)
  • September 2009 (1)
  • August 2009 (2)
  • July 2009 (2)
  • May 2009 (1)
  • April 2009 (1)
  • February 2009 (4)
  • January 2009 (2)
  • December 2008 (2)
  • November 2008 (5)
  • October 2008 (3)
  • September 2008 (12)
  • August 2008 (28)
 
 
  • Blog
  • About
  • Chibi
  • Ruby Blender
  • Archives
  • Log in
 


Theme Design by Jay Kwong | Powered by WordPress and K2

 

Home Top Archives Entries FeedComments Feed