您好,登录后才能下订单哦!
参考链接: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
通过区域按钮可查看每个版本配置差异。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。