扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
参考链接:https://github.com/ytti/oxidized
测试环境:CentOS Linux release 7.3.1611 (Core)
主要组件:oxidized oxidized-script oxidized-web
注意:oxidized-web需要ruby2.3以上支持,如不安装oxidized-web,配置文件里rest 修改为false
centos7默认ruby为2.0版本,需要单独安装。
yum install centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install -y rh-ruby25-ruby-devel
yum install rh-ruby25
scl enable rh-ruby25 bash
ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
cp /opt/rh/rh-ruby25/root/usr/lib64/libruby.so.2.5 /usr/lib/
设置登录时自动启动ruby2.5:
vim /etc/profile.d/rh-ruby25.sh
#!/bin/bash
source /opt/rh/rh-ruby25/enable
export X_SCLS="scl enable rh-ruby25 'echo $X_SCLS'
"
export PATH=$PATH:/opt/rh/rh-ruby25/root/usr/local/bin
gem install oxidized
gem install oxidized-script oxidized-web
useradd -m -d /home/oxidized oxidized
cp /opt/rh/rh-ruby25/root/usr/local/share/gems/gems/oxidized-0.24.0/extra/oxidized.service /lib/systemd/system
mkdir -p /home/oxidized/.config/oxidized
mkdir /home/oxidized/.config/oxidized/logs/
mkdir /home/oxidized/.config/oxidized/configs
chown oxidized:oxidized /home/oxidized/.config/oxidized
username: username
password: password
model: junos
interval: 3600
log: /home/oxidized/.config/oxidized/logs/oxidized.log
debug: false
threads: 30
timeout: 20
retries: 3
prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/
rest: 127.0.0.1:8888
next_adds_job: false
vars: {}
groups: {}
models: {}
pid: "/home/oxidized/.config/oxidized/pid"
input:
default: ssh, telnet
debug: false
ssh:
secure: false
output:
default: file
file:
directory: "/home/oxidized/.config/oxidized/configs"
source:
default: csv
csv:
file: "/home/oxidized/.config/oxidized/router.db"
delimiter: !ruby/regexp /:/
map:
name: 0
model: 1
username: 2
password: 3
gpg: false
model_map:
cisco: ios
juniper: junos
vim home/oxidized/.config/oxidized/router.db
172.18.31.11:comware:user:passwd
systemctl restart oxidized.service
systemctl status oxidized.service
至此,自动备份基础功能已完成,可在目录里查看备份的配置文件,接下来配置可用web页面查看比较直观。
yum install nginx
vim /etc/nginx/conf.d/oxidized.conf
cat /etc/nginx/conf.d/oxidized.conf
server {
listen 80;
server_name 172.18.34.45;
location / {
proxy_pass http://127.0.0.1:8888/;
}
access_log /var/log/nginx/access_oxidized.log;
error_log /var/log/nginx/error_oxidized.log;
}
systemctl restart nginx.service
yum -y install git
yum install libgit2
git config user.name Oxidized
git config user.email “o@example.com”
systemctl restart oxidized.service
systemctl status oxidized.service
通过区域按钮可查看每个版本配置差异。
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流