INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

WARNING: terminal not capable of 'window' mode

WARNING: terminal not capable of 'window' mode

(OP)


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





RE: WARNING: terminal not capable of 'window' mode

(OP)

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

RE: WARNING: terminal not capable of 'window' mode

(OP)
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

RE: WARNING: terminal not capable of 'window' mode

(OP)
Hi

the issue was solved.

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


malpa

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close