Getting advice with Metric Server

Metric Server provides server load information to the Load Balancer in the form of system-specific metrics, reporting on the health of the servers.

Before you begin

When Metric Server is enabled, the Metric Server agent must be installed and configured to provide the defined metrics on all servers that are defined in the cluster. If you are using IPv6 protocol on your machine and want to use Metric Server, you must check to see whether protocol 58 is defined to be ICMPv6 in the protocol file. If protocol 58 does not exist, you must insert the following line in the protocol file:
ipv6-icmp 58 IPv6-ICMP # IPv6 interface control message protocol
The protocol file is in the following directory:
  • [Linux][AIX]/etc/protocols
  • [Windows] C:\windows\system32\drivers\etc\

About this task

The Load Balancer manager queries the Metric Server agent that resides on each of the servers, assigning weights to the load-balancing process by using the metrics gathered from the agents. The results are also placed into the manager report.
Note: When two or more metrics are gathered and normalized for each server into a single system load value, rounding errors might occur.

Procedure

  1. Configure Metric Server on the Load Balancer machine.
    Tip: You can use similar steps for configuring Metric Server for the other components of Load Balancer.
    1. Start dsserver. Start the executor, and add clusters, ports, and servers to your configuration.
    2. Start the manager.
      Issue the following command.
      dscontrol manager start manager.log port
      where port is the RMI port that is chosen for all the Metric Server agents to run on. The default RMI port that is set in the metricserver file is 10004.
    3. Add the system metric script to the cluster.
      Issue the following command.
      dscontrol metric add cluster@systemMetric
      systemMetric is the name of the script that resides on the back-end server, which runs on each of the servers in the configuration under the specified cluster. Two scripts are provided for the customer - cpuload and memload - or you can create custom system metric scripts.
      Tip: For Site Selector, cpuload, and memload, run automatically.
      [Windows]Avoid trouble: If the name of your System Metric script has an extension other than .exe, you must specify the full name of the file (for example, mysystemscript.bat). This requirement is due to a Java limitation.
  2. Configure Metric Server on the server machines.
    1. Install the Metric Server package from the Load Balancer installation files.
    2. To ensure security, create key files and distribute them to the Metric Server agent software.
      On the Load Balancer machine, create a key file by using the lbkeys create command. The new key file is stored in the install_root/admin/keys directory with a naming convention of component-IP address-RMI port number.key.
      For example, if the component was dispatcher, the IP address was 1.2.3.4, and the RMI port number was 10099, the key file would be called dispatcher-1.2.3.4-10099.key.

      On the back-end server machine, copy the generated key file to the install_root/admin/keys directory of each Metric Server agent machine. Verify that the key file permissions enable the file to be readable by the root.

      If the Load Balancer Dispatcher component is used, you must modify the dsserver script to enable communication with Metric Server agents before you generate and distribute key files. Stop all Dispatcher processes before you edit the script. Modify the -Djava.rmi.server.hostname=127.0.0.1 Java property to use the Dispatcher NFA address, for example, -Djava.rmi.server.hostname=9.1.2.3.

    3. Check the Metric Server script in the install_root/ms/bin directory to verify that the correct RMI port is being used. The default RMI port is 10004.
      Note: The RMI port value that is specified must be the same value as the RMI port value that was specified in the manager start command in Step 1b.
    4. Optional: You can write their own customized metric script files that define the command that the Metric Server issues on the server machines. Ensure that any custom scripts are executable and located in the install_root/ms/script directory. Custom scripts must return a numeric load value in the range of 0-100.
      Note: A custom metric script must be a valid program or script with a .bat or .cmd extension.

      [Linux][AIX]Specifically, for Linux and other UNIX-based systems, scripts must begin with the shell declaration. Otherwise, they might not properly run.

      The following two scripts are provided for the customer in the install_root/ms/script directory.

      The cpuload: script returns the percentage of CPU that is in use, ranging 0 - 100.

      The memload: script returns the percentage of memory that is in use, ranging 0 - 100.

    5. Start the Metric Server agent.
      [AIX HP-UX Solaris][Linux]On a command line of each server machine where Metric Server resides, type the following command.
      metricserver start

      [Windows]Click Start > Control Panel > Administrative Tools > Services. Right-click IBM WebSphere Metric Server and select Start.

    6. Optional: Stop the Metric Server agent.
      [AIX HP-UX Solaris][Linux]To stop the Metric Server agent, issue this command on every server machine where Metric Server resides.
      metricserver stop

      [Windows]Click Start > Control Panel > Administrative Tools > Services. Right-click IBM WebSphere Metric Server and select Stop.

  3. Optional: Increase the log level by modifying the LOG_LEVEL value in the Metric Server script.
    You can specify a log-level range of 1 through 5, similar to the log-level range in Load Balancer logs. This setting generates an agent log in the install_root/ms/logs directory. The default LOG_LEVEL value is 1, which is minimal logging.
  4. If the agent machine has multiple IP addresses, specify the IP address for the Metric Server agent to use.

    The Metric Server agent operates by using the IP address that is defined in the server definition for the Load Balancer. If the agent machine has multiple IP addresses, you must specify the IP address by adding the java.rmi.server.hostname Java property in the metricserver script.

  5. Optional: Configuring Metric Server for dual stack networks
    In a Load Balancer configuration that supports both IPv4 and IPv6 clusters, servers that run the Metric Server function can be configured as an IPv4 server or IPv6 server, but not both.
    To force Metric Server to use IPv4, add the following Java properties in the metricserver script.
    -Djava.net.preferIPv4Stack=true
    -Djava.net.preferIPv6Stack=false
    To force Metric Server to use Ipv6, add the following Java properties in the metricserver script.
    -Djava.net.preferIPv4Stack=false
    -Djava.net.preferIPv6Stack=true

