Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 24312 invoked from network); 13 Aug 2008 16:35:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Aug 2008 16:35:49 -0000 Received: (qmail 86599 invoked by uid 500); 13 Aug 2008 16:35:47 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 86117 invoked by uid 500); 13 Aug 2008 16:35:46 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 86106 invoked by uid 99); 13 Aug 2008 16:35:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Aug 2008 09:35:46 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of trygve.hardersen@gmail.com designates 209.85.198.228 as permitted sender) Received: from [209.85.198.228] (HELO rv-out-0506.google.com) (209.85.198.228) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Aug 2008 16:34:47 +0000 Received: by rv-out-0506.google.com with SMTP id f6so47833rvb.55 for ; Wed, 13 Aug 2008 09:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=Gv+Ady1cnQAOeMct81dNUkPi8YKAmLw1psYI1mOcYNE=; b=KdyQQ1korhmBrYjSv0wD4pMm4d6z1ox8Jo+7mMlnQolotXYdjqOiWMWbCIqdhle6rK 1r839LnK8RDj2jOgRYwVkvbC3SVHhemydouetgfWCy21j73qzLGzg5zaMhsNvmdyGgOz y2RY7Q2S9BjVIGmyaqJ4uF6QunFx+uDLyKFvk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=PktfrkkpLqowIiFdGZEnqmCk1rWD9ilTEjWhjweSKDCRFbnCcMY69wYZTuxVk684gj mzt9VudEq7EGgdrvOK3xW9zN1bFNWyoJFXK8bHinlsUZXU2sBV5YKsuBy3ejb6rXDyyF Dcx9x4mRkB+ZpcHDLa7e9b6jngxA0FQWVFHXg= Received: by 10.141.21.6 with SMTP id y6mr6480rvi.226.1218645298710; Wed, 13 Aug 2008 09:34:58 -0700 (PDT) Received: by 10.140.194.13 with HTTP; Wed, 13 Aug 2008 09:34:58 -0700 (PDT) Message-ID: <3e9ed2c20808130934q6b39211kd44900baff9c63f7@mail.gmail.com> Date: Wed, 13 Aug 2008 18:34:58 +0200 From: "Trygve Hardersen" To: user@geronimo.apache.org Subject: Re: Monitoring Memory Usage In-Reply-To: <48A3058F.40407@berghold.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_93775_452582.1218645298711" References: <48A3058F.40407@berghold.net> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_93775_452582.1218645298711 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline What about: Runtime rt = Runtime.getRuntime(); long free = rt.maxMemory() - (rt.totalMemory - rt.freeMemory()); I've been using this (with Tomcat, not Geronimo), and while it's not perfect it gives you an idea of the JVM memory consumption. Trygve 2008/8/13 Peter L. Berghold > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is there a way to programmatically extract from a running Geronimo > instance it's memory usage? Reason I'm asking is I'd like to write a > Nagios plugin for this to provide alarms when the JVM runs out of memory. > > > - -- > > Peter L. Berghold http://www.berghold.net peter@berghold.net > Unix Professional Dog Agility Fan Crazed Cook > "Those who fail to learn from history are condemned to repeat it." > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.5 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFIowWOUM9/01RIhaARAn9WAKCN8+CnDcYYEaQZQItt47dRl5QTcACgsWFt > NHjPF+uuKEvxzXI7vHUNNBc= > =5hm6 > -----END PGP SIGNATURE----- > ------=_Part_93775_452582.1218645298711 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
What about:

Runtime rt = Runtime.getRuntime();
long free = rt.maxMemory() - (rt.totalMemory - rt.freeMemory());

I've been using this (with Tomcat, not Geronimo), and while it's not perfect it gives you an idea of the JVM memory consumption.

Trygve

2008/8/13 Peter L. Berghold <peter@berghold.net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there a way to programmatically extract from a running Geronimo
instance it's memory usage?  Reason I'm asking is I'd like to write a
Nagios plugin for this to provide alarms when the JVM runs out of memory.


- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIowWOUM9/01RIhaARAn9WAKCN8+CnDcYYEaQZQItt47dRl5QTcACgsWFt
NHjPF+uuKEvxzXI7vHUNNBc=
=5hm6
-----END PGP SIGNATURE-----

------=_Part_93775_452582.1218645298711--