cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1656
Views
0
Helpful
8
Replies

EEM Script to Alert on TFTP Backup Failure

Claire1642
Level 1
Level 1

Good morning, 

I have been playing with an EEM script for a month now and I am still unable to get it to work correctly. I was hoping someone might be able to give me a clue as to how I can make this work. 

I have a lot of switches to manage, so I get them all to backup to tftp on a time schedule. This works fine, I can do this as an archive or kron policy. 

However, I need to be alerted if the tftp backup fails, or i will spend half of my day checking if the switches actually backed up or failed. 

I put in this configuration on the switch:

event manager environment _email_to [email omitted]

event manager environment _email_server [ip add omitted]

event manager environment _email_from [email omitted]

event manager environment _Failure_Message SYS-98-BACKUP-FAIL

event manager applet tftptest

event syslog pattern "%Error opening tftp:"

action 1.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "$_event_pub_time:BACKUP_FAIL" body "_Failure_Message"

action 2.0 syslog priority notifications msg "SYS-98-BACKUP-FAIL"

I already have an eem script to email me an alert for a config change so i know that the email and ip addresses are correct.

Can anyone help? 

Thanks 

Claire

8 Replies 8

Joe Clarke
Cisco Employee
Cisco Employee

Is this "%Error opening tftp:" message an actual syslog message?  Does it show in "show log"?  You might consider changing your kron job to an EEM policy that can detect the error in line and send a notification if the job fails.

In the EEM scripting guide Cisco published on their site, it describes any log with a % at the beginning as a syslog. However I dont see this message on a syslog server. I might give that a try then, but do you know if the alert trigger if the failure is not a syslog?

Thanks for your help Joe

This does not look like it would be a syslog message.  And unless it is, no, the EEM applet won't trigger.  Not all messages that start with '%' are syslogs.

Leonardo Gama
Level 1
Level 1

Hi Claire,

Can you elaborate on the issue?

Have you managed to enable "debug event manager" and run the applet manually before trying to connect to some dummy tftp server? 

Do you see the message "%Error opening tftp:" in the log/syslog or only in the terminal?

Cheers.

Hi Leonardo, 

I dont see the message in a syslog server, I only see it in the terminal. 

Claire 

Claire1642
Level 1
Level 1

Hi All, 

Thanks for your messages, I really appreciate it. 

Does anyone have any suggestions how I can amend my script to alert of a TFTP backup failure? Or is it just not possible? 

Thanks 

Claire 

Post what you're currently doing with kron.

Hi Claire,

I think you can use TCL script instead, by reading standard input.

Cheers.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: