<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Home</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>Recent changes to Home</description><atom:link href="https://sourceforge.net/p/jmxproxyclient/wiki/Home/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 17 Nov 2011 12:08:13 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/jmxproxyclient/wiki/Home/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>&lt;pre&gt;--- v6 
+++ v7 
@@ -101,3 +101,48 @@
    printf "\t%20s= %d\n", $_, $jpc-&gt;mbean($mem)-&gt;heap_mem_usage($_);
 }
 ~~~~~~
+
+### Sending metrics to Ganglia ###
+
+~~~~~~
+use strict;
+use JmxProxyClient;
+use JmxProxyClient::MBean;
+
+# Create a new instance of JmxProxyClient
+my $jpc = new JmxProxyClient(
+                server  =&gt; 'localhost',
+                port    =&gt; 8080,
+                user    =&gt; 'man',
+                password=&gt; 'man123',
+);
+
+# Run a query and display results
+my $gm_prefix = "tomcat_";
+my $mbean_name = "Catalina:type=ThreadPool,name=http-8080";
+while (1) {
+    foreach (("currentThreadsBusy", "currentThreadCount")) {
+        my %metric = (
+                name    =&gt; $gm_prefix . $mbean_name . "_" . $_,
+                type    =&gt; "int32",
+                units   =&gt; "threads",
+                value   =&gt; $jpc-&gt;mbean($mbean_name)-&gt;get($_)
+        );
+        exec(gmetric(%metric));
+    }
+
+    sleep 15;
+}
+
+sub gmetric {
+    my %params = @_;
+    # Replace illegal chars with _
+    $params{'name'} =~ s/[^a-zA-Z0-9_]/_/g;
+    my $cmd = "/usr/bin/gmetric --name='%s' --type='%s' --units='%s' --value='";
+    # Set the correct format for the value
+    if ($params{type} =~ /.*int.*/)  { $cmd .= "%d'"; }
+    elsif ($params{type} =~ /(float)|(double)/)  { $cmd .= "%s'"; }
+    else { $cmd .= "%s'"; }
+    return sprintf $cmd, $params{'name'}, $params{'type'}, $params{'units'}, $params{'value'};
+}
+~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Thu, 17 Nov 2011 12:08:13 -0000</pubDate><guid>https://sourceforge.netf0a351234192a77610b3efca3d114fdea004c79b</guid></item><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>&lt;pre&gt;--- v5 
+++ v6 
@@ -72,3 +72,32 @@
     print "\n\n";
 }
 ~~~~~~
+
+### Getting memory information ###
+
+~~~~~~
+use strict;
+use JmxProxyClient;
+use JmxProxyClient::MBean;
+
+# Create a new instance of JmxProxyClient
+my $jpc = new JmxProxyClient(
+                server  =&gt; 'localhost',
+                port    =&gt; 8080,
+                user    =&gt; 'man',
+                password=&gt; 'man123',
+);
+
+my $mem = "java.lang:type=Memory";
+
+# Using hash of results
+my %memstats = $jpc-&gt;mbean($mem)-&gt;heap_mem_usage;
+while (my($key, $val) = each(%memstats)) {
+    printf "\t%s\t=%d\n", $key, $val;
+}
+
+# Querying individual mem areas
+foreach ((qw/committed max used init/)) {
+   printf "\t%20s= %d\n", $_, $jpc-&gt;mbean($mem)-&gt;heap_mem_usage($_);
+}
+~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Thu, 17 Nov 2011 12:05:57 -0000</pubDate><guid>https://sourceforge.netd056c9193f649cb4961a7ce2aeab6967ecdb8ab4</guid></item><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>&lt;pre&gt;--- v4 
+++ v5 
@@ -26,19 +26,49 @@
 my $jpc = new JmxProxyClient(
                 server  =&gt; 'localhost',
                 port    =&gt; 8080,
-                path    =&gt; '/manager/jmxproxy',
-                user    =&gt; 'man',
-                password=&gt; 'man123',
-                timeout =&gt; 10
-);
-
+                user    =&gt; 'man',
+                password=&gt; 'man123',
+);
+
 # Fetch all available MBeans
 my @allBeans = $jpc-&gt;get_all_mbeans;
 for my $mbean (@allBeans) {
     print $mbean-&gt;name . "\n";
     my %attrs = $mbean-&gt;get_attributes;
     while (my ($attr, $val) = each (%attrs)) {
         print "\t" . $attr . ": " . $val . "\n";
     }
+}
+~~~~~~
+
+
+### Searching for MBeans, printing MBean attributes ###
+
+~~~~~~
+use JmxProxyClient;
+use JmxProxyClient::MBean;
+
+# Create a new instance of JmxProxyClient
+my $jpc = new JmxProxyClient(
+                server  =&gt; 'localhost',
+                port    =&gt; 8080,
+                user    =&gt; 'man',
+                password=&gt; 'man123',
+);
+
+# Run a query and display results
+my @mbeans = $jpc-&gt;search("Catalina:type=ThreadPool,*");
+for my $mbean (@mbeans) {
+    print $mbean-&gt;name . "\n";
+    my %attrs = $mbean-&gt;attributes;
+    while (my ($attr, $val) = each (%attrs)) {
+        print "\t" . $attr . ": " . $val . "\n";
+    }
+    print "\n\n";
+    printf "Busy/Current = %d/%d = %.2f\n",
+           $attrs{currentThreadsBusy},
+           $attrs{currentThreadCount},
+           $attrs{currentThreadsBusy} / $attrs{currentThreadCount};
+    print "\n\n";
 }
 ~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Thu, 17 Nov 2011 12:01:06 -0000</pubDate><guid>https://sourceforge.net7676922911c5fa24725a77a65008122f71ff14ac</guid></item><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>&lt;pre&gt;--- v3 
