EEM Send Email every 5 min

To monitor turn on debug to show message on syslog

event manager session cli alexis !only needed if AAA is used and authentication needed by app
event manager environment _email_server X.X.X.X
event manager environment _email_to alex_katsavras@XXX.XXX
event manager environment count15min503 0
event manager environment count1hour503 0

event manager applet Capture_503
event syslog pattern "012345676789"
action 1000 syslog msg "503_Error_has been_Encountered"
action 1010 set tmp15 "$count15min503"
action 1020 set tmp1 "$count1hour503"
action 1030 increment tmp15
action 1040 increment tmp1
action 1050 cli command "enable"
action 1060 cli command "config t"
action 1070 cli command "event manager environment count15min503 $tmp15"
action 1080 cli command "event manager environment count1hour503 $tmp1"
action 1090 cli command "exit"
action 1100 syslog msg "Number of 503_Error 15 min is:$count15min503"
action 1110 syslog msg "Number of 503_Error 1 hour is:$count1hour503"

event manager applet Notify15min
!check every 5 min
event timer cron cron-entry "0,5,10,15,20,25,30,35,40,45 * * * *"
action 1010 cli command "enable"
action 1020 cli command "show event manager environment count15min503"
action 1030 set tmp15 "$_cli_result"
action 1040 cli command "show event manager environment count1hour503"
action 1050 set tmp1 "$_cli_result"
action 1060 cli command "show clock!
action 1070 set time "$_cli_result"
action 1080 mail server "$_email_server" to "$_email_to" from "$_email_to" subject "Conference Call number 15 min report from XXX-XXXVG02" body "Report\n========\nTime:$time\n15 min count:$tmp15\n1 hour count:$tmp1\n"
action 1090 cli command "config t"
action 1100 cli command "event manager environment count15min503 0"

About Alexis Katsavras

Working as Freelance Cisco Unified Communications Consultant in the UK. www.NetPacket.co.uk