Back to index

munin  2.0.1
ClassesLoadedTotal.java
Go to the documentation of this file.
00001 package org.munin.plugin.jmx;
00002 
00003 import java.io.IOException;
00004 import java.lang.management.ClassLoadingMXBean;
00005 import java.lang.management.ManagementFactory;
00006 
00007 import org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.Graph;
00008 
00009 @Graph(title = "ClassesLoadedTotal", vlabel = "classes", info = "The total number of classes that have been loaded since the Java virtual machine has started execution.")
00010 public class ClassesLoadedTotal extends AbstractAnnotationGraphsProvider {
00011 
00012        public ClassesLoadedTotal(Config config) {
00013               super(config);
00014        }
00015 
00016        @Field
00017        public long classesLoadedTotal() throws IOException {
00018               ClassLoadingMXBean classmxbean = ManagementFactory
00019                             .newPlatformMXBeanProxy(getConnection(),
00020                                           ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
00021                                           ClassLoadingMXBean.class);
00022               return classmxbean.getTotalLoadedClassCount();
00023        }
00024        
00025        public static void main(String[] args) {
00026               runGraph(args);
00027        }
00028 }