2 Star 7 Fork 1

gsls200808 / Switch-Configuration-Backup-and-Change-Detection

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Switch-Configuration-Backup-and-Change-Detection

介绍

交换机配置备份及变更检测

软件架构

python版本支持3.x 使用telent,ssh方式读取交换机配置,telent采用telnetlib方式,ssh采用paramiko方式,对于more处理,暂时采用字符串匹配,不考虑正则。
保存文件分本地和OSS模式,对比采用difflib库
发送邮件使用smtplib库,支持最常使用的QQ邮箱和Yandex邮箱 读取曾考虑netmiko库,但是简化程度太少

安装说明

  1. 适用于CentOS7系统的安装命令
mkdir -p /data/app/
cd /data/app
git clone https://gitee.com/gsls200808/Switch-Configuration-Backup-and-Change-Detection.git
mv Switch-Configuration-Backup-and-Change-Detection switchConfig
cd switchConfig
# 安装依赖
pip3 install -r requirements.txt
# 第二种方式安装依赖
pip3 install paramiko
pip3 install oss2

使用说明

  1. 安装python3,参考https://www.cnblogs.com/yangzhaon/p/11203395.html
  2. 修改QQSendEmail.py或者YandexSendEmail.py配置成你自己的邮箱地址,后续考虑做成可配置化的
  3. 修改SwitchConfig.json 配置交换机IP,保存文件名,查看配置命令 终端前缀等信息
  4. 执行命令
python3 mainRun.py
  1. 若mainRun.py的所在目录目录位于/data/app/switchConfig,也可以执行
chmod +x mainRun.sh
./mainRun.sh
  1. 设置定时
crontab -e
i进入编辑模式,输入如下内容

30 8 * * *  /data/app/switchConfig/mainRun.sh

:wq回车保存

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

空文件

简介

交换机配置备份及变更检测 展开 收起
Python
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/gsls200808/Switch-Configuration-Backup-and-Change-Detection.git
git@gitee.com:gsls200808/Switch-Configuration-Backup-and-Change-Detection.git
gsls200808
Switch-Configuration-Backup-and-Change-Detection
Switch-Configuration-Backup-and-Change-Detection
master

搜索帮助