Chinaunix

标题: 轻松管理上万台Linux服务器,5分钟安装,一键完成!--出新版本啦,改名为TriAquae [打印本页]

作者: alex3714    时间: 2010-12-29 18:07
标题: 轻松管理上万台Linux服务器,5分钟安装,一键完成!--出新版本啦,改名为TriAquae
本帖最后由 alex3714 于 2012-12-03 11:33 编辑

如果你有以下需求,本文章或许会对你有所帮助:
1. 网络里LINUX服务器较多,缺乏统一管理的工具。
2. 系统经常需要更改,如果定期更改所有服务器密码、批量更新特定文件等。
3. 需实时获得所有服务器的运行信息,例如,需立刻查看每台服务上装分别装了多少根内存条该怎么办,难道一台台登录 上去看?当然一般的系统监控软件是不会收集服务器有多少条内存条这样的信息的。
4. 如果想往所有服务器上放一个文件,怎么办?
5. 想在所有服务器上启动一个服务或执行一个脚本怎么办?

_____________________________________________________________________________________

推出新版本啦,新版本实现以下功能:
先Show下功能:
IT批量运维管理软件-- TriAquae  
1.        服务器分组管理
2.        批量命令执行
3.        批量文件传送、接收
4.        服务器运行状态抓取、分析
5.        服务器硬件信息收集
6.        定时计划任务
7.        批量软件部署
8.        系统密码更改

我推荐大家使用 TriAquae的理由:
1、        它如此方便,你可以像管理本地一台服务器一样可以轻松的让成千上万台服务器做同样的事情,比如 uname –a查一下系统版本,执行一个收集日志的脚本,修改所有服务器上的一个文件……,当然它能做的不至这些……
2、        它如此之轻,只要你的机器上装有Python,那么你就可以开始使用它,它不需要你装数据库,不需PHP、不需要JAVA虚拟机,only  Python。你甚至不需要在客户机上装客户端,只需要支持SSH,当然你得知道用户名密码
3、        它如此简单,你无需学习特殊的语法、花数天的时间研究软件的结构,只需5分钟,你就可以开始自如的使用它管理你的系统了
4、        它是开源的,它是免费的……

#####比以前的版本,多了好多功能呢,还不需要在被管理机上装客户端了呢,飞跃了亲……哈哈


详情请查看: http://bbs.chinaunix.net/forum.p ... =3775522&extra=




大家在读下文时如有不理解的地方或其它问题,可以随时联系我,大家互相交流,共同成长,我的qq:317828332
############################################

做Linux系统管理以来,由于维护过比较大的网络,例如在飞信做支持的时候,面对上千台的服务器,有时候可能要对每台机子打一个补丁,或者是修改一个文件,如果只有10台服务器,那一一修改也就罢了,但是如果让你一台一台的登录1000台服务器只是为了去改一个文件,那一定痛苦死,并且效率低下,没有任何技术含量,如果一直做这种工作,那被称为IT民工也不能怪别人了,因为我一直想找一个可以批量管理的工具,后来发现了两种方式可以实现:

1.    通过SSH密钥认证,这样登录到远程机器上后就不需要输入密码了,这样就可以通过脚本去批量登录到远程服务器并且修改你想要文件或操作等,但是这有一个缺点,就是这个在管理端的私钥你一定要保存好,万一管理服务器系统重装或其它原因导致私钥丢失,那你就没办法登录远程机器了。还有,如果需要管理的机器更改了IP,那你还得重新把公钥COPY到那台机子上,这样管理起来可能不是那么灵活。

2.    通过expect 工具进行批量管理,expect工具很强大,可以实现交互式管理,比如如果你想改密码,输入passwd命令后,系统会提示你输入New Password: ,如果使用普通脚本的话,那你是没办法进行交互式的。但是expect就可以做到检测系统的返回值并且根据返回的提示来自动交互


这样此脚本就会调用ha-switch.exp脚本并登录到192.168.193.100-200的机器上分别执行"/etc/init.d/heartbeat stop 命令了。

很强大吧,但使通过我使用的经验,我觉得expect 有个缺点就是有慢,因为它是一台一台的去登录 然后执行命令,因为有的时候由于DNS解析或什么原因 ,通过SSH登录到一台机子时可能需要等待30s才能登录进去,假如1000台机子的话那就需要50分钟才能完成在所有机器上的操作,对于要求在1分钟内实现数千台机器执行相同操作的需要来讲这显然达不到要求。



