Back to index

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

List of all members.

Public Member Functions

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

Protected Member Functions

 AbstractGraphsProvider (final Config config)
MBeanServerConnection getConnection ()
void printGraphConfig (PrintWriter out, String title, String vlabel, String info, String args, boolean update, boolean graph)
void printFieldConfig (PrintWriter out, String name, String label, String info, String type, String draw, String colour, double min, double max)
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)

Static Private Member Functions

static AbstractGraphsProvider getProvider (Class<?extends AbstractGraphsProvider > providerClass, Config config)
static Config getConfig (String[] args)
static void runGraph (final AbstractGraphsProvider provider, Config config, String[] args)

Private Attributes

MBeanServerConnection connection

Detailed Description

Definition at line 9 of file AbstractGraphsProvider.java.


Constructor & Destructor Documentation

Definition at line 13 of file AbstractGraphsProvider.java.

                                                             {
              if (config == null) {
                     throw new IllegalArgumentException("config must not be null");
              }
              this.config = config;
       }

Here is the caller graph for this function:


Member Function Documentation

static Config org.munin.plugin.jmx.AbstractGraphsProvider.getConfig ( String[]  args) [inline, static, private]

Definition at line 119 of file AbstractGraphsProvider.java.

                                                      {
              String prefix;
              if (args.length >= 2) {
                     prefix = args[1];
              } else {
                     prefix = null;
              }
              return new Config(prefix);
       }

Here is the caller graph for this function:

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

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:

static AbstractGraphsProvider org.munin.plugin.jmx.AbstractGraphsProvider.getProvider ( Class<?extends AbstractGraphsProvider providerClass,
Config  config 
) [inline, static, private]

Definition at line 98 of file AbstractGraphsProvider.java.

                                                                                           {
              try {
                     return providerClass.getConstructor(Config.class).newInstance(
                                   config);
              } catch (NoSuchMethodException e) {
                     // just try default constructor
                     try {
                            return providerClass.newInstance();
                     } catch (Exception e1) {
                            throw new IllegalArgumentException(
                                          "Can't instantiate provider with default constructor: "
                                                        + providerClass, e);
                     }
              } catch (Exception e) {
                     throw new IllegalArgumentException(
                                   "Can't instantiate provider with constructor accepting Config object: "
                                                 + providerClass, e);
              }
       }

Here is the caller graph for this function:

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

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.AbstractGraphsProvider.printFieldConfig ( PrintWriter  out,
String  name,
String  label,
String  info,
String  type,
String  draw,
String  colour,
double  min,
double  max 
) [inline, protected]

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.AbstractGraphsProvider.printGraphConfig ( PrintWriter  out,
String  title,
String  vlabel,
String  info,
String  args,
boolean  update,
boolean  graph 
) [inline, protected]

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:

abstract void org.munin.plugin.jmx.AbstractGraphsProvider.printValues ( PrintWriter  out) [pure virtual]
static void org.munin.plugin.jmx.AbstractGraphsProvider.runGraph ( String[]  args) [inline, static, package]

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 void org.munin.plugin.jmx.AbstractGraphsProvider.runGraph ( final AbstractGraphsProvider  provider,
Config  config,
String[]  args 
) [inline, static, private]

Definition at line 129 of file AbstractGraphsProvider.java.

                                                   {
              try {
                     PrintWriter out = new PrintWriter(System.out);
                     if (args[0].equals("config")) {
                            provider.printConfig(out);
                            if (config.isDirtyConfg()) {
                                   provider.printValues(out);
                            }
                     } else {
                            provider.printValues(out);
                     }
                     out.flush();
              } catch (Exception e) {
                     e.printStackTrace(System.err);
              }
       }

Here is the call graph for this function:

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

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

Definition at line 10 of file AbstractGraphsProvider.java.

Definition at line 11 of file AbstractGraphsProvider.java.


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