Back to index

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

List of all members.

Public Member Functions

 Beans (String args[])

Static Public Member Functions

static void main (String args[])

Protected Member Functions

MBeanServerConnection getConnection ()
void populateBeanList (String strName)
void printBeans ()

Protected Attributes

ObjectName name
Set< ObjectName > mbeans
Config config
MBeanServerConnection connection
String[] filter

Static Private Member Functions

static Config getConfig (String[] args)

Detailed Description

Definition at line 18 of file Beans.java.


Constructor & Destructor Documentation

org.munin.plugin.jmx.Beans.Beans ( String  args[]) [inline]

Definition at line 26 of file Beans.java.

                                {
        config = getConfig(args);
        filter = new String[args.length - 1];
        this.populateBeanList(args[0]);
        for(int i=1; i<args.length; i++) {
            filter[i-1]=args[i];
        }
        java.util.Arrays.sort(filter);
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

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

Definition at line 89 of file Beans.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.Beans.getConnection ( ) [inline, protected]

Definition at line 36 of file Beans.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 void org.munin.plugin.jmx.Beans.main ( String  args[]) [inline, static]

Definition at line 100 of file Beans.java.

                                           {
        Beans bs = new Beans(args);
        bs.printBeans();
    }

Here is the call graph for this function:

void org.munin.plugin.jmx.Beans.populateBeanList ( String  strName) [inline, protected]

Definition at line 51 of file Beans.java.

                                                    {
        try {
            name = new ObjectName(strName);
        } catch (MalformedObjectNameException e) {
            throw new IllegalStateException("Failed to get provider class", e);
        }

        try {
            mbeans = getConnection().queryNames(name,null);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to get provider class", e);
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void org.munin.plugin.jmx.Beans.printBeans ( ) [inline, protected]

Definition at line 65 of file Beans.java.

                                {
        for (ObjectName bean : mbeans) {
            MBeanInfo info;
            try {
                info = connection.getMBeanInfo(bean);
            } catch (Exception e) {
                throw new IllegalStateException("Failed to get provider class", e);
            }
            MBeanAttributeInfo[] attributes = info.getAttributes();
            for (MBeanAttributeInfo attr : attributes) {
                if (filter.length == 0 || java.util.Arrays.binarySearch(filter, attr.getName()) >= 0) {
                    Object val;
                    try {
                        val = connection.getAttribute(bean,attr.getName());
                    } catch (Exception e) {
                        val = e;
                    }

                    System.out.println(bean + "\t" + attr.getName() + "\t" + val);
                }
            }
        }
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 22 of file Beans.java.

MBeanServerConnection org.munin.plugin.jmx.Beans.connection [protected]

Definition at line 23 of file Beans.java.

String [] org.munin.plugin.jmx.Beans.filter [protected]

Definition at line 24 of file Beans.java.

Set<ObjectName> org.munin.plugin.jmx.Beans.mbeans [protected]

Definition at line 21 of file Beans.java.

ObjectName org.munin.plugin.jmx.Beans.name [protected]

Definition at line 20 of file Beans.java.


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