以上两种方法各有利弊,我个人建议在50-100台的小网络中可以考虑使用SSH认证或expect的方法。但是想像一下,如果我有一万台机器 ,分别处于全国各地不同的网络中,要求我在1分钟内更改所有机器的root密码,显然以上两种方法均是做不到的,当然有这样大型网络的公司中国也并不多见,但是从技术的角度上来讲这还是有一定挑战性的,由于在网上一直找不到这样的工具,我就自己索性写了一个,经过多天的努力,终于将这个批量管理工具写完了,此工具是用的Python写的,基于socket server的模式,即需要在所有的需要管理的服务器上启动一个客户端(可能好多朋友不太喜欢这种还需要装客户端的东东),客户端会开启一个端口,你的管理服务器就是通过此端口与被管理端通信,然后对被管理端进行操作,你可以远程修改密码,查看系统信息,内存情况等操作,操作结果会在你的管理端实现显示出来(这也是我比较喜欢的地方,就跟在本地操作命令一样)。并且还可以向远程服务器批量COPY文件,下面我就把这个工具在使用过程中的一些截图列出来:



bjnppb01:~/scripts/python_scripts/Remote_management_tool/Remote_management_tool_v1.3 # python RMT_server.py

##################################################################################
#       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

这样就可以轻松的管理所有的机器了,考虑到第一次运行时需要在所有的机器上安装客户端,建议使用expect工具来一次批量安装,这样就可以一劳永逸了,有需要的同鞋请下载附件。

Remote_management_tool_v1.4.tar

40 KB, 下载次数: 1550


作者: renxiao2003    时间: 2010-12-29 21:15
这是自己写的脚本把。
作者: alex3714    时间: 2010-12-30 09:14
回复 2# renxiao2003


    自已通过python写的小程序
作者: jack.gao    时间: 2010-12-30 09:30
楼主强悍啊,做过飞信,难道是新媒传信的老相识?喜欢你的创新精神
作者: alex3714    时间: 2010-12-30 09:31
哈哈,我在新媒呆过,哈,你哪个部门?
作者: jack.gao    时间: 2010-12-30 09:36
运维,不过是负责官网的。
作者: nagaregawa    时间: 2010-12-30 09:37
主要是脚本啦
作者: alex3714    时间: 2010-12-30 09:46
我也是运维的,我跟官网的还打过交道,哈哈,你什么时候离开的?
作者: alex3714    时间: 2010-12-30 09:48
回复 7# nagaregawa


    嗯,通过python 的socket模块做的,希望能对各位有帮助,可实现对上万台服务器的集中,实时管理。
作者: nagaregawa    时间: 2010-12-30 09:50
回复 9# alex3714


    谢谢分享啦~
作者: renxiao2003    时间: 2010-12-30 09:56
回复 3# alex3714


    牛啊。学习了啊。
作者: bcst    时间: 2011-01-07 18:08
好像client端不能放到后台呀。。要怎么改?
作者: zc9706    时间: 2011-01-07 23:15
好东西,很有用啊!
作者: 纳尔逊·曼德拉    时间: 2011-01-09 12:43
提示: 作者被禁止或删除 内容自动屏蔽
作者: cuixingasd    时间: 2011-01-09 20:57
LZ牛叉,以前我就是像民工一样,一台一台上机器改东西,麻烦死了
作者: yifangyou    时间: 2011-01-09 22:38
expect用过,挺不错的,可以批量在很多机器上执行命令
作者: alex3714    时间: 2011-01-10 17:50
回复 12# bcst
使用

    nohup python /fmnp/soft/test/client.py & 就可以后台启动了
作者: alex3714    时间: 2011-01-10 17:51
回复 14# 纳尔逊·曼德拉


    在一些游戏公司,需要对几千台服务器统一更新一个包或文件的情况还是很常 见的
作者: alex3714    时间: 2011-01-10 17:53
expect用过,挺不错的,可以批量在很多机器上执行命令
yifangyou 发表于 2011-01-09 22:38


expect 确实挺好用,但是一台一台的去登录到的远程执行命令,每一台机子都需要经过认证什么的,有点慢,不太具有实时性
作者: alex3714    时间: 2011-01-10 17:54
回复 15# cuixingasd


    我以前也这样干……,但做技术的必须不断的想办法提高自己的工作效率才行
作者: jiannma    时间: 2011-01-10 19:44
puppet 不可以?
作者: 虫虫猫    时间: 2011-01-11 10:34
在研究cfengine ,弄得晕晕的
作者: alex3714    时间: 2011-01-11 10:56
回复 22# 虫虫猫


    用这个工具也挺好,很简单……
作者: Purple_Grape    时间: 2011-01-11 16:12
本帖最后由 Purple_Grape 于 2011-01-11 16:19 编辑

已经有现成的工具了!

ssh-copy-id  + pssh

前者用于拷贝私钥,后者是批量ssh

不过如果是上万台机器,对于pssh 确实是个考验。

话说回来,上万台机器统一密码,安全上不可行。得考虑LDAP。
作者: alex3714    时间: 2011-01-21 17:04
回复 24# Purple_Grape


    上万台机器肯定要进程密码的统一管理,但root密码一般是不用ldap管理的,以防ldap出问题你就登录不了机器了……
作者: 300second    时间: 2011-02-02 23:30
O(∩_∩)O哈哈~感谢分享
作者: Arlov    时间: 2011-02-18 13:42
是否可以多进程?
#!/bin/bash

for i in $(seq 100 200);

do

  IP = "192.168.193.$i"

  这里: ( new shell do command ) expect  ha-switch.exp $IP '123DDFD'

done

这样就多个命令同时在跑,我在dos经常这么干,不知道linux可否
作者: 铁钉    时间: 2011-02-18 23:52
顶楼主, 好样的。
作者: hwzun    时间: 2011-02-19 15:58
楼主蛮有水平的嘛来顶你一下
作者: cst05001    时间: 2011-02-19 17:47
我觉得这是一种亡羊补牢的好办法。

但是我觉得如果能在系统安装时候kickstart好一些配置,比如ssh公钥之类,那么会省去很多麻烦。
作者: a55569769    时间: 2011-02-21 07:19
大神级人物了
作者: alex3714    时间: 2011-02-21 12:17
回复 21# jiannma


    puppet根我的这个工具要实现的主要功能不一样,我是要实现对服务器的批量管理,可以实时获取所有服务器的数据、信息、及更改等,居我所知,puppet更倾向于系统的统一配置
作者: alex3714    时间: 2011-02-21 12:19
是否可以多进程?
#!/bin/bash

for i in $(seq 100 200);

do

  IP = "192.168.193.$i"

  ...
Arlov 发表于 2011-02-18 13:42



    我在批量部署此客户端的时候就是采用的这种方式……,但这不是多进程,哈哈,只是循环。
作者: alex3714    时间: 2011-02-21 12:20
楼主蛮有水平的嘛来顶你一下
hwzun 发表于 2011-02-19 15:58



    多谢,自己有需求所以写的,我现在自己公司就用这个东西,感觉很实用,你们服务器多的话也可考虑用一下,呵呵。
作者: alex3714    时间: 2011-02-21 12:23
我觉得这是一种亡羊补牢的好办法。

但是我觉得如果能在系统安装时候kickstart好一些配置,比如ssh公钥之 ...
cst05001 发表于 2011-02-19 17:47



    对,如果在系统在安装的时候就采用kickstart等进行批量部署的话那是最好的了,但是好多的公司网络都 是一点点成长起来的,好多公司的现在还有win98甚至win95的机器,在这种情况下,要实现统一的管理不是件容易的事情,因为系统差异化太大。此工具对于系统本身的差异性要求不大,只要是unix\linux系统,都可以管理。
作者: zyp339025518    时间: 2011-02-21 12:36
这东西比较强悍!LZ更牛逼!呵呵!学习下!
作者: Hendane    时间: 2011-02-24 16:37
牛啊!
作者: xiaozhenggang    时间: 2011-02-25 10:50

作者: 300second    时间: 2011-02-26 18:03
哇,感谢分享,要是能附上图片就好了
作者: mvbits    时间: 2011-02-27 22:58
进来看看 感谢分享
作者: alex3714    时间: 2011-03-10 15:41
回复 12# bcst


    有什么错误提示?
