Back to index

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

List of all members.

Public Member Functions

 MultigraphThreads (Config config)
String getPrefix ()
void setPrefix (String prefix)
void printConfig (PrintWriter out)
void printValues (PrintWriter out)
AbstractMultiGraphsProvider multigraph (final String name, final AbstractGraphsProvider provider)
 Create a provider that works exactly like the specified provider, but adds a multigraph attribute to the configuration, effectively turning it into a multigraph provider.
AbstractGraphsProvider noGraph (final AbstractGraphsProvider provider)
 Create a provider that works exactly like the specified provider, but adds graph no to the configuration.
AbstractGraphsProvider aliasFor (final AbstractGraphsProvider provider, final String origName)
 Creates an alias for the specified provider.

Static Public Member Functions

static void main (String[] args)
static AbstractMultiGraphsProvider multigraph (final String name, final AbstractGraphsProvider provider, Config config)
static AbstractGraphsProvider noGraph (final AbstractGraphsProvider provider, Config config)
static AbstractGraphsProvider aliasFor (final AbstractGraphsProvider provider, final String origName, final Config config)
 Creates an alias for the specified provider.

Protected Member Functions

Map< String,
AbstractGraphsProvider
getProviders ()
void addWithAlias (Map< String, AbstractGraphsProvider > providers, AbstractGraphsProvider provider, String dataName, String...aliases)
 Utility method that adds a specified provider to the providers Map multiple times: Once as a non-graphing data graph and any number of times as alias graphs.
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 Attributes

static final String PREFIX = "_threads"

Detailed Description

Definition at line 6 of file MultigraphThreads.java.


Constructor & Destructor Documentation

Definition at line 9 of file MultigraphThreads.java.

                                               {
              super(config);
              // can't set the PREFIX itself, because we also need to use config
              // without that prefix for the legacy data storage graphs
              // setPrefix(getPrefix() + PREFIX);
       }

Member Function Documentation

void org.munin.plugin.jmx.AbstractMultiGraphsProvider.addWithAlias ( Map< String, AbstractGraphsProvider providers,
AbstractGraphsProvider  provider,
String  dataName,
String...  aliases 
) [inline, protected, inherited]

Utility method that adds a specified provider to the providers Map multiple times: Once as a non-graphing data graph and any number of times as alias graphs.

Parameters:
providersthe Map of providers to add to
providerthe provider to add to the map
dataNamethe name of the non-graphing instance
aliasesthe names of the alias instances.
See also:
#noGraph(AbstractGraphsProvider)
#aliasFor(AbstractGraphsProvider, String)

