Breaking News
Loading...
01 December 2011

Mikrotik Backup Sistem Otomatis Ke Email (gmail)

Kita sebagai administrator jaringan, tentunya kadang bisa mengatur lebih dari satu router mikrotik, nah tentunya kita pasti punya catatan/backup system agar setiap saat kalau terjadi gangguan dengan cepat dapat diatasi. Cara termudah adalah dengan membuat backup di file mikrotik, kemudia tekan backup. Copy file tersebut dan simpan baik-baik.
Nah persoalan jadi lain bila kita lupa menyimpannya, atau ternyata harddisk yang dipakai buat menyimpan file konfigurasi itu rusak, bisa berabe kan?
Disini saya akan memberikan tips, cara termudah dan sangat aman untuk membackup system mikrotik yang sudah susah paayah kita setting, berikut contoh script nya :
#—-var-var—–
#:local ts [/system clock get time]
#:set ts ([:pick $ts 0 0].[:pick $ts 3 5].[:pick $ts 6 8])
:local ds [/system clock get date]
:set ds ([:pick $ds 7 11].[:pick $ds 0 3].[:pick $ds 4 6])
#———————————————————————————————
#—–BackupSystemAll—–
:local SysAll ([/system identity get name].”-SysAll-”.$ds.”.backup”)
/sys backup save name=$SysAll
#—–mangle—-
:local Mangle ([/system identity get name].”-Mangle-”.$ds.”.rsc”)
/ip firewall mangle export file=$Mangle;
#—–queue—–
:local Queue ([/system identity get name].”-Queue-”.$ds.”.rsc”)
/queue tree export file=$Queue;
#—–firewall—–
:local Firewall ([/system identity get name].”-Firewall-”.$ds.”.rsc”)
/ip firewall filter export file=$Firewall
#—–script—–
:local Script ([/system identity get name].”-Script-”.$ds.”.rsc”)
/sys script export file=$Script
#—–scheduler—–
:local Scheduler ([/system identity get name].”-Scheduler-”.$ds.”.rsc”)
/sys scheduler export file=$Scheduler
#—–scheduler—–
:local Email ([/system identity get name].”-Email-”.$ds.”.rsc”)
/tool e-mail export file=$Email :log info “Created $Mangle, $Queue, $Firewall, $Script, $Scheduler, $Email success..”
#—–send email—-
#—–sysall—–
:delay 30s
/tool e-mail send subject=$SysAll body=”WarnetCW-SystemAll.backup” to=”EMAIL_ANDA” tls=yes file=$SysAll
#—–mangle—–
:delay 30s
/tool e-mail send subject=$Mangle body=”WarnetCW-Mangle.rsc” to=”EMAIL_ANDA” tls=yes file=$Mangle
#—–queue—–
:delay 30s
/tool e-mail send subject=$Queue body=”WarnetCW-Queue.rsc” to=”EMAIL_ANDA” tls=yes file=$Queue
#—–firewall—–
:delay 30s
/tool e-mail send subject=$Firewall body=”WarnetCW-Firewall.rsc” to=”EMAIL_ANDA” tls=yes file=$Firewall
#—–Script—–
:delay 30s
/tool e-mail send subject=$Script body=”WarnetCW-Script.rsc” to=”EMAIL_ANDA” tls=yes file=$Script
#—–Scheduler—–
:delay 30s
/tool e-mail send subject=$Scheduler body=”WarnetCW-Scheduler.rsc” to=”EMAIL_ANDA” tls=yes file=$Scheduler
/tool e-mail send subject=$Scheduler body=”WarnetCW-Email.rsc” to=”EMAIL_ANDA” tls=yes file=$Email
:log info “Sending e-mail $Mangle, $Queue, $Firewall, $Script, $Scheduler, $Email success..”
#———————————————————————————————
#—-Deleting-Deleting—-
#—–deleting file created before—-
:delay 120s
:if ([:len [/file find name=$SysAll]] > 0) do={/file remove $SysAll}
#—–deleting file created before—-
:if ([:len [/file find name=$Mangle]] > 0) do={/file remove $Mangle}
#—–deleting file created before—-
:if ([:len [/file find name=$Queue]] > 0) do={/file remove $Queue}
#—–deleting file created before—-
:if ([:len [/file find name=$Firewall]] > 0) do={/file remove $Firewall}
#—–deleting file created before—-
:if ([:len [/file find name=$Script]] > 0) do={/file remove $Script}
#—–deleting file created before—-
:if ([:len [/file find name=$Scheduler]] > 0) do={/file remove $Scheduler}
#—–deleting file created before—-
:if ([:len [/file find name=$Email]] > 0) do={/file remove $Email}
:log info “Deleting file $SysAll, $Mangle, $Queue, $Firewall, $Script, $Scheduler, $Email success..”
#-
Namun sebelumnya kita harus mengatur SMTP server email yang kita gunakan dengan cara :
Jalankan new terminal, kemudian jalankan perintah :
/tool e-mail
set address=74.125.155.16 from=-ISI_ALAMAT_EMAIL_ANDA- password=-PASSWORD_EMAIL_ANDA port=587 user=-USER_EMAIL_ANDA-
Sekian, kalau mau menjalankan otomatis, tinggal dibuatkan scheduler.

0 komentar:

Post a Comment

 
Toggle Footer