作者: quaine    时间: 2011-03-10 16:03
支持一下楼主
作者: compare2000    时间: 2011-03-12 17:38
thx
作者: yangemil    时间: 2011-03-23 11:05
谢谢分享啦~
作者: 笑脸松鼠    时间: 2011-03-30 14:51
楼主的python真牛逼~~~
作者: 饭碗儿    时间: 2011-03-30 14:55
LZ, 真有恒心. 自己写了.

我用pexpect, 然后据此写了几个脚本. 有的每天发状态信息到管理服务器, 有的用于执行命令.  我觉得上传用scp就行.

建议研究下Django, 弄个webmin的界面 就酷了.
作者: wxcup    时间: 2011-03-30 17:17
好工具啊,下来研究研究
作者: alex3714    时间: 2011-03-30 17:40
回复 46# 饭碗儿


    我真想试做个WEB界面 ,最后放弃了,太麻烦……为此我还小学了一下PHP,哈哈
作者: _MipS    时间: 2011-03-31 11:06
好贴,占个位置先
作者: trt2008    时间: 2011-03-31 13:54
谢谢分享
作者: hbspct    时间: 2011-03-31 15:57
回复 1# alex3714


    很好的文章啊!!
支持了!!!
作者: ggyy2008    时间: 2011-03-31 21:55
down下了,留着备用。。。。。。。。。。。。
作者: 南极雨    时间: 2011-04-01 07:40
擦.你怎么不发源代码阿...
作者: alex3714    时间: 2011-04-01 10:18
回复 53# 南极雨


    源代码在文件包里,请自行下载……
作者: wake2000x    时间: 2011-04-01 15:51
楼主很强,受用了
作者: tqhlyz    时间: 2011-04-01 16:30
本帖最后由 tqhlyz 于 2011-04-01 16:32 编辑

不错~~
python + django呢?


貌似受控端没有验证?只能通过iptable来限定管理端。
作者: jy02107028    时间: 2011-04-01 17:33
支持下,python确实是管理linux的好工具,正在学习,下来看看
作者: alex3714    时间: 2011-04-01 18:19
回复 56# tqhlyz


    在客户端限定了只能特定IP访问,由于本人技术能力有限,当时没太往深处做验证的问题
作者: laohuanggua    时间: 2011-04-01 22:12
能设置循环获取变量么?
作者: alex3714    时间: 2011-04-02 10:44
回复 59# laohuanggua


    请把问题说清楚……
作者: 当当-甘甘    时间: 2011-04-02 14:52

作者: aiwsuoai    时间: 2011-04-02 15:42
喜欢,顶!
作者: 太甚郎    时间: 2011-04-02 16:16
学习了
作者: laohuanggua    时间: 2011-04-03 16:08
回复 60# alex3714

说详细点就是:

判断系统中的nginx或者java的进程号,然后根据这些进程号----就是我说的变量-----去做建立,复制拷贝文件。
作者: alex3714    时间: 2011-04-04 21:39
回复 56# tqhlyz


    有IP地址的限制,只能限制管理端访问……
作者: alex3714    时间: 2011-04-04 21:41
回复 64# laohuanggua


    当然可以,首先通过正则表达式过滤出进程号来,然后把它设为变量就可以
作者: lixingping1985    时间: 2011-04-09 10:45
写得很好。谢谢。
我也做系统维护,但是我很容易就迷茫。看了你写的一些文章,很给力。
作者: lanndmentt    时间: 2011-04-12 15:32
如果能结合php, 使用php做个前台页面, 是个很好的服务器管理工具。
作者: gnufree    时间: 2011-04-12 17:17
牛人啊
作者: redhatuser    时间: 2011-04-12 17:18
赞一个
作者: alex3714    时间: 2011-04-13 09:49
如果能结合php, 使用php做个前台页面, 是个很好的服务器管理工具。
lanndmentt 发表于 2011-04-12 15:32



    我一直想这样搞,但无奈本人PHP很差,又懒的学,你会的话可以帮我写,哈哈!
作者: dj991    时间: 2011-04-13 10:11
回复 71# alex3714


膜拜大牛
作者: wgz263    时间: 2011-04-14 09:11
不错
作者: zhengwei_zw    时间: 2011-04-14 09:41
批量运行,我还是觉得不保险。平台不统一啊。系统不一样
作者: hzhgz2006    时间: 2011-04-14 12:10
ssh expect 用的不是很好,第一次如果有 yes,第二次没有的话,就很麻烦!
作者: alex3714    时间: 2011-04-14 15:36
回复 75# hzhgz2006


    你可以做判断 呀,没有yes你就不用执行那个选 项不就成了
