mlevin77 Posted January 20, 2009 Report Share Posted January 20, 2009 Is there any way to receive email notification when a tape script is out of tapes? Mike Quote Link to comment Share on other sites More sharing options...
rhwalker Posted January 20, 2009 Report Share Posted January 20, 2009 Yes. We've been doing it for about 15 years. Retrospecct Event Handler - Python Russ Quote Link to comment Share on other sites More sharing options...
mlevin77 Posted January 20, 2009 Author Report Share Posted January 20, 2009 Super! Can I get any info on where to download this and how to install it? I checked the URL you cited and it mentions a Python event handler but there's neither a download link nor any info about it. What do people use for this? Thanks, Mike Quote Link to comment Share on other sites More sharing options...
Mayoff Posted January 20, 2009 Report Share Posted January 20, 2009 The link is in the right column of the address above. Quote Link to comment Share on other sites More sharing options...
rhwalker Posted January 20, 2009 Report Share Posted January 20, 2009 Super! Can I get any info on where to download this and how to install it? I checked the URL you cited and it mentions a Python event handler but there's neither a download link nor any info about it. What do people use for this? See the download link on the right of that page. The python tools come standard with Mac OS X. The installation instructions pretty much say it all. Don't touch the macmail.py script. Edit the AppleScript appropriately as instructed. See the ReadMe and the comments in the script. Follow these directions EXACTLY: (1) copy both the Retrospect Event Handler and macmail.py to /Library/Preferences/Retrospect and edit the Retrospect Event Handler to contain the correct values for your mail server, SMTP authentication (if you use it), and to and from addresses. (I've never known anyone who got the SMTP AUTH stuff to work - I've looked at the python code, and it seems correct, must be a python issue). (2) edit the AppleScript using the AppleScript editor. (3) save the script as an application, Check both Stay Open and Never Show Startup Screen when you save the script. Save the script as an application in: /Library/Preferences/Retrospect The script MUST be named EXACTLY Retrospect Event Handler (without an extension - you will need to remove the extension after saving). This is a bit of history from the Mac OS Classic version of Retrospect years ago, and is the exact name that Retrospect looks for. Post if problems. Russ Quote Link to comment Share on other sites More sharing options...
mlevin77 Posted January 21, 2009 Author Report Share Posted January 21, 2009 Thanks! > (I've never known anyone who got the SMTP AUTH > stuff to work - I've looked at the python code, > and it seems correct, must be a python issue). ouch! I have the SMTP set to AUTH on my smtp server for security reasons. Do people really turn off auth to be able to use this? Mike Quote Link to comment Share on other sites More sharing options...
mlevin77 Posted January 22, 2009 Author Report Share Posted January 22, 2009 Hi Russ, > Post if problems. I tried this, and now, every few minutes I get a window popping up with the title "Retrospect Event Handler", that says "Press Run to run this script or Quit to quit". If I run it, it says "Could not run this script because the required resources were not found. -192". Why is it running all the time (I only set it to email on errors), why is it asking for user input, and why can't it run even when I hit "run"? thanks, Mike Quote Link to comment Share on other sites More sharing options...
CallMeDave Posted January 22, 2009 Report Share Posted January 22, 2009 Why is it running all the time...? The EventHandler is a simple AppleScript, set to be "faceless." It needs to be running when Retrospect is running so it can do what you've configured it to do. It sounds as if your script has some unintended script settings that you added. Dave Quote Link to comment Share on other sites More sharing options...
rhwalker Posted January 22, 2009 Report Share Posted January 22, 2009 I tried this, and now, every few minutes I get a window popping up with the title "Retrospect Event Handler", that says "Press Run to run this script or Quit to quit". If I run it, it says "Could not run this script because the required resources were not found. -192". I wasn't kidding about the hoops you had to jump through to get it set up right. As CallMeDave notes, it's just an AppleScript that is launched whenever Retrospect is launched, and there is a lot of history floating around from MacOS 7.x (been there, done that). For this reason, I have inserted the following AppleScript comment at the beginning of Event Handler AppleScript, because I can never remember the dance and because I change the Event Handler so rarely now: -- When saving edited script, save as application, stay open, never show startup screen-- then delete the ".app" extension on the saved file because Retrospect -- expects the script to be named "Retrospect Event Handler". Sigh. -- Then copy the renamed compiled script to /Library/Preferences/Retrospect Why is it running all the time (I only set it to email on errors), Because of its legacy, the AppleScript is launched whenever Retrospect is launched, and waits for Retrospect to send it "Apple Events" to cause action by the Event Handler. why is it asking for user input, and why can't it run even when I hit "run"? Two possibilities. (1) you don't have it set up right - see above. (2) Some people have reported issues getting the AppleScript compiler to work right on an Intel machine with programs running emulated under Rosetta (as does the current version of Retrospect). I suspect it's got something to do with byte order, etc. See, for example, this thread a while back for a workaround: Retrospect Event Handler on Intel Never had to do this, our Xserve running Retrospect is an Xserve G5. Russ Quote Link to comment Share on other sites More sharing options...
mlevin77 Posted January 22, 2009 Author Report Share Posted January 22, 2009 Yep, I tried to follow the instructions exactly. One problem was: > -- When saving edited script, save as application, stay open, never show startup screen I'm saving it as an application, and I have "stay Open" clicked on, "Startup screen" clicked off (un-checked), but there's no "never" on here. How about "Run Only" - should that be checked? Mike Quote Link to comment Share on other sites More sharing options...
rhwalker Posted January 23, 2009 Report Share Posted January 23, 2009 How about "Run Only" - should that be checked? Probably not. What that does is to make an uneditable app that the recipient can't open in AppleScript Editor and see. It won't affect the issues that you are seeing, but will make it difficult to make any subsequent changes - you will have to re-edit from a saved copy. Sounds like you may be hitting the Rosetta / Intel issue, and need to visit the linked past forum thread that I linked above. Good luck. Russ Quote Link to comment Share on other sites More sharing options...
mlevin77 Posted January 23, 2009 Author Report Share Posted January 23, 2009 > Sounds like you may be hitting the Rosetta / Intel issue, and need to visit the linked past forum thread that I linked above. Good luck. nope :-( My Xserve is a G5... If yours is as well, can you email me (at mlevin@drmichaellevin.org) the file that works for you? thanks in advance, Mike Quote Link to comment Share on other sites More sharing options...
rhwalker Posted January 27, 2009 Report Share Posted January 27, 2009 My Xserve is a G5... If yours is as well, can you email me (at mlevin@drmichaellevin.org) the file that works for you? Mike, Your email server has other issues, too. Our server has been patiently trying since last Friday to send you an email at the address you indicated, and it has now given up. Jan 23 09:46:30 mail postfix/smtp[18204]: connect to drmichaellevin.org[130.64.16.51]: Operation timed out (port 25) Jan 23 09:46:30 mail postfix/smtp[18204]: 9B0927A4168: to=, relay=none, delay=45, status=deferred (connect to drmichaellevin.org[130.64.16.51]: Operation timed out) Russ Quote Link to comment Share on other sites More sharing options...
mlevin77 Posted January 27, 2009 Author Report Share Posted January 27, 2009 oh man. That's got something to do with the firewall they're setting up here... Please send to mlevin77@comcast.net thank you! Mike Quote Link to comment Share on other sites More sharing options...
philcebutv Posted June 8, 2009 Report Share Posted June 8, 2009 (edited) Hi, I am in this situation also where I need retrospect to email someone or me if the removable drive runs out of tape/removable disks. Is this possible? tried the property kMediaRequestGroup : {"email@address"} but does not work. I know that my Retrospect Event Handler is working since it will email me when an error is generated when a script is run. Only problem of mine is I have a removable drive and I want to email me incase if it runs out of tape or needs a new tape please advice.. Edited June 8, 2009 by Guest Quote Link to comment Share on other sites More sharing options...
rhwalker Posted June 8, 2009 Report Share Posted June 8, 2009 Yes, it should work, but you need to set the media timeout value: Special > Preferences > Media Request Check the box for media request timeout, set the value for timeout notification. Works for us, and has worked for about 15 years (since the ASIP days and Retrospect 2.0) Russ Quote Link to comment Share on other sites More sharing options...
philcebutv Posted June 9, 2009 Report Share Posted June 9, 2009 (edited) Russ, thanks for emailing the script in text format. I am still trying to save the applescript on script editor but generates an error always and I still have to look into that. Ok just need to ask another question. I tried setting the media request timeout on the preferences of retrospect and it has minutes to set what's the minutes for? Is it the minutes that retrospect waits until a new media is inserted? and What happens if that timeout expire? I tried using the event handler inlcuded in retrospect but I can't get the retrospect to email me when it ask for a media. this is the snippet of the Retro Event Handler I am using property kMainGroup : {"email@adrress.com"} --will get mail for all events . property kSuccessGroup : {} --will get mail only if no errors occurred property kErrorGroup : {"email@adrress.com"} --will get mail only when Retrospect reports an error property kMediaRequestGroup : {"email@adrress.com"} --will get mail when Retrospect needs new media property kMailServer : "our.mail.server" -- the smtp server to use for sending mail property kFrom : "SysAd@domain.com" -- the from address for the mails that Retrospect sends --SMTP Authentication --if your mail server uses SMTP authentication, enter the username and password here property kUsername : "philcebutv" property kPassword : "password" -- the full path to the script that sends mail property kScriptCommand : "/usr/bin/python /Library/Preferences/Retrospect/macmail.py" -- This constant defines the interval (in hours) between Backup Server report emails. property kSendBackupServerReport : 12 -- Set this property to false if you don't want the main group to receive mail on script or Backup Server starts. property sendMailOnStart : true -- Nothing below this line needs to be edited. -- -- End of properties for the sendMail Function. -- -- Properties needed for the mediaRequestTimedOut function. property theRequestedMediaType : "" -- name of the media type property theRequestedMember : "" -- this will let the user know what the name of the next tape will be I can received a notification on every script that has run on our server as well script that has errors What do i need to put on these properties? property theRequestedMediaType : "" property theRequestedMember : "" do I need to put the name of the requested tape? what happen if it ask for a new tape? what would be the name of it? by the way I am on Intel Machine running in OS X 10.5.7 Edited June 9, 2009 by Guest Quote Link to comment Share on other sites More sharing options...
rhwalker Posted June 9, 2009 Report Share Posted June 9, 2009 I tried setting the media request timeout on the preferences of retrospect and it has minutes to set what's the minutes for? Is it the minutes that retrospect waits until a new media is inserted? and What happens if that timeout expire? yes. Retrospect gives up. You get an email when the request goes up. If you don't respond by the second timeout, Retrospect gives up and quits. As I suggested in my email, look at the logic of the routines "mediaRequest" and "mediaRequestTimedOut", which explains it all. See the two "sendMail" calls in "mediaRequestTimedOut". I tried using the event handler inlcuded in retrospect but I can't get the retrospect to email me when it ask for a media. Yes, if you will read my initial email to you, I noted that I have never heard of anyone getting SMTP AUTH to work, and it appears that you are using SMTP AUTH (because you have added values for "kUsername" and "kPassword"). As I indicated in my initial email to you, I studied the calls to the python code (see the calls for kScriptCommand in the sendMail function), and I studied the python calls to its library in macmail.py, and all of the calls appear correct for SMTP AUTH. However, I don't know of anyone who has gotten SMTP AUTH to work, and it may be a bug in the python library. Our local mail server is on our LAN and does not use SMTP AUTH. this is the snippet of the Retro Event Handler I am using property kMainGroup : {"email@adrress.com"} --will get mail for all events . property kSuccessGroup : {} --will get mail only if no errors occurred property kErrorGroup : {"email@adrress.com"} --will get mail only when Retrospect reports an error property kMediaRequestGroup : {"email@adrress.com"} --will get mail when Retrospect needs new media property kMailServer : "our.mail.server" -- the smtp server to use for sending mail property kFrom : "SysAd@domain.com" -- the from address for the mails that Retrospect sends --SMTP Authentication --if your mail server uses SMTP authentication, enter the username and password here property kUsername : "philcebutv" property kPassword : "password" -- the full path to the script that sends mail property kScriptCommand : "/usr/bin/python /Library/Preferences/Retrospect/macmail.py" -- This constant defines the interval (in hours) between Backup Server report emails. property kSendBackupServerReport : 12 -- Set this property to false if you don't want the main group to receive mail on script or Backup Server starts. property sendMailOnStart : true -- Nothing below this line needs to be edited. -- -- End of properties for the sendMail Function. -- -- Properties needed for the mediaRequestTimedOut function. property theRequestedMediaType : "" -- name of the media type property theRequestedMember : "" -- this will let the user know what the name of the next tape will be I can received a notification on every script that has run on our server as well script that has errors What do i need to put on these properties? property theRequestedMediaType : "" property theRequestedMember : "" do I need to put the name of the requested tape? what happen if it ask for a new tape? what would be the name of it? These are variables (properties) used by the script. Read carefully the line in the script above, just above these two variables: [color:red]-- Nothing below this line needs to be edited.[/color] That comment means exactly what it says. As you can see when you read the code, these properties are passed by Retrospect to the Retrospect Event Handler when the MediaRequest event happens. Read the prototype definition for the MediaRequest function: on mediaRequest given mediaTypeString:theMediaType, requestedMemberName:theMember, mediaIsKnownBoolean:mediaKnown Russ Quote Link to comment Share on other sites More sharing options...
philcebutv Posted June 14, 2009 Report Share Posted June 14, 2009 Russ, I got the chance today to take a simple test on the Event Handler Script and it's all working fine now I can receive email notifications whenever the script ask for a specific media on the removable drive and or if it will ask for new media. I also have been able to received email notification if the script finished with errors plus I am using authentication to our mail server. Thanks for all the help. I am using the same code above. I setup the retrospect to wait on media request that will be set on Retrosepect Menu->preferences->Media Request also I only edited these properties property kErrorGroup : {"email@adrress.com"} property kMediaRequestGroup : {"email@adrress.com"} property kMailServer : "our.mail.server" property kFrom : "SysAd@domain.com" property kUsername : "philcebutv" property kPassword : "password" property theRequestedMediaType : "MyMediaTypeName" property theRequestedMember : "AnotherMyMediaTypeName" and I make sure that when retrospect run the event handler will also run and will not quit. I did also the steps that you keep telling users on this forum on how to convert the event handler script to an application using the script editor. Thanks a Lot for the hints! Quote Link to comment Share on other sites More sharing options...
rhwalker Posted June 14, 2009 Report Share Posted June 14, 2009 I also have been able to received email notification if the script finished with errors plus I am using authentication to our mail server. Glad to have been able to help. It was your persistence that brought the problem to resolution. You are the first person who has reported being able to get SMTP AUTH to work. Like I said, I looked at the call to the python handler, and the call in the python handler to the python library, and it all looked right. I've just never tested on SMTP AUTH. also I only edited these properties ... property theRequestedMediaType : "MyMediaTypeName" property theRequestedMember : "AnotherMyMediaTypeName" Simply FYI, these two edits had no effect, and may confuse the person who comes behind you and reads your code. As I indicated upthread, and as the code notes in its comment that says "[color:red]-- Nothing below this line needs to be edited.[/color]" they are both properties (parameters) that are passed by Retrospect when it invokes the event handler for the MediaRequest function. For clarity, they should be left unedited as: property theRequestedMediaType : "" property theRequestedMember : "" Russ Quote Link to comment Share on other sites More sharing options...
philcebutv Posted June 15, 2009 Report Share Posted June 15, 2009 (edited) Simply FYI, these two edits had no effect, and may confuse the person who comes behind you and reads your code. As I indicated upthread, and as the code notes in its comment that says "[color:red]-- Nothing below this line needs to be edited.[/color]" they are both properties (parameters) that are passed by Retrospect when it invokes the event handler for the MediaRequest function. For clarity, they should be left unedited as: property theRequestedMediaType : "" property theRequestedMember : "" Russ Just to confirm. Russ is right. I tried editing the properties above without values and I still able to received notifications for Media Request. Edited June 15, 2009 by Guest Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.