写了个小工具FaultTestTools,专用于服务端故障注入
来源:互联网 发布:java开发客户端程序 编辑:程序博客网 时间:2024/06/06 17:47
"""
auth : wenshan
time :
version : v1.0.0
"""
import main
import time
if __name__ == "__main__":
while True:
try:
inputName = raw_input("""
1.reboot :reboot the PC.
2.service_stop -name :stop service.
service_start -name :start service.
3.customer_stop -name :run customer command.
customer_start -name :run customer command.
4.cpu_limit_start -processName -rate :limit the process under the rate.
cpu_limit_stop :stop the service cpulimt.
cpu_nervous -rate :cpu nervous,havn't recover funtion.
5.mem_leak :mem nervous,havn't recover funtion.
6.process_leak :loop create process.havn't recover funtion.
thread_lead :loop create thread.havn't recover funtion.
7.disk_full_all :fill all disk.
disk_full_all_recover :recover
disk_full_customer -filename -mbytes :create a file.havn't recover funtion.
disk_slow -swapname -gbytes -seconds :disk slow.havn't recover funtion.
8.network_delay -msdelaytime :delay the network
network_delay_stop -msDelayTime :recover
network_wave_delay -startMsDelayTime -endMsDelayTime:wave delay
network_wave_delay_stop -startMsDelayTime -endMsDelayTime :recover
network_limit -kbit :limit network
network_limit_stop -kbit :recover
network_package_corrupt -rate :package corrupt
network_package_corrupt_stop -rate :recover
network_package_lost -rate :package lost
network_package_lost_stop -rate :recover
network_package_duplicate -rate :package duplicate
network_package_duplicate_stop -rate :recover
9.ulimit -number :limit the file handler
apache_maxclients :change the apache max clients
10.exit\n\nplease choice=""")
command = inputName.split(' ')
if command[0] == 'reboot':
main.downtime()
elif command[0] == 'service_stop':
serviceName = command[1].replace('-', '')
main.service_stop(serviceName)
elif command[0] == 'service_start':
serviceName = command[1].replace('-', '')
main.service_start(serviceName)
elif command[0] == 'customer_stop':
serviceName = command[1].replace('-', '')
main.customer_stop(serviceName)
elif command[0] == 'customer_start':
serviceName = command[1].replace('-', '')
main.customer_start(serviceName)
elif command[0] == 'cpu_limit_start':
processName = command[1].replace('-', '')
rate = command[2].replace('-', '')
main.cpu_limit_start(processName, rate)
elif command[0] == 'cpu_limit_stop':
main.cpu_limit_stop()
elif command[0] == 'cpu_nervous':
rate = command[1].replace('-', '')
main.cpu_nervous(rate)
elif command[0] == 'mem_leak':
main.mem_leak()
elif command[0] == 'process_leak':
main.process_leak()
elif command[0] == 'thread_lead':
main.thread_lead()
elif command[0] == 'disk_full_all':
main.disk_full_all()
elif command[0] == 'disk_full_all_recover':
main.disk_full_all_recover()
elif command[0] == 'disk_full_customer':
filename = command[1].replace('-', '')
d = command[2].replace('-', '')
main.disk_full_customer(filename, d)
elif command[0] == 'disk_slow':
s = command[1].replace('-', '')
g = command[2].replace('-', '')
se = command[3].replace('-', '')
main.disk_slow(s, g, se)
elif command[0] == 'network_delay':
m = command[1].replace('-', '')
main.network_delay(m)
elif command[0] == 'network_delay_stop':
m = command[1].replace('-', '')
main.stop_network_delay(m)
elif command[0] == 'network_wave_delay':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.network_wave_delay(s, e)
elif command[0] == 'network_wave_delay_stop':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.stop_network_delay(s, e)
elif command[0] == 'network_limit':
k = command[1].replace('-', '')
main.network_limit(k)
elif command[0] == 'network_limit_stop':
k = command[1].replace('-', '')
main.stop_network_limit(k)
elif command[0] == 'network_package_corrupt':
m = command[1].replace('-', '')
main.network_package_corrupt(m)
elif command[0] == 'network_package_corrupt_stop':
m = command[1].replace('-', '')
main.stop_network_package_corrupt(m)
elif command[0] == 'network_package_lost':
m = command[1].replace('-', '')
main.network_package_lost(m)
elif command[0] == 'network_package_lost_stop':
m = command[1].replace('-', '')
main.stop_network_package_lost(m)
elif command[0] == 'network_package_duplicate_stop':
m = command[1].replace('-', '')
main.stop_network_package_duplicate(m)
elif command[0] == 'network_package_duplicate':
m = command[1].replace('-', '')
main.network_package_duplicate(m)
elif command[0] == 'ulimit':
m = command[1].replace('-', '')
main.ulimit(m)
elif command[0] == 'apache_maxclients':
main.apache_maxclients()
elif command[0] == 'exit':
break
else:
print 'order error'
time.sleep(2)
except Exception, e:
print e
auth : wenshan
time :
version : v1.0.0
"""
import main
import time
if __name__ == "__main__":
while True:
try:
inputName = raw_input("""
1.reboot :reboot the PC.
2.service_stop -name :stop service.
service_start -name :start service.
3.customer_stop -name :run customer command.
customer_start -name :run customer command.
4.cpu_limit_start -processName -rate :limit the process under the rate.
cpu_limit_stop :stop the service cpulimt.
cpu_nervous -rate :cpu nervous,havn't recover funtion.
5.mem_leak :mem nervous,havn't recover funtion.
6.process_leak :loop create process.havn't recover funtion.
thread_lead :loop create thread.havn't recover funtion.
7.disk_full_all :fill all disk.
disk_full_all_recover :recover
disk_full_customer -filename -mbytes :create a file.havn't recover funtion.
disk_slow -swapname -gbytes -seconds :disk slow.havn't recover funtion.
8.network_delay -msdelaytime :delay the network
network_delay_stop -msDelayTime :recover
network_wave_delay -startMsDelayTime -endMsDelayTime:wave delay
network_wave_delay_stop -startMsDelayTime -endMsDelayTime :recover
network_limit -kbit :limit network
network_limit_stop -kbit :recover
network_package_corrupt -rate :package corrupt
network_package_corrupt_stop -rate :recover
network_package_lost -rate :package lost
network_package_lost_stop -rate :recover
network_package_duplicate -rate :package duplicate
network_package_duplicate_stop -rate :recover
9.ulimit -number :limit the file handler
apache_maxclients :change the apache max clients
10.exit\n\nplease choice=""")
command = inputName.split(' ')
if command[0] == 'reboot':
main.downtime()
elif command[0] == 'service_stop':
serviceName = command[1].replace('-', '')
main.service_stop(serviceName)
elif command[0] == 'service_start':
serviceName = command[1].replace('-', '')
main.service_start(serviceName)
elif command[0] == 'customer_stop':
serviceName = command[1].replace('-', '')
main.customer_stop(serviceName)
elif command[0] == 'customer_start':
serviceName = command[1].replace('-', '')
main.customer_start(serviceName)
elif command[0] == 'cpu_limit_start':
processName = command[1].replace('-', '')
rate = command[2].replace('-', '')
main.cpu_limit_start(processName, rate)
elif command[0] == 'cpu_limit_stop':
main.cpu_limit_stop()
elif command[0] == 'cpu_nervous':
rate = command[1].replace('-', '')
main.cpu_nervous(rate)
elif command[0] == 'mem_leak':
main.mem_leak()
elif command[0] == 'process_leak':
main.process_leak()
elif command[0] == 'thread_lead':
main.thread_lead()
elif command[0] == 'disk_full_all':
main.disk_full_all()
elif command[0] == 'disk_full_all_recover':
main.disk_full_all_recover()
elif command[0] == 'disk_full_customer':
filename = command[1].replace('-', '')
d = command[2].replace('-', '')
main.disk_full_customer(filename, d)
elif command[0] == 'disk_slow':
s = command[1].replace('-', '')
g = command[2].replace('-', '')
se = command[3].replace('-', '')
main.disk_slow(s, g, se)
elif command[0] == 'network_delay':
m = command[1].replace('-', '')
main.network_delay(m)
elif command[0] == 'network_delay_stop':
m = command[1].replace('-', '')
main.stop_network_delay(m)
elif command[0] == 'network_wave_delay':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.network_wave_delay(s, e)
elif command[0] == 'network_wave_delay_stop':
s = command[1].replace('-', '')
e = command[2].replace('-', '')
main.stop_network_delay(s, e)
elif command[0] == 'network_limit':
k = command[1].replace('-', '')
main.network_limit(k)
elif command[0] == 'network_limit_stop':
k = command[1].replace('-', '')
main.stop_network_limit(k)
elif command[0] == 'network_package_corrupt':
m = command[1].replace('-', '')
main.network_package_corrupt(m)
elif command[0] == 'network_package_corrupt_stop':
m = command[1].replace('-', '')
main.stop_network_package_corrupt(m)
elif command[0] == 'network_package_lost':
m = command[1].replace('-', '')
main.network_package_lost(m)
elif command[0] == 'network_package_lost_stop':
m = command[1].replace('-', '')
main.stop_network_package_lost(m)
elif command[0] == 'network_package_duplicate_stop':
m = command[1].replace('-', '')
main.stop_network_package_duplicate(m)
elif command[0] == 'network_package_duplicate':
m = command[1].replace('-', '')
main.network_package_duplicate(m)
elif command[0] == 'ulimit':
m = command[1].replace('-', '')
main.ulimit(m)
elif command[0] == 'apache_maxclients':
main.apache_maxclients()
elif command[0] == 'exit':
break
else:
print 'order error'
time.sleep(2)
except Exception, e:
print e
0 0
- 写了个小工具FaultTestTools,专用于服务端故障注入
- 写了个小工具:进程批量结束专用程序
- 今天写了个小工具
- 用python wx写了个启动小工具
- 写了 几个 json 生成小工具
- 写了个MySQL数据备份小工具,放出来跟大家分享一下,欢迎拍砖。
- HTTP客户端+服务端小工具
- JS_小工具_自己写了一个画像素画的小工具
- 写了一个管理桌面图标的小工具
- 写了一个桌面切换的小工具
- 写了一个生成api文档的小工具
- 这两天写了两个开源小工具
- 自己写个小工具——图片水印生成器
- JDK5个小工具
- 内核小工具自己写
- C++写的小工具
- 开发了一个小工具
- 发布个归档小工具
- c++关于#include <afx.h>头文件错误问题
- CCF-201409-1 相邻数对
- Android MVP模式 解析JSON 显示到ListView上
- CSS3 多列布局(20160904-0035)
- Restful定义诠释
- 写了个小工具FaultTestTools,专用于服务端故障注入
- NumPy学习笔记
- 标签总结
- 把double型转换为int型
- 第五章 医学图像增强
- 升级Python2.7到Python3
- ubuntu显示ip为127.0.0.1
- Android中的内部存储和外部存储复习
- (第二周项目3)体验复杂度(2)