Example

[Linux][AIX] For example, to communicate by using the IP address 1.2.3.4 on a machine where both the IPv4 and IPv6 protocols are enabled, add the following code to the metricserver script.
if [[ "$1" = "s" || "$1" = "st" || "$1" = "sto" || "$1" = "stop" ]]
then
/opt/IBM/WebSphere/Edge/ULB/java/jre/bin/java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Stack=false 
-Djava.rmi.server.hostname="1.2.3.4" -DMSstop -cp $LB_CLASSPATH com.ibm.internet.nd.sma.SMA_AgentStop 
$LB_RMIPORT &
else
/opt/IBM/WebSphere/Edge/ULB/java/jre/bin/java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Stack=false 
-Djava.rmi.server.hostname="1.2.3.4" -DMS -cp $LB_CLASSPATH com.ibm.internet.nd.sma.SMA_Agent $LB_RMIPORT
$LOG_LEVEL $LOG_SIZE $LOG_DIRECTORY $KEYS_DIRECTORY $SCRIPT_DIRECTORY &
fi
[Windows] To communicate by using the IPv6 address of 2002:92a:8f7a:162:9:42:92:67, add the following code to the metricserver script.
start /min /wait %IBMULBPATH%\java\jre\bin\java -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Stack=true 
-Djava.rmi.server.hostname="2002:92a:8f7a:162:9:42:92:67" -DMS -Xrs -cp %LB_CLASSPATH% 
com.ibm.internet.nd.sma.SMA_Agent %RMI_PORT% %LOG_LEVEL% %LOG_SIZE% %LOG_DIRECTORY% 
%KEYS_DIRECTORY% %SCRIPT_DIRECTORY%
goto done

:stop
%IBMULBPATH%\java\jre\bin\java -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Stack=true 
-Djava.rmi.server.hostname="2002:92a:8f7a:162:9:42:92:67" -DMSstop -cp %LB_CLASSPATH% 
com.ibm.internet.nd.sma.SMA_AgentStop %RMI_PORT%