/** * print all attributes' values */ public void printAllValues() throws Exception { err("List of all the available keys:"); Object val = null; for (ObjectName oname : hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb : mbinfos) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format, mb.getName(), (val==null)?"":val.toString()); } } }
public void printAllMatchedAttributes(String attrRegExp) throws Exception { err("List of the keys matching " + attrRegExp + " :"); Object val = null; Pattern p = Pattern.compile(attrRegExp); for (ObjectName oname : hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb : mbinfos) { if (p.matcher(mb.getName()).lookingAt()) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format, mb.getName(), (val == null) ? "" : val.toString()); } } } }
/** * get single value by key */ public String getValue(String key) throws Exception { Object val = null; for (ObjectName oname : hadoopObjectNames) { try { val = mbsc.getAttribute(oname, key); } catch (AttributeNotFoundException anfe) { /* just go to the next */ continue; } catch (ReflectionException re) { if (re.getCause() instanceof NoSuchMethodException) { continue; } } err("Info: key = " + key + "; val = " + (val == null ? "null" : val.getClass()) + ":" + val); break; } return (val == null) ? "" : val.toString(); }
err("init: server=" + server + ";port=" + port + ";service=" + service + ";localVMUrl=" + localVMUrl); err("url string for local pid = " + localVMUrl + " = " + url_string); JMXServiceURL url = new JMXServiceURL(url_string); err("Create RMI connector and connect to the RMI connector server" + url); err("\nGet an MBeanServerConnection"); mbsc = jmxc.getMBeanServerConnection(); err("\nDomains:"); err("\tDomain = " + domain); err("\nMBeanServer default domain = " + mbsc.getDefaultDomain()); err("\nMBean count = " + mbsc.getMBeanCount()); err("\nQuery MBeanServer MBeans:"); Set<ObjectName> names = new TreeSet<ObjectName>(mbsc .queryNames(query, null)); err("Hadoop service: " + name);
/** * print all attributes' values */ public void printAllValues() throws Exception { err("List of all the available keys:"); Object val = null; for (ObjectName oname : hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb : mbinfos) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format, mb.getName(), (val==null)?"":val.toString()); } } }
public void printAllMatchedAttributes(String attrRegExp) throws Exception { err("List of the keys matching " + attrRegExp + " :"); Object val = null; Pattern p = Pattern.compile(attrRegExp); for (ObjectName oname : hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb : mbinfos) { if (p.matcher(mb.getName()).lookingAt()) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format, mb.getName(), (val == null) ? "" : val.toString()); } } } }
/** * print all attributes' values */ public void printAllValues() throws Exception { err("List of all the available keys:"); Object val = null; for (ObjectName oname: hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo [] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb: mbinfos) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format,mb.getName(),val.toString()); } } }
public void printAllMatchedAttributes(String attrRegExp) throws Exception { err("List of the keys matching " + attrRegExp + " :"); Object val = null; Pattern p = Pattern.compile(attrRegExp); for (ObjectName oname : hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb : mbinfos) { if (p.matcher(mb.getName()).lookingAt()) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format, mb.getName(), (val == null) ? "" : val.toString()); } } } }
/** * print all attributes' values */ public void printAllValues() throws Exception { err("List of all the available keys:"); Object val = null; for (ObjectName oname : hadoopObjectNames) { err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString()); MBeanInfo mbinfo = mbsc.getMBeanInfo(oname); MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes(); for (MBeanAttributeInfo mb : mbinfos) { val = mbsc.getAttribute(oname, mb.getName()); System.out.format(format, mb.getName(), (val==null)?"":val.toString()); } } }
/** * get single value by key */ public String getValue(String key) throws Exception{ Object val = null; for (ObjectName oname: hadoopObjectNames) { try { val = mbsc.getAttribute(oname, key); } catch (AttributeNotFoundException anfe) { /*just go to the next */ continue; } catch(ReflectionException re) { if (re.getCause() instanceof NoSuchMethodException) { continue; } } err("Info: key = " + key + "; val = " + val); break; } return (val == null) ? null : val.toString(); }
/** * get single value by key */ public String getValue(String key) throws Exception { Object val = null; for (ObjectName oname : hadoopObjectNames) { try { val = mbsc.getAttribute(oname, key); } catch (AttributeNotFoundException anfe) { /* just go to the next */ continue; } catch (ReflectionException re) { if (re.getCause() instanceof NoSuchMethodException) { continue; } } err("Info: key = " + key + "; val = " + (val == null ? "null" : val.getClass()) + ":" + val); break; } return (val == null) ? "" : val.toString(); }
/** * get single value by key */ public String getValue(String key) throws Exception { Object val = null; for (ObjectName oname : hadoopObjectNames) { try { val = mbsc.getAttribute(oname, key); } catch (AttributeNotFoundException anfe) { /* just go to the next */ continue; } catch (ReflectionException re) { if (re.getCause() instanceof NoSuchMethodException) { continue; } } err("Info: key = " + key + "; val = " + (val == null ? "null" : val.getClass()) + ":" + val); break; } return (val == null) ? "" : val.toString(); }
err("init: server=" + server + ";port=" + port + ";service=" + service + ";localVMUrl=" + localVMUrl); err("url string for local pid = " + localVMUrl + " = " + url_string); JMXServiceURL url = new JMXServiceURL(url_string); err("Create RMI connector and connect to the RMI connector server" + url); err("\nGet an MBeanServerConnection"); mbsc = jmxc.getMBeanServerConnection(); err("\nDomains:"); err("\tDomain = " + domain); err("\nMBeanServer default domain = " + mbsc.getDefaultDomain()); err("\nMBean count = " + mbsc.getMBeanCount()); err("\nQuery MBeanServer MBeans:"); Set<ObjectName> names = new TreeSet<ObjectName>(mbsc .queryNames(query, null)); err("Hadoop service: " + name);
err("init: server=" + server + ";port=" + port + ";service=" + service + ";localVMUrl=" + localVMUrl); err("url string for local pid = " + localVMUrl + " = " + url_string); JMXServiceURL url = new JMXServiceURL(url_string); err("Create RMI connector and connect to the RMI connector server" + url); err("\nGet an MBeanServerConnection"); mbsc = jmxc.getMBeanServerConnection(); err("\nDomains:"); err("\tDomain = " + domain); err("\nMBeanServer default domain = " + mbsc.getDefaultDomain()); err("\nMBean count = " + mbsc.getMBeanCount()); err("\nQuery MBeanServer MBeans:"); Set<ObjectName> names = new TreeSet<ObjectName>(mbsc .queryNames(query, null)); err("Hadoop service: " + name);
err("init: server="+server+";port="+port+";service="+ service+";localVMPid="+localVMPid); JMXServiceURL url = new JMXServiceURL(url_string); err("Create RMI connector and connect to the RMI connector server" + url); err("\nGet an MBeanServerConnection"); mbsc = jmxc.getMBeanServerConnection(); err("\nDomains:"); err("\tDomain = " + domain); err("\nMBeanServer default domain = " + mbsc.getDefaultDomain()); err("\nMBean count = " + mbsc.getMBeanCount()); err("\nQuery MBeanServer MBeans:"); Set<ObjectName> names = new TreeSet<ObjectName>(mbsc.queryNames(query, null)); err("hadoop services: " + name);