OpenNMS API 1.2.9

## org.opennms.netmgt.capsd
Class NsclientPlugin

    java.lang.Object
      org.opennms.netmgt.capsd.AbstractPlugin
          org.opennms.netmgt.capsd.NsclientPlugin

All Implemented Interfaces:
  Plugin

public class NsclientPlugin
extends AbstractPlugin

This class is designed to be used by the capabilities daemon to test whether a NSClient service is running on the remote server and if the given command can be successfully executed against the service.

Author:
  Matt Raykowski , OpenNMS

Field Summary
`private static int` `DEFAULT_RETRY` Default number of retries for TCP requests.
`private static int` `DEFAULT_TIMEOUT` Default timeout (in milliseconds) for TCP requests.
`private static java.lang.String` `PROTOCOL_NAME` The protocol supported by the plugin

Constructor Summary
`NsclientPlugin()`

Method Summary
`java.lang.String` `getProtocolName()` Returns the name of the protocol that this plugin checks on the target system for support.
`boolean` `isProtocolSupported(java.net.InetAddress address)` Returns true if the protocol defined by this plugin is supported.
`boolean` `isProtocolSupported(java.net.InetAddress address, java.util.Map qualifiers)` Returns true if the protocol defined by this plugin is supported.
`private NsclientPacket` `isServer(java.net.InetAddress host, int port, java.lang.String command, int retries, int timeout, NsclientCheckParams params)` Test to see if the paassed host-port pair is an endpoint for a TCP server.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROTOCOL_NAME

    private static final java.lang.String PROTOCOL_NAME

  The protocol supported by the plugin

  See Also:
    Constant Field Values

### DEFAULT_RETRY

    private static final int DEFAULT_RETRY

  Default number of retries for TCP requests.

  See Also:
    Constant Field Values

### DEFAULT_TIMEOUT

    private static final int DEFAULT_TIMEOUT

  Default timeout (in milliseconds) for TCP requests.

  See Also:
    Constant Field Values

Constructor Detail

### NsclientPlugin

    public NsclientPlugin()

Method Detail

### getProtocolName

    public java.lang.String getProtocolName()

  Returns the name of the protocol that this plugin checks on the target system for support.

  Specified by:
    `getProtocolName` in interface `Plugin`
  Specified by:
    `getProtocolName` in class `AbstractPlugin`
  Returns:
    The protocol name for this plugin.

### isProtocolSupported

    public boolean isProtocolSupported(java.net.InetAddress address)

  Returns true if the protocol defined by this plugin is supported. If the protocol is not supported then a false value is returned to the caller.

  The NsclientPlugin does not support undirected checks, we must have a map of parameters to determine how to issue a check to the target server.

  Specified by:
    `isProtocolSupported` in interface `Plugin`
  Specified by:
    `isProtocolSupported` in class `AbstractPlugin`
  Parameters:
    `address` - The address to check for support.
  Returns:
    True if the protocol is supported by the address.
  Throws:
    `java.lang.UnsupportedOperationException` - This is always thrown by this plugin.

### isProtocolSupported

    public boolean isProtocolSupported(java.net.InetAddress address,
                                       java.util.Map qualifiers)

  Returns true if the protocol defined by this plugin is supported. If the protocol is not supported then a false value is returned to the caller. The qualifier map passed to the method is used by the plugin to return additional information by key-name. These key-value pairs can be added to service events if needed.

  The following parameters are used by this plugin:

  - command - the command to be executed on this node.
  - port - used to override the default NSClient port.
  - retry - overrides the number of times to retry connecting to the service.
  - timeout - tcp port timeout.
  - parameter - a string used for checking services. see documentation on specific check types for use.
  - criticalPercent - typically a percentage used for testing results, for example disk space used.
  - warningPercent - typically a percentage used for testing results, for example memory space used.
  Protocol will return as supported only if the result code is `NsclientPacket.RES_STATE_OK` or `NsclientPacket.RES_STATE_WARNING`.

  Specified by:
    `isProtocolSupported` in interface `Plugin`
  Specified by:
    `isProtocolSupported` in class `AbstractPlugin`
  Parameters:
    `address` - The address to check for support.
    `qualifiers` - The map where qualification are set by the plugin.
  Returns:
    True if the protocol is supported by the address.

### isServer

    private NsclientPacket isServer(java.net.InetAddress host,
                                    int port,
                                    java.lang.String command,
                                    int retries,
                                    int timeout,
                                    NsclientCheckParams params)

  Test to see if the paassed host-port pair is an endpoint for a TCP server. If there is a TCP server at the destination value then a connection is made using the params variable data and a check is requested from the remote NSClient service.

  Parameters:
    `host` - The remote host to connect to.
    `port` - The remote port on the host.
    `command` - The command to execute on the remote server.
    `retries` - The number of retries to attempt when connecting.
    `timeout` - The TCP socket timeout to use.
    `params` - The NSClient parameters used to validate the response.
  Returns:
    The NsclientPacket the server sent, updated by NsclientManager to contain the proper result code based on the params passed.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.