##################################################################################
# RMT(Remote Management tool) #
# #
# Version 1.3,2011-01-21 #
# Author:Alex Li #
# Email:lijie3721@126.com,QQ:317828332 #
##################################################################################
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:0 #列出所有服务器列表
192.168.193.133
192.168.193.134
192.168.193.135
192.168.193.136
192.168.193.137
192.168.193.138
192.168.193.140
192.168.193.141
192.168.193.142
please slect the following menu: #
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:1 #扫描所有服务器列表上的客户端的状态
192.168.193.133 down
192.168.193.134 down
192.168.193.135 running
192.168.193.136 down
192.168.193.137 running
192.168.193.138 running
192.168.193.140 down
192.168.193.141 down
192.168.193.142 down
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:2 #登录到某台机器
Please enter the remote server IP: 192.168.193.135 #输入IP地址
You have successfully login to the remote server, now you can run most of the system command in this mode ,but do not suggest
you to run the command such as top,tail -f,because right now I haven't find a way to support the continuous data output
Please input the command:uname -a #输入的命令
Received log from /root/Remote_management_tool/192.168.193.135.log
##########################################################
Linux bjnpif02 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux #显示的结果
####################################################################################
Please input the command:ls #输入的命令
Received log from /root/Remote_management_tool/192.168.193.135.log
########################################################## #显示的结果
1900000
Desktop
Documents
RMT_client.py
Remote_management_tool
autoinst.xml
bin
nohup.out
ntp-client
script
vmware
####################################################################################
Please input the command:exit
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:3
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:4 #上传服务器列表
Please enter the full path of your file: ls
No such file,please make sure you inputed the right file.
Please enter the full path of your file: /tmp.^H
No such file,please make sure you inputed the right file.
Please enter the full path of your file: /tmp/list
192.168.193.3
192.32.34.24
Adding uploaded list to Server list.########################## done.
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:5 #同时在多台远程服务器上执行命令并返回结果
It might will takes a few minutes to scan all the avialiable servers......
The fllowing servers are avaliable: #可以进行远程操作的列表
192.168.193.135
192.168.193.137
192.168.193.138
please input your command: uname -a #输入命令
Received log from /root/Remote_management_tool/192.168.193.135.log
Linux bjnpif02 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux #每台设备返回的结果
####################################################################################
Received log from /root/Remote_management_tool/192.168.193.137.log
Linux bjnpbo01 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux #每台设备返回的结果
####################################################################################
Received log from /root/Remote_management_tool/192.168.193.138.log
Linux bjnpbo02 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux
####################################################################################
please input your command: i^H
Received log from /root/Remote_management_tool/192.168.193.135.log
sh: : command not found
####################################################################################
Received log from /root/Remote_management_tool/192.168.193.137.log
sh: : command not found
####################################################################################
Received log from /root/Remote_management_tool/192.168.193.138.log
sh: : command not found
####################################################################################
please input your command: ls #输入的命令
Received log from /root/Remote_management_tool/192.168.193.135.log #每台设备返回的结果
1900000
Desktop
Documents
RMT_client.py
Remote_management_tool
autoinst.xml
bin
nohup.out
ntp-client
script
vmware####################################################################################
Received log from /root/Remote_management_tool/192.168.193.137.log #每台设备返回的结果
1900000
Desktop
Documents
RMT_client.py
Remote_management_tool
a
autoinst.xml
bin
etc
jdk-6u17-linux-amd64.rpm
jdk1.6.0_17
netperf-2.4.5
netperf-2.4.5.tar.gz
nohup.out
ntp-client
opt
sbin
sun-javadb-client-10.4.2-1.1.i386.rpm
sun-javadb-common-10.4.2-1.1.i386.rpm
sun-javadb-core-10.4.2-1.1.i386.rpm
sun-javadb-demo-10.4.2-1.1.i386.rpm
sun-javadb-docs-10.4.2-1.1.i386.rpm
sun-javadb-javadoc-10.4.2-1.1.i386.rpm
usr
workspace
####################################################################################
Received log from /root/Remote_management_tool/192.168.193.138.log #每台设备返回的结果
1900000
Desktop
Documents
RMT_client.py
Remote_management_tool
autoinst.xml
bin
nohup.out
ntp-client
####################################################################################
please input your command: exit
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:6 #批量更改多台服务器密码
Please use the follow method to change password on remote server:
use command: echo "your password"|passwd your_user --stdin
For example ,if you want to change oracle user's password to '123456', then you need run
echo "123456"|passwd oracle --stdin
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:7 #批量往多台服务器上拷文件
Please enter the file name which you wanted to copy to remote servers:/tmp/list #文件名
192.168.193.133
Connection refused by the remote server 192.168.193.133 #连接失败
,please make sure you IP is allowed by the remote server.
192.168.193.134
Connection refused by the remote server 192.168.193.134
,please make sure you IP is allowed by the remote server.
192.168.193.135 #COPY成功
192.168.193.136
Connection refused by the remote server 192.168.193.136
,please make sure you IP is allowed by the remote server.
192.168.193.137 #COPY成功
192.168.193.138 #COPY成功
192.168.193.140
Connection refused by the remote server 192.168.193.140
,please make sure you IP is allowed by the remote server.
192.168.193.141
Connection refused by the remote server 192.168.193.141
,please make sure you IP is allowed by the remote server.
192.168.193.142
Connection refused by the remote server 192.168.193.142
,please make sure you IP is allowed by the remote server.
192.168.193.3
Connection refused by the remote server 192.168.193.3
,please make sure you IP is allowed by the remote server.
192.32.34.24
Connection refused by the remote server 192.32.34.24
,please make sure you IP is allowed by the remote server.
File list has successfully copied into /root/Remote_management_tool/recieved_files directory of above remote servers.
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:8 #批量部署客户端到多台服务器上
This function is for you to install client application on mutiple servers , to achieve this, please follow the following step:
1 Fill your IP address and password of remote server in to password.txt under expect_tool directory
2 Make you have the access right to /root directory on remote server,the client file RMT_client.py will be copied into /root/ directory on all the remote servers which you assigned in password.txt
Do you want install the client on mutiple servers? (yes/no) :y
Starting to install RMT_client.py on remote servers...
Checking for the remote server list...
Going to install on the following servers:
192.168.193.137
192.168.193.135
spawn scp -rp ../RMT_client.py 192.168.193.137:/root/
Password:
RMT_client.py 100% 1983 1.9KB/s 00:00
spawn ssh root@192.168.193.137
Password:
Last login: Fri Jan 21 16:06:20 2011 from 192.168.193.132
bjnpbo01:~ # nohup python /root/RMT_client.py &
[1] 17704
bjnpbo01:~ # exit
logout
nohup: appending output to `nohup.out'
Connection to 192.168.193.137 closed.
spawn scp -rp ../RMT_client.py 192.168.193.135:/root/
Password:
RMT_client.py 100% 1983 1.9KB/s 00:00
spawn ssh root@192.168.193.135
Password:
nohup python /root/RMT_client.py &
exit
Last login: Fri Jan 21 15:49:57 2011 from 192.168.193.132
bjnpif02:~ # nohup python /root/RMT_client.py &
[1] 17759
bjnpif02:~ # exit
logout
nohup: appending output to `nohup.out'
Connection to 192.168.193.135 closed.
please slect the following menu:
0 list servers
1 Scan agent status
2 login to remote server
3 Reboot all the remote servers(does't support)
4 Upload server list
5 excute command on all the aviliable servers
6 change password for all the servers
7 copy scripts to remote servers
8 install the client application on all the remote servers
9 exit
Please enter the slected number:9