Back to index

munin  2.0.1
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Package Functions | Private Member Functions | Private Attributes
org.munin.plugin.jmx.GarbageCollectionInfo Class Reference
Inheritance diagram for org.munin.plugin.jmx.GarbageCollectionInfo:
Inheritance graph
[legend]
Collaboration diagram for org.munin.plugin.jmx.GarbageCollectionInfo:
Collaboration graph
[legend]

List of all members.

Classes

class  Count
class  Time

Public Member Functions

void printValues (PrintWriter out)
void printConfig (PrintWriter out)

Protected Member Functions

 GarbageCollectionInfo (Config config)
void printFieldsConfig (PrintWriter out)
abstract String getFieldName (GarbageCollectorMXBean collector)
abstract String getFieldLabel (GarbageCollectorMXBean collector)
abstract String getFieldInfo (GarbageCollectorMXBean collector)
abstract Object getValue (GarbageCollectorMXBean collector)
String getCollectorInfo (GarbageCollectorMXBean collector)
void printGraphConfig (PrintWriter out)
void printGraphConfig (PrintWriter out, String title, String vlabel, String info, String args, boolean update, boolean graph)
void printFieldConfig (PrintWriter out, AccessibleObject accessible)
void printFieldConfig (PrintWriter out, String name, String label, String info, String type, String draw, String colour, double min, double max)
String getFieldName (AccessibleObject accessible)
void printFieldValue (PrintWriter out, AccessibleObject accessible)
void prepareValues () throws Exception
MBeanServerConnection getConnection ()
void printFieldAttribute (PrintWriter out, String fieldName, String attributeName, Object value)

Static Protected Member Functions

static String toFieldName (String name)

Protected Attributes

final Config config

Static Package Functions

static void runGraph (String[] args)

Private Member Functions

Collection
< GarbageCollectorMXBean > 
getCollectors ()

Private Attributes

Collection
< GarbageCollectorMXBean > 
collectors

Detailed Description

Definition at line 15 of file GarbageCollectionInfo.java.


Constructor & Destructor Documentation

Definition at line 18 of file GarbageCollectionInfo.java.

                                                      {
              super(config);
       }

Member Function Documentation

String org.munin.plugin.jmx.GarbageCollectionInfo.getCollectorInfo ( GarbageCollectorMXBean  collector) [inline, protected]

Definition at line 79 of file GarbageCollectionInfo.java.

                                                                           {
              StringBuilder builder = new StringBuilder(collector.getName());
              builder.append(" collector (handles these memory pools: ");
              boolean first = true;
              for (String poolName : collector.getMemoryPoolNames()) {
                     builder.append(poolName);
                     if (first) {
                            first = false;
                     } else {
                            builder.append(", ");
                     }
              }
              builder.append(")");
              return builder.toString();
       }

Here is the caller graph for this function:

Collection<GarbageCollectorMXBean> org.munin.plugin.jmx.GarbageCollectionInfo.getCollectors ( ) [inline, private]

