/** * The default constructor - initializes the values * * @param cat a {@link org.opennms.netmgt.config.categories.Category} object. * @param commonRule a {@link java.lang.String} object. */ public RTCCategory(Category cat, String commonRule) { setLabel(cat.getLabel()); setComment(cat.getComment().orElse(null)); setRule(cat.getRule()); setNormalThreshold(cat.getNormalThreshold()); setWarningThreshold(cat.getWarningThreshold()); setServices(cat.getServices()); m_effectiveRule = "(" + commonRule + ") & (" + cat.getRule() + ")"; }
/** * Create an empty category with nothing other than a name. This represents * a category with no RTC data. * * @param categoryName a {@link java.lang.String} object. */ protected Category(String categoryName) { m_categoryDef = new org.opennms.netmgt.config.categories.Category(); m_categoryDef.setLabel(categoryName); m_categoryDef.setNormalThreshold(0d); m_categoryDef.setWarningThreshold(0d); m_rtcCategory = null; m_lastUpdated = null; }
public Category(final String label, final String comment, final Double normalThreshold, final Double warningThreshold, final String rule, final String... services) { setLabel(label); setComment(comment); setNormalThreshold(normalThreshold); setWarningThreshold(warningThreshold); setRule(rule); m_services.addAll(Arrays.asList(services)); }
/** * Return the unique name for this category. * * @return a {@link java.lang.String} object. */ @XmlAttribute(name="name") public String getName() { return m_categoryDef == null? null : m_categoryDef.getLabel(); }
@Override public synchronized String getEffectiveRule(final String catlabel) { for (final CategoryGroup cg : m_config.getCategoryGroups()) { for (final Category cat : cg.getCategories()) { if (cat.getLabel().equals(catlabel)) { return "(" + cg.getCommon().getRule() + ") & (" + cat.getRule() + ")"; } } } return null; }
PreparedStatement outagesGetStmt = null; String categoryName = category.getLabel(); try { CategoryFactory.init(); LOG.debug("Number of IPs satisfying rule: {}", nodeIPs.size()); final List<String> monitoredServices = new ArrayList<String>(category.getServices()); LOG.debug("categories in monitoredServices = {}", monitoredServices);
/** * Return the value considered to be the minimum value below the "normal" * value where only a warning is necessary. Below this value the category's * value will be considered unacceptable. * * @return a double. */ @XmlAttribute(name="warning-threshold") public double getWarningThreshold() { return m_categoryDef == null? null : m_categoryDef.getWarningThreshold(); }
/** * Return the value considered to be the minimum "normal" value. * * @return a double. */ @XmlAttribute(name="normal-threshold") public double getNormalThreshold() { return m_categoryDef == null? null : m_categoryDef.getNormalThreshold(); }
/** * Return a description explaining this category. * * @return a {@link java.lang.String} object. */ @XmlElement(name="comment") public String getComment() { return m_categoryDef == null? null : m_categoryDef.getComment().orElse(null); }
/** * Return the rule for the specified category. * * @param catlabel * the label for the category whose services list is needed * @return the rule for the specified category, null if the category is not * found */ public String getRule(final String catlabel) { final Category cat = getCategory(catlabel); return (cat == null? null : cat.getRule()); }
/** * Return the services list for the specified category. * * @param catlabel * the label for the category whose services list is needed * @return the services list for the specified category, null if category is * not found */ public String[] getServices(final String catlabel) { final Category cat = getCategory(catlabel); return (cat == null? null : cat.getServices().toArray(new String[0])); }
/** * Return the unique name for this category. * * @return a {@link java.lang.String} object. */ @XmlAttribute(name="name") public String getName() { return m_categoryDef == null? null : m_categoryDef.getLabel(); }
/** * {@inheritDoc} * * Return the effective rule for the specified category. The category rule * ANDed with the rule of the category group that the category belongs to. */ @Override public String getEffectiveRule(final String catlabel) { try { getReadLock().lock(); for (final CategoryGroup cg : m_config.getCategoryGroups()) { for (final Category cat : cg.getCategories()) { if (cat.getLabel().equals(catlabel)) { return "(" + cg.getCommon().getRule() + ") & (" + cat.getRule() + ")"; } } } } finally { getReadLock().unlock(); } return null; }
PreparedStatement outagesGetStmt = null; String categoryName = category.getLabel(); try { CategoryFactory.init(); LOG.debug("Number of IPs satisfying rule: {}", nodeIPs.size()); final List<String> monitoredServices = new ArrayList<String>(category.getServices()); LOG.debug("categories in monitoredServices = {}", monitoredServices);
/** * Return the value considered to be the minimum value below the "normal" * value where only a warning is necessary. Below this value the category's * value will be considered unacceptable. * * @return a double. */ @XmlAttribute(name="warning-threshold") public double getWarningThreshold() { return m_categoryDef == null? null : m_categoryDef.getWarningThreshold(); }
/** * Return the value considered to be the minimum "normal" value. * * @return a double. */ @XmlAttribute(name="normal-threshold") public double getNormalThreshold() { return m_categoryDef == null? null : m_categoryDef.getNormalThreshold(); }
/** * Return a description explaining this category. * * @return a {@link java.lang.String} object. */ @XmlElement(name="comment") public String getComment() { return m_categoryDef == null? null : m_categoryDef.getComment().orElse(null); }
public void testGetCategory() { Category category = m_catFactory.getCategory(CATLABEL); assertEquals(99,category.getNormalThreshold(),0); assertEquals(97,category.getWarningThreshold(),0); assertTrue(category.getComment().isPresent()); assertEquals(CATCOMMENT,category.getComment().get()); assertEquals(CATRULE,category.getRule()); assertEquals("ICMP",category.getServices().get(0)); assertEquals("SNMP",category.getServices().get(1)); }
/** * Create an empty category with nothing other than a name. This represents * a category with no RTC data. * * @param categoryName a {@link java.lang.String} object. */ protected Category(String categoryName) { m_categoryDef = new org.opennms.netmgt.config.categories.Category(); m_categoryDef.setLabel(categoryName); m_categoryDef.setNormalThreshold(0d); m_categoryDef.setWarningThreshold(0d); m_rtcCategory = null; m_lastUpdated = null; }
public void removeCategory(final String label) { m_categories.removeIf(cat -> { return cat.getLabel().equals(label); }); }