Using the AgentServer utility to test agents

The AgentServer utility enables you to test agents without running the vadclientdVCS engine process. The utility is part of the product package and is installed in the directory $VCS_HOME/bin.%VCS_HOME%\bin.$VAD_HOME/bin (UNIX or Linux). Run the AgentServer utility when the vadclientdVCS engine process is not running.

To start the AgentServer and access help (UNIX)

  1. Type the following command to start AgentServer:

    $VCS_HOMEVAD_HOME/bin/AgentServer

    The AgentServer utility monitors a TCP port for messages from the agents. This port number can be configured by setting vcstest to the selected port number in the file /etc/services. If vcstest is not specified, AgentServer uses the default value 14142.

  2. When AgentServer is started, a message prompts you to enter a command or to type help for a complete list of the AgentServer commands. We recommend you type help to review the commands before getting started.

    > help

    Output resembles:

The following commands are supported.(Use help for more

information on using any command.)

addattr

addres

addstaticattr

addtype

debughash

debugmemory

debugtime

delete

deleteres

modifyres

modifytype

offlineres

onlineres

print

proberes

quit

startagent

stopagent

  1. For help on a specific command, type help command_name at the AgentServer prompt (>). For example, for information on how to bring a resource online, type:

    > help onlineres

The output resembles:

Sends a message to an agent to online a resource.

Usage: onlineres <agentid> <resname>

where <agentid> is id for the agent - usually same as

the resource type name.

where <resname> is the name of the resource.

To test the FileOnOff agent (UNIX)

  1. Start the agent for the resource type:
>startagent FileOnOff 
/opt/VRTSvcsVRTSvad/bin/FileOnOff/FileOnOffAgent
 

You receive the following messages:

Agent (FileOnOff) has connected.

Agent (FileOnOff) is ready to accept commands.

  1. The following are examples of types.cf and main.cf configuration files that can be referred to when testing the FileOnOff agent:

type FileOnOff (

str PathName

static str ArgList[] = { PathName }

)

In step 4, the sample configuration is set up using AgentServer commands.

  1. Refer to the types.xml and main.xml configuration files when testing the FileOnOff agent. In step 4, the sample configuration is set up using AgentServer commands.
  2. Complete step a through step f to pass this sample configuration to the agent.
    1. Add a type:

      >addtype FileOnOff FileOnOff

    2. Add attributes of the type:

      >addattr FileOnOff FileOnOff PathName str ""

      >addattr FileOnOff FileOnOff Enabled int 0

    3. Add the static attributes to the FileOnOff resource type:

      >addstaticattr FileOnOff FileOnOff ArgList vector PathName

    4. Add the LogLevel attribute to see the debug messages from the agent:

      >addstaticattr FileOnOff FileOnOff LogLevel str info

    5. Add a resource:

      >addres FileOnOff file1 FileOnOff

    6. Set the resource attributes:
		>modifyres FileOnOff file1 PathName str 
/tmp/VRTSvcsVRTSvadfile001
 

>modifyres FileOnOff file1 Enabled int 1

  1. After adding and modifying resources, type the following command to obtain the status of a resource:

    >proberes FileOnOff file1

    This calls the monitor entry point of the FileOnOff agent.

    You will receive the following messages indicating the resource status:

    Resource(file1) is OFFLINE

    Resource(file1) confidence level is 0

    1. To bring a resource online:

      >onlineres FileOnOff file1

      This calls the online entry point of the FileOnOff agent. The following message is displayed when file1 is brought online:

      Resource(file1) is ONLINE

      Resource(file1) confidence level is 100

    2. To take a resource offline:

      >offlineres FileOnOff file1

      This calls the offline entry point of the FileOnOff agent. A status message similar to the example in step a is displayed when file1 is taken offline.

  2. View the list of agents started by the AgentServer process:

    >print

    Output resembles:

    Following Agents are started:

    FileOnOff

  1. Stop the agent:

    >stopagent FileOnOff

  2. Exit from the AgentServer:

    >quit

To start AgentServer and test the FileOnOff agent (Windows)

  1. Type the following command to start AgentServer:

    %VCS_HOMEVAD_HOME%\bin\AgentServer

    Note that %VCS_HOME%%VAD_HOME% should be substituted by the installation directory. AgentServer must monitor a TCP port for messages from the agents. This port number can be configured by setting vcstest to the selected port number in the file C:\WINNT\system32\drivers\etc\services. If vcstest is not specified, AgentServer uses the default value 14142.

  2. Start the agent for the resource type:

    >startagent FileOnOff %VCS_HOMEVAD_HOME%\bin\VCSAgDriver.exe

    Note here also that %VCS_HOME%%VAD_HOME% should be substituted by the installation directory. You will receive the following messages:

    Agent (FileOnOff) has connected.

    Agent (FileOnOff) is ready to accept commands.

  3. Review the sample configuration:

types.cf:

type FileOnOff (

str PathName

static str ArgList[] = { PathName }

NameRule = resource.PathName

)

main.cf:

...

group ga (

...

)

FileOnOff file1 (

Enabled = 1

PathName = "C:\\VRTSvcsfile001"

)

  1. Refer to the types.xml and main.xml configuration files when testing the FileOnOff agent. In the next step, the sample configuration is set up using AgentServer commands.
  2. Complete step a through step f to pass this sample configuration to the agent.
    1. Add a type:

      >addtype FileOnOff FileOnOff

    2. Add attributes of the type:

      >addattr FileOnOff FileOnOff PathName str ""

      >addattr FileOnOff FileOnOff Enabled int 0

    3. Add the static attributes to the FileOnOff resource type:

      >addstaticattr FileOnOff FileOnOff ArgList vector PathName

    4. Add the LogLevel attribute to see the debug messages from the
      agent:

      >addstaticattr FileOnOff FileOnOff LogLevel str info

    5. Add a resource:

      >addres FileOnOff file1 FileOnOff

    6. Set the resource attributes:
		>modifyres FileOnOff file1 PathName str 
C:\\VRTSvcsVRTSvadfile001
 

>modifyres FileOnOff file1 Enabled int 1

  1. After adding and modifying resources, type the following command to obtain the status of a resource:

    >proberes FileOnOff file1

    This calls the monitor entry point of the FileOnOff agent.

    You will receive the following messages indicating the resource status:

    Resource(file1) is OFFLINE

    Resource(file1) confidence level is 0

    1. To bring a resource online:

      >onlineres FileOnOff file1

      This calls the online entry point of the FileOnOff agent. The following message is displayed when file1 is brought online:

      Resource(file1) is ONLINE

      Resource(file1) confidence level is 100

    2. To take a resource offline:

      >offlineres FileOnOff file1

      This calls the offline entry point of the FileOnOff agent. A status message similar to the example in step a is displayed when file1 is taken offline.

  2. View the list of agents started by the AgentServer process:

    >print

    Output resembles:

    Following Agents are started:

    FileOnOff

  1. Stop the agent:

    >stopagent FileOnOff

  2. Exit from the AgentServer:

    >quit