之前开发了php+mysql+shell运维监控系统,监控起来很方便,但在运维管理方便还是不能实现,所以最近打算使用python语言编写一套的运维管理系统,可以使用单台或多台机器同时管理与部署等功能,实现类似func、triaquae等管理软件功能。

本软件是参考了triaquae软件的思路(对方软件地址为http://triaquae2.sinaapp.com/),参考对方软件的组方面的部分代码,经过与原作者Alex Li的协商,允许我使用对方部分代码与思路,所以我把此软件进行开源,分享给大家。

 

 下面开始安装与应用测试



一、软件的安装



软件可以到https://github.com/dl528888/auto_op/里面进行下载



1、先解压软件




  1. root@squid:/tmp# tar zxvf auto_op.tar.gz   
  2. auto/  
  3. auto/auto_op.py  
  4. auto/setup.py  
  5. auto/install.txt  

安装前软件的结构
 




  1. root@squid:/tmp# tree auto  
  2. auto  
  3. |-- auto_op-software-install-and-function-document.docx         #中文的安装文档  
  4. |-- auto_op.py                                              #程序包  
  5. |-- install.txt                                             #软件介绍与安装说明  
  6. `-- setup.py                                                #部署环境与安装          
  7.  
  8. 0 directories, 4 files  

2、进入目录查看安装文档install.txt




  1. root@squid:/tmp# cd auto/  
  2. root@squid:/tmp/auto# ll  
  3. total 44  
  4. drwxr-xr-x 2 root root  4096 Mar 20 23:44 ./  
  5. drwxrwxrwt 8 root root  4096 Mar 21 09:56 ../  
  6. -rw-r--r-- 1 root root 24774 Mar 20 23:33 auto_op.py  
  7. -rw-r--r-- 1 root root   494 Mar 20 23:44 install.txt  
  8. -rw-r--r-- 1 root root  3346 Mar 20 22:53 setup.py  
  9. root@squid:/tmp/auto# cat install.txt   
  10. Version 1.0  
  11.  
  12. Introduction  
  13. This software is manage many servers.I refer to TriAquae.TriAquae's author is Alex Li.You can let all your Linux servers(or single server)  doing the same job in the same time,such as send a file,run a script,modify file,excute command and etc.  
  14.  
  15. Install  
  16.  
  17. 1. tar zxvf auto_op.tar.gz  
  18. 2. cd auto  
  19. 3. python setup.py build --prefix=/installdir/  
  20. 4. python setup.py install  
  21. 5. /installdir/auto_op.py  
  22.  
  23. Support  
  24.  
  25. If you have some problem , you can send mailto 244979152@qq.com.  

3、根据安装文档安装,先指定安装目录




  1. root@squid:/tmp/auto# python setup.py build --prefix=/usr/local/auto_op  
  2. Start to check pre-installation environment...................................  
  3.  
  4. direcotry not exsit,creating successful........  
  5. If no error printed out , you can run 'python setup.py install' to install the program  

4、然后再进行安装




  1. root@squid:/tmp/auto# python setup.py install  
  2. Extract files to working directory...  
  3.  
  4.  
  5. Complete ok  
  6. Now you can run /usr/local/auto_op/auto_op.py start manage your network.  

5、进入安装目录运行软件




  1. root@squid:/tmp/auto# cd /usr/local/auto_op/  
  2. root@squid:/usr/local/auto_op# ll  
  3. total 36  
  4. drwxr-xr-x  2 root root  4096 Mar 21 10:02 ./  
  5. drwxr-xr-x 12 root root  4096 Mar 21 10:02 ../  
  6. -rw-r--r--  1 root root 24783 Mar 21 10:02 auto_op.py  
  7. root@squid:/usr/local/auto_op# chmod 755 auto_op.py   
  8. root@squid:/usr/local/auto_op# ll  
  9. total 36  
  10. drwxr-xr-x  2 root root  4096 Mar 21 10:02 ./  
  11. drwxr-xr-x 12 root root  4096 Mar 21 10:02 ../  
  12. -rwxr-xr-x  1 root root 24783 Mar 21 10:02 auto_op.py*  
  13. root@squid:/usr/local/auto_op# ./auto_op.py   
  14. ------------------------------------Memu list-----------------------------------------------------------  
  15.                 1. Add new group  
  16.                 2. Rename group name  
  17.                 3. Delete group  
  18.                 4. List group member  
  19.                 5. List host in the group  
  20.                 6. Add new server to group  
  21.                 7. Delete server from group  
  22.                 8. Command excution on group servers  
  23.                 9. Command excution on one server  
  24.                 10. Upload or download on group servers  
  25.                 11. Upload or download on one server  
  26.                 12. Quit  
  27. --------------------------------Input number of you want to exec command---------------------------------  
  28.                                                                                Author is DengLei  

可以看到有很多选项,下面是介绍




  1. 1. Add new group                        #添加新组  
  2. 2. Rename group name                    #对组重命名  
  3. 3. Delete group                     #删除组  
  4. 4. List group member                    #列出已有的组名称与成员数量  
  5. 5. List host in the group                   #列出组内的主机ip  
  6. 6. Add new server to group              #增加新主机到组里  
  7. 7. Delete server from group             #删除组里的主机  
  8. 8. Command excution on group servers        #在组内的所有主机统一执行命令  
  9. 9. Command excution on one server       #对组内的某个主机执行命令  
  10. 10. Upload or download on group servers #对组内的所有主机进行上传与下载文件  
  11. 11. Upload or download on one server        #对组内的某个主机进行上传与下载文件  
  12. 12. Quit                                #退出  

安装后的软件结构




  1. root@squid:/tmp# tree /usr/local/auto_op/  
  2. /usr/local/auto_op/  
  3. |-- auto_op.py                          #程序包  
  4. |-- logs                                #日志目录  
  5. |   `-- operation.log                   #操作日志  
  6. `-- server_list                         #组目录  
  7.     `-- test                            #组  
  8.  
  9. 2 directories, 3 files  

二、测试



1、选择1进行创建新组




  1. please input you choice:1                           #选择1创建新组  
  2. please input new group name:test                        #组名为test  
  3. Created group test successful.  
  4. Do you want to add new server to Group test [ Y / N ]:y #选择添加新主机到test组里  
  5. Input new server IP or Hostname:192.168.101.235     #新主机的ip  
  6. Input newser's port:22                              #新主机的端口  
  7. Input newser's username:root                        #新主机的用户名  
  8. Input newser's password:123456                      #新主机的秘密  
  9. New server 192.168.101.235 added successfully.  


2、在新创建个one组,然后进行重命名组操作




  1. please input you choice:1                            #选项1是创建新组  
  2. please input new group name:one                      #新组名为one  
  3. Created group one successful.  
  4. Do you want to add new server to Group one [ Y / N ]:n  #不添加主机到组里     
  5. ------------------------------------Memu list-----------------------------------------------------------  
  6.                 1. Add new group  
  7.                 2. Rename group name  
  8.                 3. Delete group  
  9.                 4. List group member  
  10.                 5. List host in the group  
  11.                 6. Add new server to group  
  12.                 7. Delete server from group  
  13.                 8. Command excution on group servers  
  14.                 9. Command excution on one server  
  15.                 10. Upload or download on group servers  
  16.                 11. Upload or download on one server  
  17.                 12. Quit  
  18. --------------------------------Input number of you want to exec command---------------------------------  
  19.                                                                                Author is DengLei  
  20. please input you choice:2                            #选项2是对组重命名  
  21. ---------------  
  22. Which group name do you want to change?:one          #重命名组为one  
  23. New name:first                                   #重命名为first  
  24.  group name of one changed to first  

3、选择4查看本机所有组的状态




  1. please input you choice:4  
  2. now there is group is  
  3. test[1]  
  4. first[0]  

可以看到test组有1个成员,first没有成员



4、删除first组




  1. please input you choice:3                                #选项3是删除组  
  2. please inupt you want to del group name:first                #输入要删除的组名  
  3. first     
  4. Are you sure you want to delete groupfirst [ Y / N ]: y         #确认是否删除  
  5. Deleted group first  
  6.    
  7. ------------------------------------Memu list-----------------------------------------------------------  
  8.                 1. Add new group  
  9.                 2. Rename group name  
  10.                 3. Delete group  
  11.                 4. List group member  
  12.                 5. List host in the group  
  13.                 6. Add new server to group  
  14.                 7. Delete server from group  
  15.                 8. Command excution on group servers  
  16.                 9. Command excution on one server  
  17.                 10. Upload or download on group servers  
  18.                 11. Upload or download on one server  
  19.                 12. Quit  
  20. --------------------------------Input number of you want to exec command---------------------------------  
  21.                                                                                Author is DengLei  
  22. please input you choice:4                                #在查看一下当前的所有组  
  23. now there is group is  
  24. test[1]  

5、选择5查看test组里所有的主机




  1. please input you choice:5                                #选项5查看组内的主机  
  2.  
  3. Input Group name which the server is in:test                #输入查看的组名  
  4. ------------------------Server List----------------------------  
  5. 192.168.101.235                                      #test组内的主机  

6、选项6增加新主机到组里




  1. please input you choice:6                               #选项6添加新主机到组  
  2.  
  3. Input Group name which the server is in:test            #选项添加新主机的组  
  4. ------------------------Server List----------------------------  
  5. 192.168.101.235                                      #组内的所有主机  
  6.  
  7. groupfile is /usr/local/auto_op/server_list/test  
  8. Input new server IP or Hostname:192.168.101.236         #新主机的ip  
  9. Input newser's port:22                                  #新主机的端口  
  10. Input newser's username:root                            #新主机的用户  
  11. Input newser's password:123456                       #新主机的密码  
  12. New server 192.168.101.236 added successfully.  
  13. Keep on adding new server?:[ Y / N ]y                   #是否继续添加新主机  
  14. Input new server IP or Hostname:1.1.1.1  
  15. Input newser's port:22  
  16. Input newser's username:root  
  17. Input newser's password:123456  
  18. New server 1.1.1.1 added successfully.  
  19. Keep on adding new server?:[ Y / N ]n  

7、选择7删除主机从组里




  1. please input you choice:7  
  2.  
  3. Input Group name which the server is in:test  
  4. ------------------------Server List----------------------------  
  5. 192.168.101.235  
  6. 192.168.101.236  
  7. 1.1.1.1  
  8.  
  9.  
  10. Notice: All matched IP adresses will be deleted,becare  
  11. Input the server IP which you want to delete:1.1.1.1  
  12. 1.1.1.1  
  13. matched rows: 1  
  14. Do you want to delete all the matched rows?(y/n)y  
  15. IP 1.1.1.1 has been deleted from group test   
  16.  
  17. Notice: All matched IP adresses will be deleted,becare  
  18. Input the server IP which you want to delete:you command is CTRL+C go back  
  19. ------------------------------------Memu list-----------------------------------------------------------  
  20.                 1. Add new group  
  21.                 2. Rename group name  
  22.                 3. Delete group  
  23.                 4. List group member  
  24.                 5. List host in the group  
  25.                 6. Add new server to group  
  26.                 7. Delete server from group  
  27.                 8. Command excution on group servers  
  28.                 9. Command excution on one server  
  29.                 10. Upload or download on group servers  
  30.                 11. Upload or download on one server  
  31.                 12. Quit  
  32. --------------------------------Input number of you want to exec command---------------------------------  
  33.                                                                                Author is DengLei  
  34. please input you choice:5  
  35.  
  36. Input Group name which the server is in:test  
  37. ------------------------Server List----------------------------  
  38. 192.168.101.235  
  39. 192.168.101.236  

8、选项8对组内所有主机同时执行命令




  1. please input you choice:8                    #选择8对组内所有主机执行命令  
  2. now there is group is                        #列出当前所有的组  
  3. test[2]  
  4. please input you choice group:test               #输入项执行命令的组  
  5. You choice test group  
  6. please input you want to select command,Ctrl + C to quit:hostname       #输入执行的命令  
  7. -------------------------------  
  8. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:21:51  
  9. exec result is  
  10. linux-cbb3                                                   #执行的结果  
  11.  192.168.101.235 exec command ['hostname'] OK!  
  12. end time is 2013-03-21 10:21:51  
  13. -------------------------------  
  14. -------------------------------  
  15. start to connect ip 192.168.101.236 port 22 username root  at time 2013-03-21 10:21:51  
  16. exec result is  
  17. squid  
  18.  192.168.101.236 exec command ['hostname'] OK!  
  19. end time is 2013-03-21 10:21:52  
  20. -------------------------------  
  21. please input you want to select command,Ctrl + C to quit:  

9、选项9对组内的某个主机执行命令




  1. please input you choice:9                            #选择9  
  2. now there is group is                                 
  3. test[2]  
  4.  
  5. Input Group name which the server is in:test                                 #选择test组  
  6. ------------------------Server List----------------------------  
  7. 192.168.101.235  
  8. 192.168.101.236  
  9.  
  10. Please input you want to execute the command of the host name:192.168.101.235   #选择主机  
  11. please input you want to select command,Ctrl + C to quit:uptime              #输入命令  
  12. -------------------------------  
  13. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:23:50  
  14. exec result is  
  15.  10:25pm  up 152 days 18:02,  1 user,  load average: 0.07, 0.02, 0.00  
  16.  192.168.101.235 exec command ['uptime'] OK!  
  17. end time is 2013-03-21 10:23:51  
  18. -------------------------------  
  19. please input you want to select command,Ctrl + C to quit:  

10、选项10是对组内进行文件的上传与下载




  1. please input you choice:10  
  2. ------------------------------------Memu list-----------------------------------------------------------  
  3.                 1. Upload file to remote group servers  
  4.                 2. Download file to remote group server  
  5.                 3. Quit  
  6. --------------------------------Input number of you want to exec command---------------------------------  
  7.                                                                                Author is DengLei  

可以看到选项10里有3个选项



1、把本地的文件上传到组内所有主机里



2、从组内的所有主机下载文件到本机



3、退出



我们先进行1项,把本地的文件上传到组内所有主机里




  1. please input you choice:1  
  2. now there is group is  
  3. test[2]  
  4. please input you choice group:test  
  5. You choice test group  
  6. please input you want to upload localpath file name,Ctrl + C to quit:/tmp/log   #上传本机的文件  
  7. please input you want to upload remotepath file name,Ctrl + C to quit:/tmp/test-upload-file-to-group.log        #上传到组内主机的文件名  
  8. Are you sure upload file from /tmp/log to /tmp/test-upload-file-to-group.log in the test group y  
  9. ------------------------------- #确认是否传输  
  10. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:28:46  
  11. 192.168.101.235 exec put /tmp/log to /tmp/test-upload-file-to-group.log OK!  
  12. end time is 2013-03-21 10:28:47  
  13. -------------------------------  
  14. -------------------------------  
  15. start to connect ip 192.168.101.236 port 22 username root  at time 2013-03-21 10:28:47  
  16. 192.168.101.236 exec put /tmp/log to /tmp/test-upload-file-to-group.log OK!  
  17. end time is 2013-03-21 10:28:47  
  18. -------------------------------  

查询的话就是




  1. please input you choice:8  
  2. now there is group is  
  3. test[2]  
  4. please input you choice group:test  
  5. You choice test group  
  6. please input you want to select command,Ctrl + C to quit:ls -l /tmp/test-upload-file-to-group.log  
  7. -------------------------------  
  8. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:30:42  
  9. exec result is  
  10. -rw-r--r-- 1 root root 21 Mar 21 22:30 /tmp/test-upload-file-to-group.log  
  11.  192.168.101.235 exec command ['ls -l /tmp/test-upload-file-to-group.log'] OK!  
  12. end time is 2013-03-21 10:30:42  
  13. -------------------------------  
  14. -------------------------------  
  15. start to connect ip 192.168.101.236 port 22 username root  at time 2013-03-21 10:30:42  
  16. exec result is  
  17. -rw-r--r-- 1 root root 21 Mar 21 10:28 /tmp/test-upload-file-to-group.log  
  18.  192.168.101.236 exec command ['ls -l /tmp/test-upload-file-to-group.log'] OK!  
  19. end time is 2013-03-21 10:30:43  
  20. -------------------------------  

下面进行选项2,从组内的所有主机下载文件到本机




  1. please input you choice:10  
  2. ------------------------------------Memu list-----------------------------------------------------------  
  3.                 1. Upload file to remote group servers  
  4.                 2. Download file to remote group server  
  5.                 3. Quit  
  6. --------------------------------Input number of you want to exec command---------------------------------  
  7.                                                                                Author is DengLei  
  8. please input you choice:2  
  9. now there is group is  
  10. test[2]  
  11. please input you choice group:test  
  12. You choice test group  
  13. please input you want to download localpath file name,Ctrl + C to quit:/tmp/test-download-to-group.log  
  14. please input you want to download remotepath file name,Ctrl + C to quit:/tmp/test-upload-file-to-group.log  
  15. Are you sure download file from /tmp/test-download-to-group.log to /tmp/test-upload-file-to-group.log in the test group y  
  16. -------------------------------  
  17. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:32:13  
  18. 192.168.101.235 exec get /tmp/test-upload-file-to-group.log from /tmp/test-download-to-group.log_192.168.101.235 OK!  
  19. end time is 2013-03-21 10:32:13  
  20. -------------------------------  
  21. -------------------------------  
  22. start to connect ip 192.168.101.236 port 22 username root  at time 2013-03-21 10:32:13  
  23. 192.168.101.236 exec get /tmp/test-upload-file-to-group.log from /tmp/test-download-to-group.log_192.168.101.236 OK!  
  24. end time is 2013-03-21 10:32:14  

我这回是把之前上传的/tmp/test-upload-file-to-group.log文件给现在到本地,命名为/tmp/test-download-to-group.log,由于是不同主机把文件传给本机,所以我在文件名后面加上了他们的ip好区分。



下面是查看的结果




  1. please input you choice:8  
  2. now there is group is  
  3. test[2]  
  4. please input you choice group:test  
  5. You choice test group  
  6. please input you want to select command,Ctrl + C to quit:ls -l /tmp/test-download-to-group.log*  
  7. -------------------------------  
  8. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:34:22  
  9. exec result is  
  10. 192.168.101.235 exec command ['ls -l /tmp/test-download-to-group.log*'] OK!  
  11. end time is 2013-03-21 10:34:22  
  12. -------------------------------  
  13. -------------------------------  
  14. start to connect ip 192.168.101.236 port 22 username root  at time 2013-03-21 10:34:22  
  15. exec result is  
  16. -rw-r--r-- 1 root root 21 Mar 21 10:32 /tmp/test-download-to-group.log_192.168.101.235  
  17.  -rw-r--r-- 1 root root 21 Mar 21 10:32 /tmp/test-download-to-group.log_192.168.101.236  
  18.  192.168.101.236 exec command ['ls -l /tmp/test-download-to-group.log*'] OK!  
  19. end time is 2013-03-21 10:34:23  
  20. -------------------------------  

可以看到主机192.168.101.236已经获得了/tmp/test-download-to-group.log_192.168.101.235与/tmp/test-download-to-group.log_192.168.101.236的2个文件



11、选项11是进行组内某主机的上传与下载,也就是单台主机的




  1. please input you choice:11  
  2. ------------------------------------Memu list-----------------------------------------------------------  
  3.                 1. Upload file to remote one server  
  4.                 2. Download file to remote one server  
  5.                 3. Quit  
  6. --------------------------------Input number of you want to exec command---------------------------------  
  7.                                                                                Author is DengLei  

里面也有3个选项



1、从本机上传文件给远程主机



2、从远程主机下载文件给本机



3、退出



现在进行选项1,从本机上传文件给远程主机




  1. please input you choice:1  
  2. now there is group is  
  3. test[2]  
  4.  
  5. Input Group name which the server is in:test  
  6. ------------------------Server List----------------------------  
  7. 192.168.101.235  
  8. 192.168.101.236  
  9.  
  10. Please input you want to execute the command of the host name:192.168.101.235  
  11. please input you want to upload localpath file name,Ctrl + C to quit:/tmp/test-download-to-group.log_192.168.101.236  
  12. please input you want to upload remotepath file name,Ctrl + C to quit:/tmp/test-upload-to-host.log  
  13. Are you sure upload file from /tmp/test-download-to-group.log_192.168.101.236 to /tmp/test-upload-to-host.log in the 192.168.101.235 host y  
  14. -------------------------------  
  15. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:38:44  
  16. 192.168.101.235 exec put /tmp/test-download-to-group.log_192.168.101.236 to /tmp/test-upload-to-host.log OK!  
  17. end time is 2013-03-21 10:38:44  
  18. -------------------------------  

然后查询




  1. please input you choice:9  
  2. now there is group is  
  3. test[2]  
  4.  
  5. Input Group name which the server is in:test  
  6. ------------------------Server List----------------------------  
  7. 192.168.101.235  
  8. 192.168.101.236  
  9.  
  10. Please input you want to execute the command of the host name:192.168.101.235  
  11. please input you want to select command,Ctrl + C to quit:ls -l /tmp/test-upload-to-host.log  
  12. -------------------------------  
  13. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:39:59  
  14. exec result is  
  15. -rw-r--r-- 1 root root 21 Mar 21 22:40 /tmp/test-upload-to-host.log  
  16.  192.168.101.235 exec command ['ls -l /tmp/test-upload-to-host.log'] OK!  
  17. end time is 2013-03-21 10:40:00  
  18. -------------------------------  

可以看到文件已经上传到192.168.101.235主机了



现在进行选项2,从远程主机下载文件给本机




  1. please input you choice:11  
  2. ------------------------------------Memu list-----------------------------------------------------------  
  3.                 1. Upload file to remote one server  
  4.                 2. Download file to remote one server  
  5.                 3. Quit  
  6. --------------------------------Input number of you want to exec command---------------------------------  
  7.                                                                                Author is DengLei  
  8. please input you choice:2  
  9. now there is group is  
  10. test[2]  
  11.  
  12. Input Group name which the server is in:test  
  13. ------------------------Server List----------------------------  
  14. 192.168.101.235  
  15. 192.168.101.236  
  16.  
  17. Please input you want to execute the command of the host name:192.168.101.235  
  18. please input you want to download localpath file name,Ctrl + C to quit:/tmp/test-download-to-host.log  
  19. please input you want to download remotepath file name,Ctrl + C to quit:/tmp/test-upload-to-host.log  
  20. Are you sure download file from /tmp/test-download-to-host.log to /tmp/test-upload-to-host.log in the 192.168.101.235 host y  
  21. -------------------------------  
  22. start to connect ip 192.168.101.235 port 22 username root  at time 2013-03-21 10:41:04  
  23. 192.168.101.235 exec get /tmp/test-upload-to-host.log from /tmp/test-download-to-host.log_192.168.101.235 OK!  
  24. end time is 2013-03-21 10:41:04  
  25. -------------------------------  

进行查看




  1. please input you choice:9  
  2. now there is group is  
  3. test[2]  
  4.  
  5. Input Group name which the server is in:test  
  6. ------------------------Server List----------------------------  
  7. 192.168.101.235  
  8. 192.168.101.236  
  9.  
  10. Please input you want to execute the command of the host name:192.168.101.236  
  11. please input you want to select command,Ctrl + C to quit:ls -l /tmp/test-download-to-host.log_192.168.101.235  
  12. -------------------------------  
  13. start to connect ip 192.168.101.236 port 22 username root  at time 2013-03-21 10:41:45  
  14. exec result is  
  15. -rw-r--r-- 1 root root 21 Mar 21 10:41 /tmp/test-download-to-host.log_192.168.101.235  
  16.  192.168.101.236 exec command ['ls -l /tmp/test-download-to-host.log_192.168.101.235'] OK!  
  17. end time is 2013-03-21 10:41:46  
  18. -------------------------------  

也传输成功



12、操作日志查看



所有的操作都有存放到日志里,方便查看




  1. root@squid:/tmp# cd /usr/local/auto_op/  
  2. root@squid:/usr/local/auto_op# ll  
  3. total 44  
  4. drwxr-xr-x  4 root root  4096 Mar 21 10:03 ./  
  5. drwxr-xr-x 12 root root  4096 Mar 21 10:02 ../  
  6. -rwxr-xr-x  1 root root 24783 Mar 21 10:02 auto_op.py*  
  7. drwxr-xr-x  2 root root  4096 Mar 21 10:09 logs/  
  8. drwxr-xr-x  2 root root  4096 Mar 21 10:19 server_list/  
  9. root@squid:/usr/local/auto_op# cd logs/  
  10. root@squid:/usr/local/auto_op/logs# ll  
  11. total 16  
  12. drwxr-xr-x 2 root root 4096 Mar 21 10:09 ./  
  13. drwxr-xr-x 4 root root 4096 Mar 21 10:03 ../  
  14. -rw-r--r-- 1 root root 5415 Mar 21 10:41 operation.log  
  15. root@squid:/usr/local/auto_op/logs# tail -f operation.log   
  16. 2013-03-21 10:36:40   show group test server list['192.168.101.235', '192.168.101.236']  
  17. 2013-03-21 10:38:44   192.168.101.235 exec put /tmp/test-download-to-group.log_192.168.101.236 to /tmp/test-upload-to-host.log OK!  
  18. 2013-03-21 10:39:08   show group test server list['192.168.101.235', '192.168.101.236']  
  19. 2013-03-21 10:39:25   192.168.101.235 exec command ['ls -l /tmp/test-download-to-group.log_192.168.101.236'] OK!  
  20. 2013-03-21 10:39:50   show group test server list['192.168.101.235', '192.168.101.236']  
  21. 2013-03-21 10:40:00   192.168.101.235 exec command ['ls -l /tmp/test-upload-to-host.log'] OK!  
  22. 2013-03-21 10:40:38   show group test server list['192.168.101.235', '192.168.101.236']  
  23. 2013-03-21 10:41:04   192.168.101.235 exec get /tmp/test-upload-to-host.log from /tmp/test-download-to-host.log_192.168.101.235 OK!  
  24. 2013-03-21 10:41:24   show group test server list['192.168.101.235', '192.168.101.236']  
  25. 2013-03-21 10:41:46   192.168.101.236 exec command ['ls -l /tmp/test-download-to-host.log_192.168.101.235'] OK!  

可以看到之前的操作



现在本软件的所有功能就都实现了,希望各位能多提供建议与问题,也希望各位同仁能一起分享一下自己对运维自动化的经验,多对软件进行开源,谢谢。


转载于:https://blog.51cto.com/dl528888/1159510