이 문서에서는 EEM(Embedded Event Manager) 도구를 사용하여 고정 지점이 어렵거나 정상적인 문제 해결을 허용하는 정기적인 빈도가 없는 네트워크 문제를 해결하는 방법에 대해 설명합니다.
EEM은 Cisco IOS®, XR 및 NX-OS를 사용자 지정하도록 설계된 유연한 시스템입니다. EEM을 사용하면 작업을 자동화하고 사소한 개선 사항을 수행하고 해결 방법을 만들 수 있습니다.
EEM 스크립트에는 두 가지 목적이 있습니다.
어떤 경우든 EEM 스크립트를 사용하려면 스크립트를 트리거하는 데 사용할 수 있는 트리거 이벤트를 식별해야 합니다.
이 섹션에는 문제를 해결하는 데 도움이 되는 샘플 EEM 스크립트가 포함되어 있습니다.
플래시에 있는 파일에 대해 30초마다 명령을 실행합니다. show 명령은 실행할 모든 명령에 맞게 조정할 수 있습니다.
event manager applet show-rtp-streams
event timer watchdog name timer time 30
action 0.5 cli command "enable"
action 1.0 cli command "show clock | append flash:filename.txt"
action 2.0 cli command "show ip cache flow | append flash:filename.txt"
action 3.0 cli command "show voip rtp conn" | append flash:filename.txt"
action 4.0 cli command "show call active voice br" | append flash:filename.txt"
마찬가지로 X초마다 라우터 로그를 FTP 서버 또는 플래시에 덤프하려면 watchdog를 사용할 수 있습니다.
event manager applet dump-log
event timer watchdog name timer time 1800
action 0.5 cli command "enable"
action 1.0 cli command "show log | append ftp://user:pass@10.1.1.1/debugs.txt"
또한 cronjob 내부의 UNIX 디바이스에서 Expect 스크립트를 사용하여 X분마다 로그를 가져올 수 있습니다. EEM으로 밀어붙이는 대신 사용자 이름 및 비밀번호를 로그인 자격 증명에 적합한 문자열로 바꿉니다.
> dhcp-64-102-154-159:Desktop sholl$ cat login-script
> #!/usr/bin/expect
>
> set timeout 60
> spawn telnet -N 10.1.1.1
>
> # Uncomment these if you are prompted for a username by the router
> # expect "login:"
> # send "username\n"
> expect "Password: "
> send "password\n"
> expect ">"
> send "en\n"
> expect "Password:"
> send "password\n"
> expect "#"
> send "term len 0\n"
> expect "#"
> send "sh log\n"
> expect "#"
> send "exit\n"
> send "exit\n"
>
> dhcp-64-102-154-159:Desktop sholl$ crontab -e
>
> # min hour mday month wday command
> 0 4 0 0 0 Desktop/login-script >> outputlog.txt
라우터 부팅 시 디버그를 활성화합니다. 디버그를 활성화하려는 것으로 변경합니다.
event manager applet en-debugs-at-boot
event timer cron cron-entry "@reboot"
action 1.0 cli command "enable"
action 2.0 cli command "debug isdn q931"
action 2.2 cli command "debug isdn q921"
action 2.4 cli command "debug isdn standard"
로그가 가득 차는 것을 방지하기 위해 특정 디버그 메시지가 탐지된 후 디버그를 비활성화합니다. 이후에 EEM 스크립트 자체를 비활성화합니다. 상황에 맞는 패턴으로 변경합니다.
event manager applet disableDebugsOnError
event syslog occurs 1 pattern "Endpt not available"
action 3.0 cli command "enable"
action 3.2 cli command "un all"
action 3.3 cli command "config t"
action 3.4 cli command "no event manager applet disableDebugsOnError"
action 3.5 cli command "end"
대부분의 VPN 문제는 일반적으로 문제 해결을 위해 EEM을 필요로 하지 않지만, 경우에 따라 일시적인 문제로 인해 필요한 정보를 얻기 어려울 수 있습니다. 관련 사례는 다음과 같습니다.
일반적으로 CPU 사용률이 매우 짧은 시간 동안 급증하는 경우 및 결정되지 않은 시간에 급증하는 것으로 나타납니다. 따라서 CPU 사용률이 높을 때 실행해야 하는 명령을 실행하는 것이 매우 어려워집니다. 이 경우 EEM 스크립트가 매우 유용할 수 있습니다. 트리거할 CPU 값을 설정하고 명령 출력을 가져옵니다.
이 스크립트는 예제 스크립트이며 요구 사항에 맞게 사용자 정의해야 합니다.
event manager applet capture_cpu_spike
event snmp oid 1.3.6.1.4.1.9.2.1.56 get-type next entry-op ge entry-val 60
exit-time 10 poll-interval 1
action 001 syslog msg "CPU Utilization is high"
action 002 cli command "en"
action 003 cli command "show proc cpu sort | append flash:cpuinfo"
action 004 cli command "show proc cpu sort | append flash:cpuinfo"
action 005 cli command "show stack 236 | append flash:cpuinfo"
action 006 cli command "show call active voice brief | append flash:cpuinfo"
action 007 cli command "show voip rtp connection | append flash:cpuinfo"
action 008 cli command "show isdn call-rate | append flash:cpuinfo"
action 009 cli command "show log | append flash:cpuinfo"
action 010 cli command "show mem stat his | append flash:cpuinfo"
action 011 cli command "show proc cpu his | append flash:cpuinfo"
action 012 cli command "show align | append flash:cpuinfo"
위 스크립트는 CPU 사용률을 탐지하고 명령을 실행할 뿐만 아니라 플래시에 출력을 추가합니다. 선택할 수 있습니다. CPU 사용률이 60%를 초과할 때 트리거됩니다. 이는 요구 사항에 따라 맞춤화되어야 합니다. 그러나 스크립트를 구축하기 전에 파일 시스템의 여유 공간을 고려하는 것은 주의해야 합니다.
| 개정 | 게시 날짜 | 의견 |
|---|---|---|
1.0 |
10-Oct-2013
|
최초 릴리스 |