EEM KONFIGURASI SCHEDULING EVENTS - NETWORK AUTOMATION #11 ( CCNP )

 NETWORK AUTOMATION #11 :

EEM KONFIGURASI SCHEDULING EVENTS 

Misalnya jika kita punya kebutuhan untuk menyimpan konfigurasi setiap 60 detik
sekali maka kita bisa memanfaatkan fitu dari EEM scheduling events.
Untuk topology masih sama, berikut konfigurasinya


R1
R1(config)#event manager applet
BACKUP_BERKALA R1(config-applet)# event
timer watchdog time 60
R1(config-applet)# action 1.0 cli command "enable"
R1(config-applet)# action 2.0 cli command "write memory"
R1(config-applet)# action 3.0 syslog priority informational msg
"Configuration has been saved"
R1(config-applet)# exit
R1#debug event manager action cli
Debug EEM action cli debugging is on
R1
R1# *Feb 7 08:15:01.055: %HA_EM-6-LOG: BACKUP_BERKALA : DEBUG(cli_lib) : :
CTL : cli_open called.
*Feb 7 08:15:01.063: %HA_EM-6-LOG: BACKUP_BERKALA : DEBUG(cli_lib) : : IN :
R1>enable
*Feb 7 08:15:01.075: %HA_EM-6-LOG: BACKUP_BERKALA : DEBUG(cli_lib) : : OUT
: R1#
*Feb 7 08:15:01.075: %HA_EM-6-LOG: BACKUP_BERKALA : DEBUG(cli_lib) : : IN :
R1#write memory
*Feb 7 08:15:04.055: %HA_EM-6-LOG: BACKUP_BERKALA : DEBUG(cli_lib) : : OUT
: Building configuration...
*Feb 7 08:15:04.063: %HA_EM-6-LOG: BACKUP_BERKALA: Configuration has been
saved
R1#
*Feb 7 08:15:04.063: %HA_EM-6-LOG: BACKUP_BERKALA : DEBUG(cli_lib) : : CTL
: cli_close called.
Dari hasil debug diatas router akan menjalankan command “write memory”
setiap 60 detik


IP SLA With EEM Script

 



Kali ini kita akan coba kombinasikan fitur EEM dengan IP SLA, yang mana
nantinya IP SLA ini digunakan untuk fitur monitoring, jadi jika IP SLA
mendetect suatu link down maka EEM akan mengirimkan log ke email kita.
Untuk topology dan konfigurasi masih sama. Tambahkan command ip sla


pada R1
R1
R1(config)#ip sla 1
R1(config-ip-sla)#icmp-echo 2.2.2.2
R1(config-ip-sla-echo)#frequency 10
R1(config-ip-sla-echo)#exit
R1(config)#ip sla schedule 1 life forever start-time now
R1(config)#track 1 ip sla 1 reachability
Konfigurasi EEM pada R1
R1
R1(config)#event manager applet TRACK_IP_DOWN
R1(config-applet)#event track 1 state down
R1(config-applet)#action 1.0 syslog msg "IP SLA 1 is down"
R1(config-applet)#action 2.0 mail server "smtp.gmail.com" to "idn.id" from
"support@idn.id" subject "IP SLA 1 is down" body "IP SLA 1 tidak menerima
lagi ICMP packet"
R1(config-applet)#exit
R1
R1(config)#event manager applet IP_SLA_1_UP
R1(config-applet)#event track 1 state up
R1(config-applet)#action 1.0 syslog msg "IP SLA 1 is up"
Lakukan debug pada R1
R1
R1#debug event manager action cli
R1#debug event manager action mail


Coba shutdown interface loopback pada R2

 
R2
R2(config)#int lo0
R2(config-if)#shutdown
R2(config-if)#exit
R1
R1(config)#
Translating "smtp.gmail.com"
*Feb 9 02:06:04.407: %TRACKING-5-STATE: 1 ip sla 1 reachability Up->Down
*Feb 9 02:06:04.423: %HA_EM-6-LOG: TRACK_IP_DOWN: IP SLA 1 is down
R1(config)#
*Feb 9 02:06:04.427: %HA_EM-6-LOG: TRACK_IP_DOWN : DEBUG(smtp_lib) :
smtp_connect_attempt: 1
*Feb 9 02:06:04.427: %HA_EM-6-LOG: TRACK_IP_DOWN : DEBUG(smtp_lib) :
fh_smtp_connect failed at attempt 1
R1(config)#
Translating "smtp.gmail.com"
*Feb 9 02:06:07.431: %HA_EM-6-LOG: TRACK_IP_DOWN : DEBUG(smtp_lib) :
smtp_connect_attempt: 2
*Feb 9 02:06:07.431: %HA_EM-6-LOG: TRACK_IP_DOWN : DEBUG(smtp_lib) :
fh_smtp_connect failed at attempt 2


Kalo kita lihat hasil debug diatas mendeteksi bahwa IP SLA down dan langsung
mencoba mengirim email, sayangnya router kita tidak konek ke internet jadi
yang muncul adalah translating “smtp.gmail.com”, tapi bisa disimpulkan
konfigurasinya sudah berhasil.

 
Hidupkan kembali interface loopback0 pada R2:

 
R2
R2(config)#int lo0
R2(config-if)#no shutdown
R2(config-if)#exit
R1
R1(config)#
*Feb 9 02:07:44.407: %TRACKING-5-STATE: 1 ip sla 1 reachability Down->Up
R1(config)#
*Feb 9 02:07:44.411: %HA_EM-6-LOG: IP_SLA_1_UP: IP SLA 1 is up


Verifikasi ip sla


R1
R1#show ip sla statistics
IPSLAs Latest Operation Statistics
IPSLA operation id: 1
Type of operation: icmp-echo
Latest RTT: 16 milliseconds
Latest operation start time: *02:08:34.115 UTC Sun Feb 9
2020 Latest operation return code: OK
Number of
successes: 10
Number of
failures: 10
Operation time to live: Forever

Komentar

Postingan populer dari blog ini

BGP BASIC CONFIGURATION - BGP #2 ( CCNP )

BGP ATTRIBUTE ( COMMUNITY-LIST ) - BGP #9 ( CCNP )

OTP - EIGRP #17 ( CCNP )