 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
taso
Joined: 18 May 2007 Posts: 8
|
|
Remote command output via JAL and ssh xauth issue |
|
Hi,
We are using 24x7 Automation Suite to control various jobs on a linux server. The Suite is running on a Win 2k3 Server instance, while the remote agent (jra) is running on a CentOS 4.3 server. The issue I am facing is twofold:
First, the job within 24x7 connects to the remote linux server and kicks off a script that connects to other remote machines via ssh to perform certain tasks. The ssh command issued within the linux script includes the "-x and -a" flags (disabling X11 forwarding and forwarding of authentication) however the 24x7 job log shows the warning "Warning: No xauth data; using fake authentication data for X11 forwarding". The command in the 24x7 script that kicks off the remote linux script uses the command "RARunAndWait" to launch the remote linux script. Why is X11 forwarding being attempted, or better, how can I disable it?
Second, when the remote job encounters errors, it outputs certain errors that should get picked up by the 24x7 Suite. Unfortunately, there are two error lines, and the log shows the first and only the first few characters of the second error line. It also shows the xauth error described above. I am storing the remote job output to a string variable and then passing it to the log, but the xauth error is not useful and an incomplete error message is even less so.
Any thoughts? Need more info?
Thanks,
Taso
|
|
Fri May 18, 2007 8:41 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
|
|
I am not clear why X11 is involved in this. Please check how you start the agent, and make sure you use the default server.sh file to start the agent in that file you point to java not javaw. If that doesn't help and you are absolutely sure the issue is in the agent and not in your scripts or processes you start, consider switching to a Linux native version of the agent, which runs as a tcpd daemon and surely has nothing to do with xserver
Regarding the second issue, please post your JAL script to help us understand what you are doing and where the text gets truncated.
|
|
Sat May 19, 2007 1:58 pm |
|
 |
taso
Joined: 18 May 2007 Posts: 8
|
|
|
|
 |
 |
... to start the agent in that file you point to java not javaw. |
The startup script has the following command:
exec $JAVA_HOME/bin/java -cp log4j-1.2.8.jar:ra_server.jar com.softtree.raserver.Server -p 1096 -f /var/log/ra_log.txt -s &
 |
 |
If that doesn't help and you are absolutely sure the issue is in the agent and not in your scripts or processes you start, consider switching to a Linux native version of the agent, which runs as a tcpd daemon and surely has nothing to do with xserver |
When running the script from the linux box itself there are no xauth errors reported, nor listed in the log. Our 24x7 scheduler is simply connecting to the linux machine, executing the script, and returning job status and output, so there is not much logic within. We had tried using the native linux agent, but ran into stability issues and therefore switched to the Java version. I will test with the other version anyway to see if the results differ.
 |
 |
Regarding the second issue, please post your JAL script to help us understand what you are doing and where the text gets truncated. |
The relevant portion of the JAL script is as follows:
 |
 |
...
Concat( RunDir, RemoteJobName, CmdToRun )
...
]Dim( output, string )
SendInfoMsgToLog( "24x7:: Initialization complete" )
Set( Msg , "Starting Job" )
SendInfoMsgToLog( Msg )
Set( Msg , "" )
//////// MAIN - RUN THE JOB ////////
// connect to host computer
RAConnect( IPAddress , PortNumber, UserName, Password )
//Validate Connection Successful
ProcessGetExitCode( exit_code )
//check exit code if connect failed, exit
IfThen( exit_code, HANDLE_ERROR )
// run remote command
RARunAndWait( CmdToRun, 0, process_id, output )
//Validate Connection Successful
ProcessGetExitCode( exit_code )
IfThen( exit_code, HANDLE_ERROR )
ConcatEx( IPAddress, " :: ", RemoteJobName, " :: output from Shell= ", output, Msg )
SendInfoMsgToLog( Msg )
Set(Msg,"")
Concat( "24x7:: Local PID process_id= ", process_id, Msg )
SendInfoMsgToLog( Msg )
Set(Msg,"")
RAProcessExitCode exit_code
ConcatEx( IPAddress, " :: ",RemoteJobName," :: UNIX Shell exit_code= ", exit_code, Msg )
SendInfoMsgToLog( Msg )
// Check if Job Finished Success (if Unix return code =0)
// then Goto Exit_success else Handle_error labels)
if (exit_code , HANDLE_ERROR , EXIT_SUCCESS )
//SUBROUTINES: Messaging, (Success and Error Handling for Unix return codes)
HANDLE_ERROR:
Set(Msg,"")
ConcatEx( IPAddress, " :: ",RemoteJobName," :: Returned Non-Zero exit status= ", exit_code, Msg)
LogAddMessageEx( "ERROR", ControllerJobId, RemoteJobName, Msg )
Set(Msg,"")
ConcatEx(Msg,IPAddress, " :: ",RemoteJobName, " :: FATAL :: Remote job output= ", output, Msg)
LogAddMessageEx( "ERROR", ControllerJobId, RemoteJobName, Msg)
|
And here is what I get in the log file:
 |
 |
192.168.20.127 :: RemoveRemoteFile.model :: FATAL :: Remote job output= Warning: No xauth data; using fake authentication data for X11 forwarding. ## : 20070519_135052: [FAIL] Remote command failed -- ssh connection returned status 1 ## : 20070519_1 |
For clarity, the ssh command is failing on purpose; I am doing some testing and the rest of the second line that is missing states the cause for failure, which is permission denied on the remote system. The relevant commands (to try and isolate the cause) from the script are:
 |
 |
Concat( CmdToRunTmp , ParmList , CmdToRun )
//output from the remote shell
Dim( output, string )
// run remote command
RARunAndWait( CmdToRun, 0, process_id, output )
Set(Msg,"")
ConcatEx(Msg,IPAddress, " :: ",RemoteJobName, " :: FATAL :: Remote job output= ", output, Msg)
LogAddMessageEx( "ERROR", ControllerJobId, RemoteJobName, Msg)
|
|
|
Sat May 19, 2007 3:13 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
|
|
Ok, let's wait for test results using native version. This should prove if X11 is associated with the agent or not.
Regarding the text truncation and the script. The log message in the job log is limited in size. If I am not mistaken the max size is 255 characters. That is probably the reasons why you get truncated text. I suggest you split the output lines and write each line as a separate message.
GetToken with "\n" can be used to split lines
By the way, you incorrectly use ProcessGetExitCode( exit_code ). The purpose of this function is to obtain exit code of last process started using RunAndWait command. That's all. Secondary, you don't need to test for errors in individual statements. The error handling is built-in and automatic. Shall an error occur, for example, if remote agent connection fails, the scheduler would automatically fail the entire job and execute the associated "on error" events actions. At the very minimum it would write an error message to the log. If you have any emails or other things wired to the job "on error" event, the scheduler will execute them too.
In case if you need custom error handling you should use OnErrorGoto, OnErrorBreak, and similar commands to control the job flow in case of errors.
Hope this helps.
|
|
Sat May 19, 2007 5:48 pm |
|
 |
taso
Joined: 18 May 2007 Posts: 8
|
|
|
|
No testing with native version as yet due to inability to start. The GetToken syntax cleared up the log, thanks for the tip.
I will post results after figuring out why the agent will not start, but it is a bit hazy due to lack of useful info in the log. The log shows evaluation mode as having expired, yet we have a licensed version. I suppose the switch from native to java version occurred while the evaluation period was still in effect, and the native version was never authenticated, but I can not figure out how to apply the license info to the ra_server app. Documentation describes how to do it on Windows, but not linux.
I am waiting on more info from the person who installed the software initially to try and clear up the issue. Thanks again for your help.
|
|
Mon May 21, 2007 3:39 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7969
|
|
|
|
The message in the log indicates you are trying to run eval. version of the agent which expired 30-days after the install. You need to obtain a non-eval. version from support (it is different binary distribution). Please email to support and indicate your license number and type
|
|
Mon May 21, 2007 4:17 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|