Class SnmpInterfacePollerConfigManager

    • Constructor Summary

      Constructors 
      Constructor Description
      SnmpInterfacePollerConfigManager​(java.io.InputStream stream)
      Constructor for SnmpInterfacePollerConfigManager.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addPackage​(Package pkg)
      addPackage
      java.util.Enumeration<Package> enumeratePackage()
      enumeratePackage
      java.util.List<java.lang.String> getAllPackageMatches​(java.lang.String ipaddr)
      getAllPackageMatches
      SnmpInterfacePollerConfiguration getConfiguration()
      Return the poller configuration object.
      java.util.Optional<java.lang.String> getCriteria​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getCriteria
      java.lang.String[] getCriticalServiceIds()
      This method returns the configured critical service name.
      java.lang.String getDownValues()
      getDownValues
      java.lang.String getDownValues​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getDownValues
      java.util.Set<java.lang.String> getInterfaceOnPackage​(java.lang.String pkgName)
      getInterfaceOnPackage
      long getInterval()
      getThreads
      long getInterval​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getInterval
      java.util.List<java.net.InetAddress> getIpList​(Package pkg)
      getIpList
      java.lang.Integer getMaxVarsPerPdu​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getMaxVarsPerPdu
      Package getPackage​(java.lang.String name)
      getPackage
      Package getPackageForAddress​(java.lang.String ipaddr)
      Returns the first package that the ip belongs to, null if none.
      java.lang.String getPackageName​(java.lang.String ipaddr)
      getPackageName
      java.util.Optional<java.lang.Integer> getPort​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getPort
      java.util.Optional<java.lang.Integer> getRetries​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getRetries
      java.lang.String getService()
      getService
      boolean getStatus​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getStatus
      int getThreads()
      getThreads
      java.util.Optional<java.lang.Integer> getTimeout​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getTimeout
      java.lang.String getUpValues()
      getUpValues
      java.lang.String getUpValues​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      getUpValues
      boolean hasMaxVarsPerPdu​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      hasMaxVarsPerPdu
      boolean hasPort​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      hasPort
      boolean hasRetries​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      hasRetries
      boolean hasTimeout​(java.lang.String pkgName, java.lang.String pkgInterfaceName)
      hasTimeout
      java.lang.Iterable<java.lang.String> includeURLs​(Package pkg)
      includeURLs
      boolean interfaceInPackage​(java.lang.String iface, Package pkg)
      This method is used to determine if the named interface is included in the passed package definition.
      java.lang.Iterable<Package> packages()
      packages
      void rebuildPackageIpListMap()
      This method is used to rebuild the package against IP list mapping when needed.
      protected void reloadXML​(java.io.InputStream stream)
      reloadXML
      void save()
      Saves the current in-memory configuration to disk and reloads
      protected abstract void saveXml​(java.lang.String xml)
      saveXml
      abstract void update()
      update
      boolean useCriteriaFilters()
      useCriteriaFilters
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SnmpInterfacePollerConfigManager

        public SnmpInterfacePollerConfigManager​(java.io.InputStream stream)
                                         throws java.io.IOException

        Constructor for SnmpInterfacePollerConfigManager.

        Parameters:
        stream - a InputStream object.
        Throws:
        java.io.IOException - if any.
    • Method Detail

      • update

        public abstract void update()
                             throws java.io.IOException

        update

        Specified by:
        update in interface SnmpInterfacePollerConfig
        Throws:
        java.io.IOException - if any.
      • saveXml

        protected abstract void saveXml​(java.lang.String xml)
                                 throws java.io.IOException

        saveXml

        Parameters:
        xml - a String object.
        Throws:
        java.io.IOException - if any.
      • reloadXML

        protected void reloadXML​(java.io.InputStream stream)
                          throws java.io.IOException

        reloadXML

        Parameters:
        stream - a InputStream object.
        Throws:
        java.io.IOException - if any.
      • save

        public void save()
                  throws java.io.IOException
        Saves the current in-memory configuration to disk and reloads
        Throws:
        java.io.IOException - if any.
      • getPackage

        public Package getPackage​(java.lang.String name)

        getPackage

        Parameters:
        name - a String object.
        Returns:
        a Package object.
      • addPackage

        public void addPackage​(Package pkg)

        addPackage

        Parameters:
        pkg - a Package object.
      • getCriticalServiceIds

        public java.lang.String[] getCriticalServiceIds()
        This method returns the configured critical service name.
        Specified by:
        getCriticalServiceIds in interface SnmpInterfacePollerConfig
        Returns:
        the name of the configured critical service, or null if none is present
      • getIpList

        public java.util.List<java.net.InetAddress> getIpList​(Package pkg)

        getIpList

        Parameters:
        pkg - a Package object.
        Returns:
        a List object.
      • rebuildPackageIpListMap

        public void rebuildPackageIpListMap()
        This method is used to rebuild the package against IP list mapping when needed. When a node gained service event occurs, poller has to determine which package the IP/service combination is in, but if the interface is a newly added one, the package IP list should be rebuilt so that poller could know which package this IP/service pair is in.
        Specified by:
        rebuildPackageIpListMap in interface SnmpInterfacePollerConfig
      • interfaceInPackage

        public boolean interfaceInPackage​(java.lang.String 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.
        Parameters:
        iface - The interface to test against the package.
        pkg - The package to check for the inclusion of the interface.
        Returns:
        True if the interface is included in the package, false otherwise.
      • getPackageForAddress

        public Package getPackageForAddress​(java.lang.String ipaddr)
        Returns the first package that the ip belongs to, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.
        Parameters:
        ipaddr - the interface to check
        Returns:
        the first package that the IP belongs to, null if none
      • getAllPackageMatches

        public java.util.List<java.lang.String> getAllPackageMatches​(java.lang.String ipaddr)

        getAllPackageMatches

        Returns a list of package names that the IP belongs to, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.
        Specified by:
        getAllPackageMatches in interface SnmpInterfacePollerConfig
        Parameters:
        ipaddr - a String object.
        Returns:
        a List object.
      • getPackageName

        public java.lang.String getPackageName​(java.lang.String ipaddr)

        getPackageName

        Specified by:
        getPackageName in interface SnmpInterfacePollerConfig
        Parameters:
        ipaddr - a String object.
        Returns:
        a String object.
      • getInterfaceOnPackage

        public java.util.Set<java.lang.String> getInterfaceOnPackage​(java.lang.String pkgName)

        getInterfaceOnPackage

        Specified by:
        getInterfaceOnPackage in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        Returns:
        a Set object.
      • getStatus

        public boolean getStatus​(java.lang.String pkgName,
                                 java.lang.String pkgInterfaceName)

        getStatus

        Specified by:
        getStatus in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a boolean.
      • getInterval

        public long getInterval​(java.lang.String pkgName,
                                java.lang.String pkgInterfaceName)

        getInterval

        Specified by:
        getInterval in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a long.
      • getCriteria

        public java.util.Optional<java.lang.String> getCriteria​(java.lang.String pkgName,
                                                                java.lang.String pkgInterfaceName)

        getCriteria

        Specified by:
        getCriteria in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a String object.
      • hasPort

        public boolean hasPort​(java.lang.String pkgName,
                               java.lang.String pkgInterfaceName)

        hasPort

        Specified by:
        hasPort in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a boolean.
      • getPort

        public java.util.Optional<java.lang.Integer> getPort​(java.lang.String pkgName,
                                                             java.lang.String pkgInterfaceName)

        getPort

        Specified by:
        getPort in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a int.
      • hasTimeout

        public boolean hasTimeout​(java.lang.String pkgName,
                                  java.lang.String pkgInterfaceName)

        hasTimeout

        Specified by:
        hasTimeout in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a boolean.
      • getTimeout

        public java.util.Optional<java.lang.Integer> getTimeout​(java.lang.String pkgName,
                                                                java.lang.String pkgInterfaceName)

        getTimeout

        Specified by:
        getTimeout in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a int.
      • hasRetries

        public boolean hasRetries​(java.lang.String pkgName,
                                  java.lang.String pkgInterfaceName)

        hasRetries

        Specified by:
        hasRetries in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a boolean.
      • getRetries

        public java.util.Optional<java.lang.Integer> getRetries​(java.lang.String pkgName,
                                                                java.lang.String pkgInterfaceName)

        getRetries

        Specified by:
        getRetries in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a int.
      • hasMaxVarsPerPdu

        public boolean hasMaxVarsPerPdu​(java.lang.String pkgName,
                                        java.lang.String pkgInterfaceName)

        hasMaxVarsPerPdu

        Specified by:
        hasMaxVarsPerPdu in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a boolean.
      • getMaxVarsPerPdu

        public java.lang.Integer getMaxVarsPerPdu​(java.lang.String pkgName,
                                                  java.lang.String pkgInterfaceName)

        getMaxVarsPerPdu

        Specified by:
        getMaxVarsPerPdu in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a int.
      • getUpValues

        public java.lang.String getUpValues​(java.lang.String pkgName,
                                            java.lang.String pkgInterfaceName)

        getUpValues

        Specified by:
        getUpValues in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
      • getDownValues

        public java.lang.String getDownValues​(java.lang.String pkgName,
                                              java.lang.String pkgInterfaceName)

        getDownValues

        Specified by:
        getDownValues in interface SnmpInterfacePollerConfig
        Parameters:
        pkgName - a String object.
        pkgInterfaceName - a String object.
        Returns:
        a String.
      • enumeratePackage

        public java.util.Enumeration<Package> enumeratePackage()

        enumeratePackage

        Returns:
        a Enumeration object.
      • packages

        public java.lang.Iterable<Package> packages()

        packages

        Returns:
        a Iterable object.
      • includeURLs

        public java.lang.Iterable<java.lang.String> includeURLs​(Package pkg)

        includeURLs

        Parameters:
        pkg - a Package object.
        Returns:
        a Iterable object.