Technical

Tips

How to Confirm That Processes Are Running on the Destination Host Before Transfering a File

Introduction

In this tip, we'll talk about the remote heartbeat monitoring command in HULFT.

You can confirm that the resident processes of HULFT on the host to which you want to transfer files are operating normally. This can help you isolate the cause of failures when sending and receiving cannot be successfully conducted.

Let's Try Using the Remote Heartbeat Monitoring Command

You can execute the remote heartbeat monitoring command by using the following procedure:

utlalivecheck -h hostname -p portno

Argument Description
hostname Target host name or IP address
portno The port number for the process to be monitored.

Referring to the information above, let's execute the command in the following environment:

We'll execute the remote heartbeat monitoring command from a Windows host, to check whether a process is running on a Linux host.
Enter the following command in the command prompt, and execute it.

C:\>utlalivecheck -h rhel7 -p 31800
SUCCESS

If the process using port 31800 on the target host is operating normally, SUCCESS is output.
Now, let's see what happens to the execution result when the process isn't running on the target host.

C:\>utlalivecheck -h rhel7 -p 31800
socket connect error.

When the process isn't running on the target host, a socket connection error is output.
By checking whether resident processes of HULFT are running on the host to which you want to transfer files, you can isolate the cause of failures more quickly.

When the process isn't running on the target host, a socket connection error is output. By checking whether resident processes of HULFT are running on the host to which you want to transfer files, you can isolate the cause of failures more quickly.

Now that you understand how to use the remote heartbeat monitoring command, let's put it to practical use.
Let's try creating a script that will use the utlsend command to send a file only if the resident processes of HULFT are running on the other host. If the processes are not running, or if communication with the host cannot be established, the script will verify the return value and output a detailed description to the log file.

Note: This is a sample Windows batch (.bat) file.

echo off
cls

utlalivecheck -h rhel7 -p 3306 -q

if %ERRORLEVEL% == 0 (
goto NORMAL
) else (
goto ERROR
)

:NORMAL
utlsend -f ALIVECHECK_SEND -sync

if %ERRORLEVEL% == 0 (
exit
) else (
echo send host :rhel7>>c:\send_error.log
echo exit code :%ERRORLEVEL%>>c:\send_error.log
echo Description :sendding error>>c:\send_error.log
echo Measure :Please check the manual and help.
)

exit

:ERROR

if %ERRORLEVEL% == 28 (
echo send host :rhel7>>c:\send_error.log
echo exit code :%ERRORLEVEL%>>c:\send_error.log
echo Description :Connection to the target machine failed.>>c:\send_error.log
echo Measure1 :Check whether the process on the remote host has been started.>>c:\send_error.log
echo Measure2 :Check whether the port number of the remote host is correct.>>c:\send_error.log
echo.

) else if %ERRORLEVEL% == 29 (
echo send host :rhel7>>c:\send_error.log
echo exit code :%ERRORLEVEL%>>c:\send_error.log
echo Description :Failed to send data.>>c:\send_error.log
echo Measure :The socket may be disconnected. Check the socket.>>c:\send_error.log
echo.
) else if %ERRORLEVEL% == 50 (
echo send host :rhel7>>c:\send_error.log
echo exit code :%ERRORLEVEL%>>c:\send_error.log
echo Description :Failed to receive response message.>>c:\send_error.log
echo Measure :The socket may be disconnected. Check the socket.>>c:\send_error.log
echo.
) else if %ERRORLEVEL% == 51 (
echo send host :rhel7>>c:\send_error.log
echo exit code :%ERRORLEVEL%>>c:\send_error.log
echo Description :Invalid value has been set in the response message.>>c:\send_error.log
echo Measure :Check the status of the process on the remote host.>>c:\send_error.log
echo.
) else (
echo send host :rhel7>>c:\send_error.log
echo exit code :%ERRORLEVEL%>>c:\send_error.log
echo Description :Please check the manual and help.>>c:\send_error.log
echo Measure :Please check the manual and help.>>c:\send_error.log
echo.
)

exit.

If the resident processes of HULFT are running and the file is sent successfully, nothing is output to the log file.
If the resident processes of HULFT are not running, the following information is output to the log file, and the file is not sent.

send host :rhel7
exit code :28
Description :Connection to the target machine failed.
Measure1 :Check whether the process on the remote host has been started.
Measure2 :Check whether the port number of the remote host is correct.

By using the remote heartbeat monitoring command in a script like we did in this sample, you can output the causes of and corrective measures for of HULFT connection errors to the log file. This helps shorten the time it takes to determine the cause of a failure.
You can also lighten the load on the network by decreasing unsuccessful communication attempts.

Linking with Monitoring Tools

By linking the remote heartbeat monitoring function with monitoring tools, you can send an alert to the HULFT operation administrator when a problem occurs in the monitoring results. This allows problems to be resolved more quickly.

Conclusion

So, what do you think?
By using the remote heartbeat monitoring command, you can decrease unsuccessful communication attempts and, by linking with monitoring tools, take corrective action more quickly.

You can benefit from these advantages by using the remote monitoring command function in a way that suits your operations.
Please take this opportunity to use the remote heartbeat monitoring command.