Steve,

Here are some ways to access these statistics using JMX.

To access JVM metrics for a member including heap usage using JMX, invoke the 
MemberMXBean showJVMMetrics operation.

These values are gotten from ManagementFactory.getMemoryMXBean(), 
ManagementFactory.getThreadMXBean() and 
ManagementFactory.getGarbageCollectorMXBeans().

The DiskStoreMXBean attributes contain the disk metrics you're looking for 
(including TotalBytesOnDisk). These are per DiskStore per member.

I attached a couple jconsole charts showing these.

jconsole_jvm_metrics.png - shows a member's JVMMetrics
jconsole_diskstore_attributes.png - shows a DiskStore's attributes

I also attached a java client that dumps the JVM metrics, but it can easily be 
changed to periodically get them and take action depending on the state.

java DumpJvmMetrics localhost 1091
...
=======================================================
GemFire:type=Member,member=server-1
=======================================================
JVM Metrics:
committedMemory->518979584
gcCount->0
gcTimeMillis->31
initMemory->536870912
maxMemory->8502706176
totalThreads->60
usedMemory->145895584
...

I also attached a java client that dumps the DiskStore attributes, but it can 
easily be changed to periodically get them and take action depending on the 
state.

java DumpDiskStores localhost 1091
...
=======================================================
GemFire:service=DiskStore,name=disk_store_1,type=Member,member=server-1
=======================================================
Disk Store:
attribute=Name; value=disk_store_1
attribute=DiskReadsRate; value=0.0
attribute=DiskWritesRate; value=0.0
attribute=TotalBackupInProgress; value=0
attribute=TotalBackupCompleted; value=0
attribute=ForceCompactionAllowed; value=false
attribute=MaxOpLogSize; value=10
attribute=DiskDirectories; value=[/path/to/server-1/.]
attribute=DiskReadsAvgLatency; value=0
attribute=DiskWritesAvgLatency; value=0
attribute=FlushTimeAvgLatency; value=0
attribute=TotalRecoveriesInProgress; value=0
attribute=TimeInterval; value=1000
attribute=AutoCompact; value=true
attribute=CompactionThreshold; value=50
attribute=WriteBufferSize; value=32768
attribute=DiskUsageWarningPercentage; value=90.0
attribute=DiskUsageCriticalPercentage; value=99.0
attribute=QueueSize; value=0
attribute=TotalQueueSize; value=0
attribute=TotalBytesOnDisk; value=2216241
attribute=DiskUsagePercentage; value=-1.0
attribute=DiskFreePercentage; value=-1.0
...

Thanks,
Barry
________________________________
From: steve mathew <steve.mathe...@gmail.com>
Sent: Wednesday, July 8, 2020 11:20 AM
To: dev@geode.apache.org <dev@geode.apache.org>
Cc: u...@geode.apache.org <u...@geode.apache.org>
Subject: Re: API (Recommanded way) to get heap and disk usage for cluster nodes

Thanks Jacob and Anthony for sharing the details.

I have tried to understand list_of_mbeans supported but finding it tough to
understand completely. I can see "DiskStoreMXBean" and document says it can
provide region(s) specific disk usage.

For my experiment, looking for *mbeans that provide data node's (member)
specific heap and disk usage*.. It would be great help if someone can guide
me about these MBeans and how to use it to get the required stats (or point
me some reference outlining this details.)

Thanks
-Steve

On Wed, Jul 8, 2020 at 10:27 PM Anthony Baker <bak...@vmware.com> wrote:

> Another option is JMX, see
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeode.apache.org%2Fdocs%2Fguide%2F19%2Fmanaging%2Fmanagement%2Flist_of_mbeans.html&amp;data=02%7C01%7Cboglesby%40vmware.com%7C2bb9bdb99af64d9f6cfb08d8236ba39c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637298292514607524&amp;sdata=ArIBcLD2FLtBkup6bI7tNlwTWN0GBkc1Z1kOIdzypnU%3D&amp;reserved=0
> .
>
> Anthony
>
>
> On Jul 8, 2020, at 9:24 AM, Jacob Barrett <jabarr...@vmware.com<mailto:
> jabarr...@vmware.com>> wrote:
>
> Steve,
>
> Geode is in a transition from its on disk proprietary stats format to
> utilizing Micrometer.io<
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmicrometer.io%2F&amp;data=02%7C01%7Cboglesby%40vmware.com%7C2bb9bdb99af64d9f6cfb08d8236ba39c%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637298292514607524&amp;sdata=bcAudAbLBnF1nySFevDnykilL3IOtRFwSuVy5C0jdkc%3D&amp;reserved=0>.
> Some of what you are looking for may already be exposed via Micrometer. If
> so you can just use whatever registry of your choice to publish those
> stats. If the metric you need is not converted to Micrometer its pretty
> easy in most cases to refactor it and we would welcome a JIRA or even
> better a PR.
>
> -Jake
>
>
> On Jul 7, 2020, at 9:58 PM, steve mathew <steve.mathe...@gmail.com<mailto:
> steve.mathe...@gmail.com>> wrote:
>
> Hello Geode Dev and users
>
> We have a requirement to constantly monitor the resource utilization (Disk
> and Heap usage) for the cluster nodes from external processes.
> Seeking help to understand the recommended way (or APIs available ) to get
> this in a separate process...We need to trigger some actions/custom logic
> if it goes above some threshold..
>
> Thanks
> Steve.
>
>
>

Reply via email to