+++ v4 
@@ -14,3 +14,31 @@
 +   set support
 +   error handling
 
+## Examples ##
+
+### Getting all MBeans ###
+
+~~~~~~
+use JmxProxyClient;
+use JmxProxyClient::MBean;
+
+# Create a new instance of JmxProxyClient
+my $jpc = new JmxProxyClient(
+                server  =&gt; 'localhost',
+                port    =&gt; 8080,
+                path    =&gt; '/manager/jmxproxy',
+                user    =&gt; 'man',
+                password=&gt; 'man123',
+                timeout =&gt; 10
+);
+
+# Fetch all available MBeans
+my @allBeans = $jpc-&gt;get_all_mbeans;
+for my $mbean (@allBeans) {
+    print $mbean-&gt;name . "\n";
+    my %attrs = $mbean-&gt;get_attributes;
+    while (my ($attr, $val) = each (%attrs)) {
+        print "\t" . $attr . ": " . $val . "\n";
+    }
+}
+~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Thu, 17 Nov 2011 11:58:58 -0000</pubDate><guid>https://sourceforge.nete94b6ec7c8f3bb8d67854162cc086a4422696df3</guid></item><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>&lt;pre&gt;--- v2 
+++ v3 
@@ -1,13 +1,16 @@
 # JmxProxyClient Wiki #
 
+JmxProxyClient is an Object Oriented interface for JmxProxy which is a part of the manager app in Tomcat. It offers a quick and easy access to MBeans via HTTP and can be used in shell scripts, performance graphing apps, monitoring apps etc. Currently it's only available in Perl.
+
 ## Releases ##
 
 ### 0.1 ###
 Features in this release:
 +  JmxProxyClient class supports qry requests with wildcards returning array of MBeans as a result (search method)
 +   JmxProxyClient class supports qry requests without wildcards returing a MBean objects as a result (mbean method)
 +   MBean class supports get requests for specific attributes which only work if MBean was fully created or through JmxProxyClient::mbean method
 
 TODOs:
 +   set support
 +   error handling
+
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Thu, 17 Nov 2011 11:57:02 -0000</pubDate><guid>https://sourceforge.netd1ea6dd3f73e763c9c12c6a44d6f9a37e913b204</guid></item><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>&lt;pre&gt;--- v1 
+++ v2 
@@ -1,5 +1,13 @@
-Welcome to your wiki!
-
-This is the default page, edit it as you see fit. To add a page simply reference it within brackets, e.g.: [SamplePage].
-
-The wiki uses [Markdown](/p/jmxproxyclient/wiki/markdown_syntax/) syntax.
+# JmxProxyClient Wiki #
+
+## Releases ##
+
+### 0.1 ###
+Features in this release:
++  JmxProxyClient class supports qry requests with wildcards returning array of MBeans as a result (search method)
++   JmxProxyClient class supports qry requests without wildcards returing a MBean objects as a result (mbean method)
++   MBean class supports get requests for specific attributes which only work if MBean was fully created or through JmxProxyClient::mbean method
+
+TODOs:
++   set support
++   error handling
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Thu, 17 Nov 2011 11:44:13 -0000</pubDate><guid>https://sourceforge.nete10ef6379dbae866fe98b55bd1f7919955c408ba</guid></item><item><title>WikiPage Home modified by Maciek Kolbusz</title><link>https://sourceforge.net/p/jmxproxyclient/wiki/Home/</link><description>Welcome to your wiki!

This is the default page, edit it as you see fit. To add a page simply reference it within brackets, e.g.: [SamplePage].

The wiki uses [Markdown](/p/jmxproxyclient/wiki/markdown_syntax/) syntax.
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maciek Kolbusz</dc:creator><pubDate>Tue, 25 Oct 2011 09:48:28 -0000</pubDate><guid>https://sourceforge.netc0f4963e22b632f09bdad5eeaa7d117a05577cb8</guid></item></channel></rss>