实时警报通知:微信告警通知的重要性解析
895
2022-10-02
zData-更改计算主机名
#!/opt/zdata/storage/python/bin/pythonimport sysfrom etcd_service import EtcdServicedef export_etcd_data(): ef=EtcdService() list_all_key = ef.listallkey('/') f=open('etcd_data.txt','w') for one_key in list_all_key: f.write(one_key.key+'=====') f.write(one_key.value+'\n') f.close() print 'export conf to etcd_data.txt succeed'def import_etcd_data(): ef=EtcdService() f=open('etcd_data.txt','r') line_list = f.readlines() for line_one in line_list: key,value = line_one.rstrip('\n').split('=====') ef.set(key,value) f.close() print 'import succeed'if __name__ == "__main__": if len(sys.argv) == 2 and sys.argv[1] == 'export': export_etcd_data() elif len(sys.argv) == 2 and sys.argv[1] == 'import': import_etcd_data() else: print 'Usage:/opt/zdata/storage/python/bin/python etcd_backup.pyc
发表评论
暂时没有评论,来抢沙发吧~