Skip to main content

IP SLA With EEM Script

 

IP SLA With EEM Script





topologi seperti di gambar


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


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

\


SELESAI


Comments