healthcheckUtility script

Load balancers monitor a server to determine if the server is healthy by sending an FTP GET for a file on the server. The healthcheckUtility script is used to create a health check request for the server and also create a special message that provides information about the server health.

File location

<B2Bi_GM_install_path>/MailboxUtilities/admin/bin

Environments

  • Linux® or UNIX (healthcheckUtility.sh)
  • Windows (healthcheckUtility.bat)

Authorization

You must be an administrator to run this script.

Syntax

./healthCheckUtility.sh createMsg --appName=<app name> --extractUser=<user name> --mailboxName=<mailbox name> --messageName=<message name>

All healthcheckUtility commands require the --adminUser and --adminPassword parameters. If you do not specify the parameters, you are prompted to specify them.

Parameters descriptions

--appName
Name of the application must be B2Bi. This is a mandatory parameter.
--extractUser
Name of the application user that will be used to extract the health check file. This is a mandatory parameter.

The --extractUser must have a valid B2Bi user. The validity of the user is not verified by the tool. The user must be a user that is specifically created for health check and must not have a virtual root assigned, because a virtual root is created when the script is run. The user has permissions to only get the health check messages from the health check mailbox.

The user and the password must be configured on the load balancer on the health check file download request.

--mailboxName
Name of the mailbox that will contain the health check message. This is a mandatory parameter.
--messageName
Name of the health check message. This is a mandatory parameter.

A virtual root is created for the user that is specified for --extractUser under the reserved system mailbox (/.IBM) in the <app-id>/<user-name> format. If the user has a virtual root but is not ./IBM/<app-id>/<user-name>, the user is rejected.

When the command is run, a small file is created on MEIG storage. Replication records are also created for the file to be replicated to other data centers. Because the file is created in the MEIG storage, the health check request tests the shared storage mount. This ensures that the load balancer routes the traffic to another data center during a shared storage outage on a data center.

Note: If the health check message exists, the createMsg command returns an error. To replace the check message, run the createMsg command with the --overwrite option with no value. When --overwrite is specified and the health check message exists, the existing message is deleted, and a new one is created.

Show message

The details of the health check message are displayed when you run the following command:

./healthCheckUtility.sh showMsg --appName=<app name>
--appName
Name of the application must be B2Bi. This is a mandatory parameter.

The following information is displayed about the health check message:

  • Download path to use on load balancer probe (ex: /healthcheck/healthcheck.txt)
  • Download user
  • Full path on the mailbox system (For example /.IBM/<app-id>/<user-name>/healthcheck/healthcheck.txt)
  • Message ID
  • Payload ID
  • Replication status for the payload on all data centers

Delete message

The health check message can be deleted when you run the following command:

./healthCheckUtility.sh deleteMsg --appName=<app name>
--appName
Name of the application must be B2Bi. This is a mandatory parameter.

The health check message record is deleted from Cassandra, and the health check message ID property is removed from the application properties.

The payload for the health check message is purged later by the PayloadPurgeJob. Any remaining replication requests for the payload are canceled.

Check health

The health of the local data center can be checked by running the following command:

./healthCheckUtility.sh check --appName=<app name> --interval=<seconds>

When the command is run, if Cassandra goes down, the script detects it and reports it.

--appName
Name of the application must be B2Bi. This is a mandatory parameter.
--interval
Specifies how often to run the health checks. The default is 5 seconds.

This command starts a thread to check the health of Cassandra, ZooKeeper, shared storage, and Global Mailbox for the local data center. The command is run at the specified interval, and the status of each component is displayed on the console.

Cassandra must be up on the local data center before you run the command. When the command is run, Cassandra goes down and the tool detects it and reports it. The tool stays running in the foreground until the user types q or CTRL+C.

Note: The checks are done by directly testing each component. No health check file download request is sent to B2Bi.