Definition at line 24 of file GarbageCollectionInfo.java.

                                                                  {
              if (collectors == null) {
                     try {
                            ObjectName gcName = new ObjectName(
                                          ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
                                                        + ",*");

                            // ensure that the MBeans are sorted consistently
                            Set<ObjectName> mbeans = new TreeSet<ObjectName>(getConnection()
                                          .queryNames(gcName, null));
                            collectors = new ArrayList<GarbageCollectorMXBean>(mbeans
                                          .size());
                            for (ObjectName objectName : mbeans) {
                                   GarbageCollectorMXBean collector = ManagementFactory
                                                 .newPlatformMXBeanProxy(getConnection(), objectName
                                                               .getCanonicalName(),
                                                               GarbageCollectorMXBean.class);
                                   collectors.add(collector);
                            }
                     } catch (IOException e) {
                            e.printStackTrace();
                     } catch (MalformedObjectNameException e) {
                            e.printStackTrace();
                     }
              }
              return collectors;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

MBeanServerConnection org.munin.plugin.jmx.AbstractGraphsProvider.getConnection ( ) [inline, protected, inherited]

Definition at line 20 of file AbstractGraphsProvider.java.

                                                       {
              if (connection == null) {
                     try {
                            connection = BasicMBeanConnection.get(config);
                     } catch (MalformedURLException e) {
                            throw new IllegalStateException(
                                          "Failed to get MBean Server Connection", e);
                     } catch (IOException e) {
                            throw new IllegalStateException(
                                          "Failed to get MBean Server Connection", e);
                     }
              }
              return connection;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

abstract String org.munin.plugin.jmx.GarbageCollectionInfo.getFieldInfo ( GarbageCollectorMXBean  collector) [protected, pure virtual]

Implemented in org.munin.plugin.jmx.GarbageCollectionInfo.Time, and org.munin.plugin.jmx.GarbageCollectionInfo.Count.

Here is the caller graph for this function:

abstract String org.munin.plugin.jmx.GarbageCollectionInfo.getFieldLabel ( GarbageCollectorMXBean  collector) [protected, pure virtual]

Implemented in org.munin.plugin.jmx.GarbageCollectionInfo.Time, and org.munin.plugin.jmx.GarbageCollectionInfo.Count.

Here is the caller graph for this function:

abstract String org.munin.plugin.jmx.GarbageCollectionInfo.getFieldName ( GarbageCollectorMXBean  collector) [protected, pure virtual]

Implemented in org.munin.plugin.jmx.GarbageCollectionInfo.Time, and org.munin.plugin.jmx.GarbageCollectionInfo.Count.

Here is the caller graph for this function:

String org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.getFieldName ( AccessibleObject  accessible) [inline, protected, inherited]

Definition at line 89 of file AbstractAnnotationGraphsProvider.java.

                                                                  {
              String fieldName = accessible.getAnnotation(Field.class).name();
              if (fieldName.length() == 0) {
                     String n;
                     if (accessible instanceof Method) {
                            n = ((Method) accessible).getName();
                     } else if (accessible instanceof java.lang.reflect.Field) {
                            n = ((java.lang.reflect.Field) accessible).getName();
                     } else {
                            throw new IllegalArgumentException(
                                          "AccessibleObject must be a field or a method: "
                                                        + accessible);
                     }
                     fieldName = n.substring(0, 1).toUpperCase() + n.substring(1);
              }
              return fieldName;
       }

Here is the caller graph for this function:

abstract Object org.munin.plugin.jmx.GarbageCollectionInfo.getValue ( GarbageCollectorMXBean  collector) [protected, pure virtual]

Implemented in org.munin.plugin.jmx.GarbageCollectionInfo.Time, and org.munin.plugin.jmx.GarbageCollectionInfo.Count.

Here is the caller graph for this function:

void org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.prepareValues ( ) throws Exception [inline, protected, inherited]
void org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.printConfig ( PrintWriter  out) [inline, virtual, inherited]

Implements org.munin.plugin.jmx.AbstractGraphsProvider.

Definition at line 23 of file AbstractAnnotationGraphsProvider.java.

Here is the call graph for this function:

void org.munin.plugin.jmx.AbstractGraphsProvider.printFieldAttribute ( PrintWriter  out,
String  fieldName,
String  attributeName,
Object  value 
) [inline, protected, inherited]

Definition at line 75 of file AbstractGraphsProvider.java.

                                                         {
              if (value != null) {
                     String stringValue = String.valueOf(value);
                     if (stringValue.length() > 0) {
                            out.println(fieldName + "." + attributeName + " " + value);
                     }
              }
       }

Here is the caller graph for this function:

void org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.printFieldConfig ( PrintWriter  out,
AccessibleObject  accessible 
) [inline, protected, inherited]

Definition at line 46 of file AbstractAnnotationGraphsProvider.java.

                                                                                     {
              Field field = accessible.getAnnotation(Field.class);
              String fieldName = getFieldName(accessible);
              String fieldLabel = field.label();
              if (fieldLabel.length() == 0) {
                     fieldLabel = fieldName;
              }

              printFieldConfig(out, fieldName, fieldLabel, field.info(),
                            field.type(), field.draw(), field.colour(), field.min(), field
                                          .max());
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void org.munin.plugin.jmx.AbstractGraphsProvider.printFieldConfig ( PrintWriter  out,
String  name,
String  label,
String  info,
String  type,
String  draw,
String  colour,
double  min,
double  max 
) [inline, protected, inherited]

Definition at line 59 of file AbstractGraphsProvider.java.

                                 {
              printFieldAttribute(out, name, "label", label);
              printFieldAttribute(out, name, "info", info);
              printFieldAttribute(out, name, "type", type);
              if (!Double.isNaN(min)) {
                     printFieldAttribute(out, name, "min", min);
              }
              if (!Double.isNaN(max)) {
                     printFieldAttribute(out, name, "max", max);
              }
              printFieldAttribute(out, name, "draw", draw);
              printFieldAttribute(out, name, "colour", colour);
       }

Here is the call graph for this function:

void org.munin.plugin.jmx.GarbageCollectionInfo.printFieldsConfig ( PrintWriter  out) [inline, protected]

Reimplemented from org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.

Definition at line 53 of file GarbageCollectionInfo.java.

                                                         {
              for (GarbageCollectorMXBean collector : getCollectors()) {
                     String name = getFieldName(collector);
                     String label = getFieldLabel(collector);
                     String info = getFieldInfo(collector);
                     printFieldConfig(out, name, label, info, "DERIVE", null, null, 0,
                                   Double.NaN);
              }
       }

Here is the call graph for this function:

void org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.printFieldValue ( PrintWriter  out,
AccessibleObject  accessible 
) [inline, protected, inherited]

Reimplemented in org.munin.plugin.jmx.AbstractMemoryPoolProvider.

Definition at line 136 of file AbstractAnnotationGraphsProvider.java.

                                                                                    {
              String fieldName = getFieldName(accessible);
              try {
                     Object value = getFieldValue(accessible);
                     printFieldAttribute(out, fieldName, "value", value);
              } catch (Exception e) {
                     System.err.println("Failed to get value for field " + fieldName
                                   + ": " + e.getMessage());
                     e.printStackTrace();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.printGraphConfig ( PrintWriter  out) [inline, protected, inherited]

Reimplemented in org.munin.plugin.jmx.MemoryPoolUsageProvider.

Definition at line 28 of file AbstractAnnotationGraphsProvider.java.

                                                        {
              Graph graph = getClass().getAnnotation(Graph.class);
              if (graph == null) {
                     throw new IllegalArgumentException(getClass()
                                   + " doesn't have @Graph annotation");
              }
              String graphTitle = "JVM (port " + config.getPort() + ") "
                            + graph.title();
              printGraphConfig(out, graphTitle, graph.vlabel(), graph.info(), graph
                            .args(), graph.update(), graph.graph());
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void org.munin.plugin.jmx.AbstractGraphsProvider.printGraphConfig ( PrintWriter  out,
String  title,
String  vlabel,
String  info,
String  args,
boolean  update,
boolean  graph 
) [inline, protected, inherited]

Reimplemented in org.munin.plugin.jmx.AbstractMemoryPoolProvider.

Definition at line 39 of file AbstractGraphsProvider.java.

                                    {
              out.println("graph_title " + title);
              out.println("graph_vlabel " + vlabel);
              if (info != null && info.length() > 0) {
                     out.println("graph_info " + info);
              }
              if (args != null && args.length() > 0) {
                     out.println("graph_args " + args);
              }
              out.println("graph_category " + config.getCategory());
              if (!update) {
                     out.println("update no");
              }
              if (!graph) {
                     out.println("graph no");
              }
       }

Here is the call graph for this function:

void org.munin.plugin.jmx.GarbageCollectionInfo.printValues ( PrintWriter  out) [inline, virtual]

Reimplemented from org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.

Definition at line 64 of file GarbageCollectionInfo.java.

                                                {
                     for (GarbageCollectorMXBean collector : getCollectors()) {
                            String name = getFieldName(collector);
                            printFieldAttribute(out, name, "value", getValue(collector));
                     }
       }

Here is the call graph for this function:

static void org.munin.plugin.jmx.AbstractGraphsProvider.runGraph ( String[]  args) [inline, static, package, inherited]

Definition at line 85 of file AbstractGraphsProvider.java.

                                           {
              String providerClassName = Thread.currentThread().getStackTrace()[2].getClassName();
              Class<? extends AbstractGraphsProvider> providerClass;
              try {
                     providerClass = Class.forName(providerClassName).asSubclass(AbstractGraphsProvider.class);
              } catch (ClassNotFoundException e) {
                     throw new IllegalStateException("Failed to get provider class", e);
              }
              Config config = getConfig(args);
              AbstractGraphsProvider provider = getProvider(providerClass, config);
              runGraph(provider, config, args);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static String org.munin.plugin.jmx.AbstractGraphsProvider.toFieldName ( String  name) [inline, static, protected, inherited]

Definition at line 147 of file AbstractGraphsProvider.java.

                                                        {
              return name.replaceAll("[^A-Za-z0-9_]", "_");
       }

Here is the caller graph for this function:


Member Data Documentation

Collection<GarbageCollectorMXBean> org.munin.plugin.jmx.GarbageCollectionInfo.collectors [private]

Definition at line 22 of file GarbageCollectionInfo.java.

Definition at line 10 of file AbstractGraphsProvider.java.


The documentation for this class was generated from the following file: