Live debugging
You can use the termdebug
KVGroup to interactively monitor what is sent and received by agent scripts over raw TCP connections, SSL raw connections (not http/https), telnet and SSH connections. To do this, add a supplemental termdebug
KVGroup to the agent input. For example:
# KVGROUP-V1.0 "" "" = { "address" = "telnet_unix.psl" "adminid" = "root" "adminpw" = "<encrypted password value>" "hostid" = "SSH1" "listfilename" = "C:\\listing-test.txt" "instance" = "globoco" "listresource" "" = { } "operation" = "list" "timeout" = "30" "termdebug" "" = { ## mandatory configurations "address" = "127.0.0.1" #String representation of the #address of the interface to listen to. "port" = "3210" #string representation of the TCP port to listen to. #agtssh listens to this port on IDM Suite server "command" = "c:\\windows\\system32\\telnet.exe localhost 3210" #Command line to run with full executable path and parameters #Quotes and backslashes need to be escaped with \. #See below for more info. ## optional configurations "interactive" = "1" #0=no 1=yes #If 1, shows a dialog box with the string to # be sent, and waits for OK before it is sent. "waitforjointimeout" = "10000" #Timeout, in milliseconds, of the agent waiting # for a client connection. "sendtimeout" = "1000" #Timeout, in milliseconds, of sending data back to the # client. } }
Warning
Data seen on the debug port is raw decrypted data.
Command options
The command value can take Cygwin telnet.exe, or nc.exe, or a tn3270/tn5250 client as required, for example:
"command" = "c:\\cywgin\\bin\\bash -c \"/bin/telnet.exe localhost 3210 | tee /tmp/log1; sleep 3600\""
To prevent the window closing after the debug port closes, include cmd.exe /k telnet ...
for telnet, or sleep
for Cygwin telnet.exe or nc.exe.
For non-interactive debugging, the command can be something like:
"command" = "c:\\windows\\system32\\cmd.exe /c telnet localhost 3210 >> c:\\debuglog.txt 2>&1"
Interactivity options
When interactivity is turned on ("interactive" = "1" ) the script waits for one of the following inputs before proceeding:
ok = next step
cancel = skip next questions, run all steps automatically without any more prompting
If the original agent script or the target itself has very strict timeouts, it is recommended that you do not use the interactive option, or cancel it before the section with critical timing.
Adding the termdebug KVGroup to input
You can add the termdebug KVGroup to the agent input by:
Capturing agent input using the pstee program, then manually adding the inner KVGroup.
Wrapping the actual agent in an
agtdos
script as described in the PSLang Reference Manual (pslang.pdf) .The script should:
Read $_inVars
Replace its address ( "address" = "doswrapper.psl" ) with the telnet or ssh address line, then add the termdebug KVGroup
Call the original agent with this group (converted to string) as input. It could also log the new modified agent input for debugging the PSLang wrapper script.
This method is more complicated, but has the advantage of working for every agent call and not replaying operations. See the PSLang Reference Manual (pslang.pdf) for more information about KVGroup functions, and system() calls.