@Override public void apply(Attrib input) { // The mbean "PooledDataSource" has already a "0numFailChecDfltUsr" alias. Therefore the // JmxConfiggenerator created a "NAME_CRASH"-alias. We manually overwrite the value here to a valid one if ("0numFailedCheckinsDfltUsr_NAME_CRASH_AS_19_CHAR_VALUE".equals(input.getAlias()) && "numFailedCheckinsDefaultUser".equals(input.getName())) { input.setAlias("1numFailChecDfltUsr"); } } });
/** * Extracts all Attribute and Composite Attribute Names * from the given MBean. * * @param bean The MBean to extract attributes from. * @return An unmodifiable list of Attribute/Composite Attribute Names. */ private List<String> extractAttributeNames(Mbean bean) { List<String> attributes = new ArrayList<>(); for (Attrib eachAttrib : bean.getAttribList()) { attributes.add(eachAttrib.getName()); } for (CompAttrib eachCompAttrib : bean.getCompAttribList()) { attributes.add(eachCompAttrib.getName()); } return Collections.unmodifiableList(attributes); }
public Attrib getAttrib() { for (Attrib eachAttrib : getMbean().getAttribList()) { if (Objects.equals(getCollectedAttribute().getName(), eachAttrib.getName())) { return eachAttrib; } } return null; }
/** * Extracts all Attribute and Composite Attribute Names * from the given MBean. * * @param bean The MBean to extract attributes from. * @return An unmodifiable list of Attribute/Composite Attribute Names. */ private List<String> extractAttributeNames(Mbean bean) { List<String> attributes = new ArrayList<>(); for (Attrib eachAttrib : bean.getAttribList()) { attributes.add(eachAttrib.getName()); } for (CompAttrib eachCompAttrib : bean.getCompAttribList()) { attributes.add(eachCompAttrib.getName()); } return Collections.unmodifiableList(attributes); }
public DetectMBeansJob(JmxConfigGeneratorUI ui, ServiceConfig config) { this.ui = Objects.requireNonNull(ui); this.config = Objects.requireNonNull(config); filterMap.put(Mbean.class, (Consumer<Mbean>) input -> { // The default PooledDataSource name is "com.mchange.v2.c3p0.PooledDataSource[1hge1gv9a1li8lwdjzwyop|290e7d09]". // We remove the weired part at the end if (input.getName().contains("com.mchange.v2.c3p0.PooledDataSource")) { input.setName("com.mchange.v2.c3p0.PooledDataSource"); } }); filterMap.put(Attrib.class, (Consumer<Attrib>) input -> { // The mbean "PooledDataSource" has already a "0numFailChecDfltUsr" alias. Therefore the // JmxConfiggenerator created a "NAME_CRASH"-alias. We manually overwrite the value here to a valid one if ("0numFailedCheckinsDfltUsr_NAME_CRASH_AS_19_CHAR_VALUE".equals(input.getAlias()) && "numFailedCheckinsDefaultUser".equals(input.getName())) { input.setAlias("1numFailChecDfltUsr"); } }); }
public Attrib getAttrib() { for (Attrib eachAttrib : getMbean().getAttribList()) { if (Objects.equals(getCollectedAttribute().getName(), eachAttrib.getName())) { return eachAttrib; } } return null; }
private Collection<Report> generateAttributeReportsByMBean(Mbean mbean) { Collection<Report> reports = new ArrayList<>(); for (Attrib attrib : mbean.getAttribList()) { final String title = String.format("%s[%s]", mbean.getObjectname().toString() , attrib.getName()); final String reportId = StringUtils.deleteWhitespace(mbean.getName()) + "." + attrib.getAlias() + "." + ATTRIBUTEREPORT; Report report = new Report(reportId, title, title, "verticalLabel"); report.addGraph(new Graph(attrib.getAlias(), attrib.getName(), attrib.getAlias(), Colors.getNextColor(), Colors.getNextColor(), Colors.getNextColor())); reports.add(report); Colors.resetColor(); } return reports; }
private Collection<Report> generateAttributeReportsByMBean(Mbean mbean) { Collection<Report> reports = new ArrayList<>(); for (Attrib attrib : mbean.getAttribList()) { final String title = String.format("%s[%s]", mbean.getObjectname().toString() , attrib.getName()); final String reportId = StringUtils.deleteWhitespace(mbean.getName()) + "." + attrib.getAlias() + "." + ATTRIBUTEREPORT; Report report = new Report(reportId, title, title, "verticalLabel"); report.addGraph(new Graph(attrib.getAlias(), attrib.getName(), attrib.getAlias(), Colors.getNextColor(), Colors.getNextColor(), Colors.getNextColor())); reports.add(report); Colors.resetColor(); } return reports; }
dsList.put(objectName + "|" + attr.getName(), ds); } else { LOG.warn("buildDataSourceList: Data type '{}' not supported. Only integer-type data may be stored in RRD. MBean object '{}' will not be mapped to RRD data source.", attr.getType(), attr.getAlias());
dsList.put(objectName + "|" + attr.getName(), ds); } else { LOG.warn("buildDataSourceList: Data type '{}' not supported. Only integer-type data may be stored in RRD. MBean object '{}' will not be mapped to RRD data source.", attr.getType(), attr.getAlias());
private Collection<Report> generateMbeanReportsByMBean(Mbean mbean) { Collection<Report> reports = new ArrayList<>(); if (!mbean.getAttribList().isEmpty()) { String reportId = StringUtils.deleteWhitespace(mbean.getName()) + "." + MBEANREPORT; Report report = new Report(reportId, mbean.getName(), mbean.getName(), "verticalLabel"); for (Attrib attrib : mbean.getAttribList()) { report.addGraph(new Graph(attrib.getAlias(), attrib.getName(), attrib.getAlias(), Colors.getNextColor(), Colors.getNextColor(), Colors.getNextColor())); } reports.add(report); Colors.resetColor(); } return reports; }
private Collection<Report> generateMbeanReportsByMBean(Mbean mbean) { Collection<Report> reports = new ArrayList<>(); if (!mbean.getAttribList().isEmpty()) { String reportId = StringUtils.deleteWhitespace(mbean.getName()) + "." + MBEANREPORT; Report report = new Report(reportId, mbean.getName(), mbean.getName(), "verticalLabel"); for (Attrib attrib : mbean.getAttribList()) { report.addGraph(new Graph(attrib.getAlias(), attrib.getName(), attrib.getAlias(), Colors.getNextColor(), Colors.getNextColor(), Colors.getNextColor())); } reports.add(report); Colors.resetColor(); } return reports; }
public static Map<String, BeanInfo> getMBeanInfo(JmxCollection collection) { final Map<String, BeanInfo> map = new HashMap<String, BeanInfo>(); if (collection == null) { return Collections.unmodifiableMap(map); } for (Mbean mbean : collection.getMbeans()) { BeanInfo beanInfo = new BeanInfo(); beanInfo.setMbeanName(mbean.getName()); beanInfo.setObjectName(mbean.getObjectname()); beanInfo.setKeyField(mbean.getKeyfield()); beanInfo.setExcludes(mbean.getExclude()); beanInfo.setKeyAlias(mbean.getKeyAlias()); List<String> attribNameList = new ArrayList<String>(); List<String> compAttribNameList = new ArrayList<String>(); for (CompAttrib myCa : mbean.getCompAttribList()) { for (CompMember myCm : myCa.getCompMemberList()) { attribNameList.add(myCa.getName() + "|" + myCm.getName()); compAttribNameList.add(myCa.getName() + "|" + myCm.getName()); } } for (Attrib myA : mbean.getAttribList()) { attribNameList.add(myA.getName()); } beanInfo.setAttributes(attribNameList); beanInfo.setCompositeAttributes(compAttribNameList); map.put(mbean.getObjectname(), beanInfo); } return Collections.unmodifiableMap(map); }
/** * Clones an Attrib object. Makes a deep copy! * * @param input * @return */ public static Attrib clone(Attrib input) { Attrib output = new Attrib(); output.setAlias(input.getAlias()); output.setMaxval(input.getMaxval()); output.setMinval(input.getMinval()); output.setName(input.getName()); output.setType(input.getType()); return output; }
/** * Clones an Attrib object. Makes a deep copy! * * @param input * @return */ public static Attrib clone(Attrib input) { Attrib output = new Attrib(); output.setAlias(input.getAlias()); output.setMaxval(input.getMaxval()); output.setMinval(input.getMinval()); output.setName(input.getName()); output.setType(input.getType()); return output; }