NetScreen のコンフィグの自動バックアップ。
SCS の設定をしてもリモートの Linux ホストから ssh で save config をかけたりは
できないみたい。
$ ssh ns-50 -l netscreen save config from flash to tftp ww.xx.yy.zz ns50.config Disconnecting: protocol error: rcvd type 15 $
ということで、しかたなく expect で対応。
#!/usr/bin/expectspawn ssh ns-50 -l netscreen
expect "> "
send "save config from flash to tftp ww.xx.yy.zz ns50.config\r"expect "> "
send "exit\r"
ってな expect スクリプト(手抜き気味ですが)を呼ぶようにする。
$ bin/backup-ns50-config spawn ssh ns-50 -l netscreen Remote Management Consolens50-> save config from flash to tftp ww.xx.yy.zz ns50.config
Read config from flash.
System config (4502 bytes) loaded
Save configurations (4486 bytes) to ns50.config on TFTP server ww.xx.yy.zz.
!!!!!!!!!!!!!!!!!!!!
tftp transferred records = 9
tftp success!TFTP Succeeded
ns50-> $
ってことで、これを cron にしかける。
Summit みたいにスケジュールできると楽なんだけど。

Leave a comment