Back to index

munin  2.0.1
MemoryAllocatedHeap.java
Go to the documentation of this file.
00001 package org.munin.plugin.jmx;
00002 
00003 import java.lang.management.ManagementFactory;
00004 import java.lang.management.MemoryMXBean;
00005 
00006 import org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.Graph;
00007 
00008 @Graph(title = "Allocated Heap Memory", vlabel = "bytes", args = "--base 1024 -l 0", info = "The current memory usage of the heap that is used for object allocation.")
00009 public class MemoryAllocatedHeap extends AbstractMemoryUsageProvider {
00010        public MemoryAllocatedHeap(Config config) {
00011               super(config);
00012        }
00013 
00014        @Override
00015        protected void prepareValues() throws Exception {
00016               memoryUsage = ManagementFactory.newPlatformMXBeanProxy(getConnection(),
00017                             ManagementFactory.MEMORY_MXBEAN_NAME, MemoryMXBean.class).getHeapMemoryUsage();
00018        }
00019 
00020        public static void main(String args[]) {
00021               runGraph(args);
00022        }
00023 }