Class CollectdConfigFactory

  • All Implemented Interfaces:
    CollectdConfigFactory

    public class CollectdConfigFactory
    extends Object
    implements CollectdConfigFactory
    This is the singleton class used to load the configuration for the OpenNMS Collection Daemon from the collectd-configuration.xml file. A mapping of the configured URLs to the IP list they contain is built at init() time so as to avoid numerous file reads. Note: Users of this class should make sure the init() is called before calling any other method to ensure the config is loaded before accessing other convenience methods.
    Author:
    James Zuo, Mike Davidson, Sowmya Nataraj
    • Method Detail

      • packageExists

        public boolean packageExists​(String name)
        Returns true if collection package exists
        Specified by:
        packageExists in interface CollectdConfigFactory
        Parameters:
        name - The package name to check
        Returns:
        True if the package exists
      • domainExists

        public boolean domainExists​(String name)
        Returns true if collection domain exists
        Specified by:
        domainExists in interface CollectdConfigFactory
        Parameters:
        name - The domain name to check
        Returns:
        True if the domain exists
      • isServiceCollectionEnabled

        public boolean isServiceCollectionEnabled​(OnmsMonitoredService service)
        Returns true if the specified service's interface is included by at least one package which has the specified service and that service is enabled (set to "on").
        Specified by:
        isServiceCollectionEnabled in interface CollectdConfigFactory
        Parameters:
        service - OnmsMonitoredService to check
        Returns:
        true if Collectd config contains a package which includes the specified interface and has the specified service enabled.
      • isServiceCollectionEnabled

        public boolean isServiceCollectionEnabled​(OnmsIpInterface iface,
                                                  String svcName)
        Returns true if the specified interface is included by at least one package which has the specified service and that service is enabled (set to "on").
        Specified by:
        isServiceCollectionEnabled in interface CollectdConfigFactory
        Parameters:
        iface - OnmsIpInterface to lookup
        svcName - The service name to lookup
        Returns:
        true if Collectd config contains a package which includes the specified interface and has the specified service enabled.
      • isServiceCollectionEnabled

        public boolean isServiceCollectionEnabled​(String ipAddr,
                                                  String svcName)
        Deprecated.
        This function should take normal model objects instead of bare IP addresses and service names. Use isServiceCollectionEnabled(OnmsIpInterface, String) instead.
        Returns true if the specified interface is included by at least one package which has the specified service and that service is enabled (set to "on").
        Specified by:
        isServiceCollectionEnabled in interface CollectdConfigFactory
        Parameters:
        ipAddr - IP address of the interface to lookup
        svcName - The service name to lookup
        Returns:
        true if Collectd config contains a package which includes the specified interface and has the specified service enabled.
      • interfaceInPackage

        public boolean interfaceInPackage​(String iface,
                                          Package pkg)
        Deprecated.
        This function should take normal model objects instead of bare IP addresses. Move this implementation into interfaceInPackage(OnmsIpInterface, Package).
        This method is used to determine if the named interface is included in the passed package definition. If the interface belongs to the package then a value of true is returned. If the interface does not belong to the package a false value is returned. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.
        Specified by:
        interfaceInPackage in interface CollectdConfigFactory
        Parameters:
        iface - The interface to test against the package.
        Returns:
        True if the interface is included in the package, false otherwise.
      • interfaceInPackage

        public boolean interfaceInPackage​(OnmsIpInterface iface,
                                          Package pkg)
        This method is used to determine if the named interface is included in the passed package definition. If the interface belongs to the package then a value of true is returned. If the interface does not belong to the package a false value is returned. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.
        Specified by:
        interfaceInPackage in interface CollectdConfigFactory
        Parameters:
        iface - The interface to test against the package.
        Returns:
        True if the interface is included in the package, false otherwise.