- Community Home
- >
- Servers and Operating Systems
- >
- HPE ProLiant
- >
- Server Management - Remote Server Management
- >
- VC Manager command tool
Server Management - Remote Server Management
1820390
Members
3455
Online
109623
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2009 03:26 AM
02-26-2009 03:26 AM
VC Manager command tool
Here's a command which lets us run a VC command without knowing which is the active VC
server02:/ root# util_execute_vcmgr_cmd chassis02-vc1 hpadmin password "show server -output=script2,no-headers"
enc0:1;1Z34AB1234;1;ProLiant BL685c G5;OK;Off;project_dev_tool_profile
enc0:2;1Z34AB1234;2;ProLiant BL685c G5;OK;Off;
enc0:3;1Z34AB1234;3;ProLiant BL685c G5;OK;Off;project_dev_odb4
enc0:4;1Z34AB1234;4;ProLiant BL685c G5;OK;Off;project_dev_odb3
server02:/ root# util_execute_vcmgr_cmd chassis02-vc2 hpadmin password "show server -output=script2,no-headers"
enc0:1;1Z34AB1234;1;ProLiant BL685c G5;OK;Off;project_dev_tool_profile
enc0:2;1Z34AB1234;2;ProLiant BL685c G5;OK;Off;
enc0:3;1Z34AB1234;3;ProLiant BL685c G5;OK;Off;project_dev_odb4
enc0:4;1Z34AB1234;4;ProLiant BL685c G5;OK;Off;project_dev_odb3
#!/usr/local/bin/expect
# Program : util_execute_vcmgr_cmd
# Version : 1.2
# Author : Mark Ashley
# Initial Date : 12th Feb 2009
# Modify Date : 26th Feb 2009
# Purpose : Connect to a HP Blade Chassis VC and run a command
set real_noisy 0
set noisy $real_noisy
# exp_internal 0
log_user $real_noisy
set whoami "[exec /usr/ucb/whoami]"
set myhostname "[exec /bin/hostname]"
set osname "[exec uname -s]"
set shell "tcsh"
set sshcmd "/bin/ssh"
set remote_prompt "\-\>$"
set local_prompt "(%|#|\\\$) $"
set remhost [lindex $argv 0]
set user [lindex $argv 1]
set passwd [lindex $argv 2]
set command [lindex $argv 3]
# log_file -noappend /var/tmp/vcmgr_cmd.$remhost.log
proc login_to_remote_host {} {
global whoami
global remhost
global user
global passwd
global local_prompt
global remote_prompt
global command
global shell_id
global sshcmd
send "$sshcmd $remhost -oStrictHostKeyChecking=no -l $user \"$command\"\r"
expect "*"
set timeout 10
set after_password 0
while 1 {
expect {
-re "Password: " {
send "$passwd\r"
expect "\r\n"
set after_password 1
}
-re ".*Virtual Connect Manager not found at this IP address." {
set after_password 0
}
"continue connecting \(yes/no\)" {
send "yes\r"
}
-re "Last login.+" {
send "\r"
}
timeout {
return
}
-re "password:" {
send "$passwd\r"
}
-re "Please use IP Address: (.*)\r\n" {
set newhost $expect_out(1,string)
log_user 0
set noisy 0
exec kill -INT $shell_id
# send_user "Switching to actual host $newhost\r\n"
expect -re $local_prompt
send "$sshcmd $newhost -oStrictHostKeyChecking=no -l $user \"$command\"\r"
expect -re "Password: " {
send "$passwd\r"
expect "\r\n"
set after_password 1
}
}
-re $local_prompt {
set after_password 0
send_user "\r\n"
exit
}
"publickey,password,keyboard-interactive" {
send_error "\rpassword for $remhost is wrong\r\n"
sleep 1
exit
}
-re ".*\r" {
if ($after_password) { send_user $expect_out(buffer) }
}
}
}
}
set shell_id [spawn $shell -l]
send "stty raw -echo\r"
expect "*"
send "uname -s\r"
expect "$osname\n"
expect -re $local_prompt
login_to_remote_host
expect -re $local_prompt
send_user "\r\n\n"
server02:/ root# util_execute_vcmgr_cmd chassis02-vc1 hpadmin password "show server -output=script2,no-headers"
enc0:1;1Z34AB1234;1;ProLiant BL685c G5;OK;Off;project_dev_tool_profile
enc0:2;1Z34AB1234;2;ProLiant BL685c G5;OK;Off;
enc0:3;1Z34AB1234;3;ProLiant BL685c G5;OK;Off;project_dev_odb4
enc0:4;1Z34AB1234;4;ProLiant BL685c G5;OK;Off;project_dev_odb3
server02:/ root# util_execute_vcmgr_cmd chassis02-vc2 hpadmin password "show server -output=script2,no-headers"
enc0:1;1Z34AB1234;1;ProLiant BL685c G5;OK;Off;project_dev_tool_profile
enc0:2;1Z34AB1234;2;ProLiant BL685c G5;OK;Off;
enc0:3;1Z34AB1234;3;ProLiant BL685c G5;OK;Off;project_dev_odb4
enc0:4;1Z34AB1234;4;ProLiant BL685c G5;OK;Off;project_dev_odb3
#!/usr/local/bin/expect
# Program : util_execute_vcmgr_cmd
# Version : 1.2
# Author : Mark Ashley
# Initial Date : 12th Feb 2009
# Modify Date : 26th Feb 2009
# Purpose : Connect to a HP Blade Chassis VC and run a command
set real_noisy 0
set noisy $real_noisy
# exp_internal 0
log_user $real_noisy
set whoami "[exec /usr/ucb/whoami]"
set myhostname "[exec /bin/hostname]"
set osname "[exec uname -s]"
set shell "tcsh"
set sshcmd "/bin/ssh"
set remote_prompt "\-\>$"
set local_prompt "(%|#|\\\$) $"
set remhost [lindex $argv 0]
set user [lindex $argv 1]
set passwd [lindex $argv 2]
set command [lindex $argv 3]
# log_file -noappend /var/tmp/vcmgr_cmd.$remhost.log
proc login_to_remote_host {} {
global whoami
global remhost
global user
global passwd
global local_prompt
global remote_prompt
global command
global shell_id
global sshcmd
send "$sshcmd $remhost -oStrictHostKeyChecking=no -l $user \"$command\"\r"
expect "*"
set timeout 10
set after_password 0
while 1 {
expect {
-re "Password: " {
send "$passwd\r"
expect "\r\n"
set after_password 1
}
-re ".*Virtual Connect Manager not found at this IP address." {
set after_password 0
}
"continue connecting \(yes/no\)" {
send "yes\r"
}
-re "Last login.+" {
send "\r"
}
timeout {
return
}
-re "password:" {
send "$passwd\r"
}
-re "Please use IP Address: (.*)\r\n" {
set newhost $expect_out(1,string)
log_user 0
set noisy 0
exec kill -INT $shell_id
# send_user "Switching to actual host $newhost\r\n"
expect -re $local_prompt
send "$sshcmd $newhost -oStrictHostKeyChecking=no -l $user \"$command\"\r"
expect -re "Password: " {
send "$passwd\r"
expect "\r\n"
set after_password 1
}
}
-re $local_prompt {
set after_password 0
send_user "\r\n"
exit
}
"publickey,password,keyboard-interactive" {
send_error "\rpassword for $remhost is wrong\r\n"
sleep 1
exit
}
-re ".*\r" {
if ($after_password) { send_user $expect_out(buffer) }
}
}
}
}
set shell_id [spawn $shell -l]
send "stty raw -echo\r"
expect "*"
send "uname -s\r"
expect "$osname\n"
expect -re $local_prompt
login_to_remote_host
expect -re $local_prompt
send_user "\r\n\n"
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP