Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WARNING: terminal not capable of 'window' mode

Status
Not open for further replies.

malpa

Technical User
Feb 8, 2004
122
0
0
CO


Hi

My script validates the main functions from 61 servers.

CPU
FILESYSTEMS
PROCESS

Inside the shell, I execute an 'expect script' to do this. If I execute this script manually, it functions very well, but if i run it from cron service, it generate the next message -> WARNING: terminal not capable of 'window' mode

I dont know if this issues is related with the ssh server o ssh client, expect or $TERM enviorment ????


WARNING: terminal not capable of 'window' mode
DataSource st cong PduLost MsuSend Fail Msu/Sec Byt/sec Last State Time mfId tId



The line that generate the issue is:

send "routeDisp\n"
set timeout 2
while (1) {
expect {
timeout { send "\003";break}
"." {send "\003";break}
}
}
expect "*user
"






Script.



#!/usr/bin/expect -f


set length [string length $comando]
if {$length != 0} {

spawn ssh -Y root@10.83.xx.xx
expect {
"(yes/no)? " { send "yes\r";exp_continue }
timeout { send_user "\nNo se recibe el prompt de sistema\n"; puts $output "$server\n"; exit 1 }
eof { send_user "\nFalla al conectarse a traves de ssh al $server\n"; puts $output2 "$server\n"; exit 1 }
"*assword*"
}
send "$clave\r"
expect {
timeout { send_user "\nAutenticacion fallida. clave incorrecta.\n";puts $output1 "$server\n"; exit 1}
"* ~]# "
}
#send "ssh -q -o StrictHostKeyChecking=no $user@$server\r"
send "ping -q -c4 $server \| awk \' \$0\~\/4 received\/ \{print \$4 \} \' \r"
expect "* ~]# "
set elbuffer $expect_out(buffer)
#puts $elbuffer

foreach line [split $elbuffer \n ] {
set myswitch [lindex $line ]
if {$myswitch == 4} {
puts $myswitch
send "ssh -Y $user@$server\r"
set timeout 10
expect {
"(yes/no)? " { send "yes\r";exp_continue }
timeout { send_user "\nNo se recibe el prompt de sistema\n";puts $output "$server\n"; exit 1 }
eof { send_user "\nFalla al conectarse a traves de ssh al $server\n<br>"; exit 1 }
"*assword*" { send "$clave\r" }
"* ~]# " { send "\r" }
}
expect {
timeout { send_user "\nAutenticacion fallida. clave incorrecta.\n";puts $output1 "$server\n"; exit 1}
"* ~]# "
}
send "/sbin/ifconfig | grep \"inet\"\r"
expect "* ~]# "
send "hostname\r"
expect "* ~]# "
send "${comando}\r"
set timeout 80
expect {
timeout { send_user "\nNo se recibe el prompt de sistema\n";puts $output3 "$server\n"; exit 1 }
eof { send_user "\nFalla al conectarse a traves de ssh al $server\n<br>"; exit 1 }
"* ~]# " { send "\r"; set timeout 5 }
}
expect "* ~]# "
send "top -bn1 | grep \"Cpu\(s\)\" | sed \"s\/.*, *\\(\[0-9.\]*\\)%*id.*\/\\1\/\" | awk \' \{print 100 - \$1\"\%\"\} \' \r"
expect "* ~]# "
puts "FILESYSTEMI\r"
send "df | awk \' BEGIN\{rows=0\} NF>=4\&\&\$0\~\/\\\/\/\{ if\( \$\(NF-1\) \~ \/\[0-9\]*\%\/\) \{ val=substr\(\$\(NF-1\),1,match\(\$\(NF-1\),\"\%\"\)-1\);if\(val*1
> 90\)\{a\[rows, ++m\]=\$\(NF-1\);a\[rows, ++m\]=\$\(NF\);++rows;m=0\}\} \}END\{ for \(i=2;i>=1;i--\)for\(j=0;j<=rows;j++\)\{printf \"\%-20s \%s\",a\[j,i\],\(j<rows)\?\"\":\"\\n\"\}\} \'\r"
expect "* ~]# "
puts "FILESYSTEMF\r"

if { $IMF == 1 } {
send "su - xxxxxx\n"
expect "*user "
send "routeDisp\n"
set timeout 2
while (1) {
expect {
timeout { send "\003";break}
"." {send "\003";break}
}
}
expect "*user
"
send "exit\r"
expect "* ~]# "
}
send "exit\r"
expect "* ~]# "

break
}
}
send "exit\r"

}
close $output
expect eof



any suggestion

Thanks a lot

malpa





 

Hi


This trace is generated when the program is executed manually.

output
routeDisp

DataSource st cong PduLost MsuSend Fail Msu/Sec Byt/sec Last State Time mfId tId
CL_GPRS_GP_CAL-PMF-1B_ixp0004_379417-10.20.64.47:53061 A No 0 12278948 0 746 312212 12/03/2013 17:21:59 14720 5302
CL_GPRS_GP_CAL-PMF-1B_ixp0004_379812-10.20.64.47:52301 A No 0 15683566 0 746 312212 12/03/2013 16:45:49 14720 29275
.
.
Ctrl-C

This is the line of the programm that contain the issue. I do not know if this issue is related with the ssh server o ssh client, expect script or TERM enviorment bash.


send "routeDisp\n"
set timeout 2
while (1) {
expect {
timeout { send "\003";break}
"." {send "\003";break}
}
}
expect "*user "



Any suggestion

Thanks

Malpa
 
Hi


I added this line to the program.


send "\rexport TERM=xterm\r"


now I can see the output of the command, going well. The issue now, is that the output is truncated to 4 columns

Output

DataSource st cong PduLost
CL_ALL_PTT_CAL-IMF-1E_Upgd_ixp0001_419850-10.83.65.10:34516 A No 0
CL_INAP_TELECOM_CAL-IMF-1E_Upgd_ixp0002_423773-10.83.65.15:5 A No 0
CL_INAP_TELECOM_CAL-IMF-1E_Upgd_ixp0004_423791-10.83.65.27:5 A No 0
CL_ISUP_PSTN_CAL-IMF-1E_Upgd_ixp0004_423782-10.83.65.27:5603 A No 0 35
CL_MAP_HLR7_CAL-IMF-1E_Upgd_ixp0002_419486-10.83.65.17:40285 A No 0 26
CL_MAP_SGSN4_CAL-IMF-1E_Upgd_ixp0001_419445-10.83.65.10:5972 A No 0 33



I want this output -> 12 columns

output
routeDisp

DataSource st cong PduLost MsuSend Fail Msu/Sec Byt/sec Last State Time mfId tId
CL_GPRS_GP_CAL-PMF-1B_ixp0004_379417-10.20.64.47:53061 A No 0 12278948 0 746 312212 12/03/2013 17:21:59 14720 5302
CL_GPRS_GP_CAL-PMF-1B_ixp0004_379812-10.20.64.47:52301 A No 0 15683566 0 746 312212 12/03/2013 16:45:49 14720 29275
.
.

The question is ¿ How can I change the accurate window mode ???
I appriciated your comments.

thanks a lot

malpa
 
Hi

the issue was solved.

send "\rexport TERM=xterm\r"
send "stty rows 35 columns 150\r"


malpa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top