作者: soldier_wang    时间: 2011-04-15 10:01
楼主现在在哪家公司就职啊?
作者: alex3714    时间: 2011-04-15 10:34
回复 74# zhengwei_zw


    只要是unix/linux平台就可以,WINDOWS做不到。。。,现在哪个大公司不做统一管理?当然我的工具只限于那些管理员用。
作者: alex3714    时间: 2011-04-15 10:35
回复 77# soldier_wang


    No comment!
作者: 黑马王子    时间: 2011-04-15 17:51
有点疑惑,楼主的截图怎么变成文本的了?
作者: winson1740    时间: 2011-04-17 21:01
敲命令还行,执行shell的时候有些命令不能执行
作者: alex3714    时间: 2011-04-17 21:18
敲命令还行,执行shell的时候有些命令不能执行
winson1740 发表于 2011-04-17 21:01



    哪些命令不可以,欢迎提bug
作者: hulong77778    时间: 2011-04-18 16:51
感谢楼主,学习啦
作者: linuxflj    时间: 2011-04-19 11:16
厉害!!!
作者: loveradmin    时间: 2011-05-09 10:06
谢谢分享啦~
作者: lanndmentt    时间: 2011-05-12 11:17
重新修改过吧, 看过, 需要时候再来找。。
作者: ldw21cn    时间: 2011-05-12 17:02
回复 1# alex3714


很不错啊。
作者: ramanbull    时间: 2011-05-12 17:50
JH 帖    膜拜了
作者: a774050174    时间: 2011-05-13 11:58
上次在CSDN上面就看到过这个远程批量修改密码方案,???
作者: gerryok    时间: 2011-05-13 12:38
这个非常的牛
作者: koalacba    时间: 2011-05-13 12:56
lz 我想咨询一下,我手头上有200台的机器。因为是目前通过kickstart安装部署系统的。IP都是dhcp分配。
有什么办法可以说批量修改这些机器的IP地址为固定IP呢?
或者说一开始批量部署的时候就是设置为固定IP,省得一台台上去修改。
作者: MaskRay    时间: 2011-05-13 12:57
一次开多个 spawn 不就行了

用 expect 的 indirect spawn ids 功能,man expect 里找
作者: wang509020    时间: 2011-05-13 18:02
楼主太强了,我都三十了,真想学,很有成就感,不过现在什么都不会,还要努力才行了。
作者: redspider    时间: 2011-05-13 22:33
有机会批量管理一万台服务器的童鞋举手瞧瞧
作者: alex3714    时间: 2011-05-14 09:35
lz 我想咨询一下,我手头上有200台的机器。因为是目前通过kickstart安装部署系统的。IP都是dhcp分配。
有什 ...
koalacba 发表于 2011-05-13 12:56



    服务器的地址你敢搞成DHCP的?真牛?在刚开始kickstart的时候你就应该给分配成固定的。或者你在DHCP服务器上把现在的已经分配了的IP和那些服务器的MAC绑定
作者: alex3714    时间: 2011-05-14 09:36
一次开多个 spawn 不就行了

用 expect 的 indirect spawn ids 功能,man expect 里找
MaskRay 发表于 2011-05-13 12:57



    expect慢, 并且我的工具不只实现改密码,改密码只是个宣传,哈哈
作者: o0o0o1    时间: 2011-05-15 15:32
个人觉得secureCRT的vbs脚本更好用,无需在服务器上安装客户端
作者: qq5357612    时间: 2011-05-16 13:01
太 牛X了。膜拜膜拜
作者: MaskRay    时间: 2011-05-16 17:34
expect慢, 并且我的工具不只实现改密码,改密码只是个宣传,哈哈
alex3714 发表于 2011-05-14 09:36



我是指一次开多个 spawn,expect 时指定 indirect spawn ids,这样假设每台服务器连接和执行命令所需的时间都差不多,那么当前等待了
“服务器0的连接时间”后,其他服务器也都连接上了。其实就是个并行的思路
作者: alex3714    时间: 2011-05-17 14:28
我是指一次开多个 spawn,expect 时指定 indirect spawn ids,这样假设每台服务器连接和执行命令所需 ...
MaskRay 发表于 2011-05-16 17:34



    理解,有机会 试试,多谢。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2