Definition at line 81 of file AbstractMultiGraphsProvider.java.

                                                                                          {
              providers.put(dataName, noGraph(provider));
              AbstractGraphsProvider aliasProvider = aliasFor(provider, dataName);
              for (String alias : aliases) {
                     providers.put(alias, aliasProvider);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

AbstractGraphsProvider org.munin.plugin.jmx.AbstractMultiGraphsProvider.aliasFor ( final AbstractGraphsProvider  provider,
final String  origName 
) [inline, inherited]

Creates an alias for the specified provider.

Parameters:
providerprovider to alias
origNamename of the original graph that will contain the data
Returns:
a new provider that aliases the specified one from the provided name (i.e. borrows all data from that provider)

Definition at line 145 of file AbstractMultiGraphsProvider.java.

                                                                                   {
              return aliasFor(provider, getPrefix() + origName, config);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static AbstractGraphsProvider org.munin.plugin.jmx.AbstractMultiGraphsProvider.aliasFor ( final AbstractGraphsProvider  provider,
final String  origName,
final Config  config 
) [inline, static, inherited]

Creates an alias for the specified provider.

Parameters:
providerprovider to alias
origNamename of the original graph that will contain the data
configa Config object
Returns:
a new provider that aliases the specified one from the provided name (i.e. borrows all data from that provider)

Definition at line 167 of file AbstractMultiGraphsProvider.java.

                                          {
              return new AbstractGraphsProvider(config) {

                     @Override
                     public void printConfig(PrintWriter out) {
                            StringWriter stringWriter = new StringWriter();
                            provider.printConfig(new PrintWriter(stringWriter));
                            String config = stringWriter.toString();
                            Set<String> fields = new LinkedHashSet<String>();
                            String graphConfig = null;
                            String fieldConfig = null;
                            // remove existing graph_order directive
                            config = GRAPH_ORDER_PATTERN.matcher(config).replaceAll("");
                            Matcher matcher = FIELD_CONFIG_PATTERN.matcher(config);
                            while (matcher.find()) {
                                   if (graphConfig == null) {
                                          graphConfig = config.substring(0, matcher.start())
                                                        .replaceFirst("\n+$", "");
                                          fieldConfig = config.substring(matcher.start());
                                   }
                                   fields.add(matcher.group(1));
                            }
                            out.println(graphConfig);
                            out.print("graph_order");
                            for (String field : fields) {
                                   out.print(" " + field + "=" + origName + "." + field);
                            }
                            out.println();
                            out.println("update no");
                            out.println(fieldConfig);
                     }

                     @Override
                     public void printValues(PrintWriter out) {
                            // don't print values, as we've got "update no" set
                     }
              };
       }

Here is the call 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:

Definition at line 27 of file AbstractMultiGraphsProvider.java.

                                 {
              return prefix;
       }

Here is the caller graph for this function:

Map<String, AbstractGraphsProvider> org.munin.plugin.jmx.MultigraphThreads.getProviders ( ) [inline, protected, virtual]

Implements org.munin.plugin.jmx.AbstractMultiGraphsProvider.

Definition at line 17 of file MultigraphThreads.java.

                                                                    {
              Map<String, AbstractGraphsProvider> providers = new LinkedHashMap<String, AbstractGraphsProvider>();
              addWithAlias(providers, new Threads(config), "_Threads", PREFIX, PREFIX
                            + ".threads");
              providers.put(PREFIX + ".historical", new ThreadsHistorical(config));
              addWithAlias(providers, new ThreadsDeadlocked(config),
                            "_ThreadsDeadlocked", PREFIX + ".deadlocked");
              return providers;
       }

Here is the call graph for this function:

static void org.munin.plugin.jmx.MultigraphThreads.main ( String[]  args) [inline, static]

Definition at line 27 of file MultigraphThreads.java.

                                              {
              runGraph(args);
       }

Here is the call graph for this function:

Create a provider that works exactly like the specified provider, but adds a multigraph attribute to the configuration, effectively turning it into a multigraph provider.

Definition at line 95 of file AbstractMultiGraphsProvider.java.

                                                            {
              return multigraph(name, provider, config);
       }
static AbstractMultiGraphsProvider org.munin.plugin.jmx.AbstractMultiGraphsProvider.multigraph ( final String  name,
final AbstractGraphsProvider  provider,
Config  config 
) [inline, static, inherited]

Definition at line 100 of file AbstractMultiGraphsProvider.java.

                                                                           {
              return new AbstractMultiGraphsProvider(config) {
                     @Override
                     protected Map<String, AbstractGraphsProvider> getProviders() {
                            return Collections.singletonMap(name, provider);
                     }
              };
       }

Here is the call graph for this function:

Create a provider that works exactly like the specified provider, but adds graph no to the configuration.

Definition at line 114 of file AbstractMultiGraphsProvider.java.

                                                                                    {
              return noGraph(provider, config);
       }

Here is the caller graph for this function:

static AbstractGraphsProvider org.munin.plugin.jmx.AbstractMultiGraphsProvider.noGraph ( final AbstractGraphsProvider  provider,
Config  config 
) [inline, static, inherited]

Definition at line 118 of file AbstractMultiGraphsProvider.java.

                                                                           {
              return new AbstractGraphsProvider(config) {

                     @Override
                     public void printConfig(PrintWriter out) {
                            provider.printConfig(out);
                            out.println("graph no");
                     }

                     @Override
                     public void printValues(PrintWriter out) {
                            provider.printValues(out);
                     }
              };
       }

Here is the call graph for this function:

void org.munin.plugin.jmx.AbstractMultiGraphsProvider.printConfig ( PrintWriter  out) [inline, virtual, inherited]

Implements org.munin.plugin.jmx.AbstractGraphsProvider.

Definition at line 36 of file AbstractMultiGraphsProvider.java.

                                                {
              Map<String, AbstractGraphsProvider> providers = getProviders();
              for (Map.Entry<String, AbstractGraphsProvider> entry : providers
                            .entrySet()) {
                     out.println("multigraph " + getPrefix() + entry.getKey());
                     entry.getValue().printConfig(out);
                     out.println();
              }
       }

Here is the call graph for this function:

Here is the caller 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.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.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.AbstractMultiGraphsProvider.printValues ( PrintWriter  out) [inline, virtual, inherited]

Implements org.munin.plugin.jmx.AbstractGraphsProvider.

Definition at line 47 of file AbstractMultiGraphsProvider.java.

                                                {
              Map<String, AbstractGraphsProvider> providers = getProviders();
              for (Map.Entry<String, AbstractGraphsProvider> entry : providers
                            .entrySet()) {
                     StringWriter sw = new StringWriter();
                     PrintWriter pw = new PrintWriter(sw);
                     entry.getValue().printValues(pw);
                     pw.close();
                     String values = sw.toString().trim();
                     if (values.length() != 0) {
                            out.println("multigraph " + getPrefix() + entry.getKey());
                            out.println(values);
                            out.println();
                     }
              }
       }

Here is the call graph for this function:

Here is the caller 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:

void org.munin.plugin.jmx.AbstractMultiGraphsProvider.setPrefix ( String  prefix) [inline, inherited]

Definition at line 31 of file AbstractMultiGraphsProvider.java.

                                            {
              this.prefix = prefix;
       }

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

Definition at line 10 of file AbstractGraphsProvider.java.

final String org.munin.plugin.jmx.MultigraphThreads.PREFIX = "_threads" [static, private]

Definition at line 7 of file MultigraphThreads.java.


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