Page 1 of 1
Sending email on failure of TI process
Posted: Fri Nov 13, 2009 10:13 am
by aagrawal12
Hi,
Can anybody plz tell me how to configure the TI for getting a mail of failure of TI process
Thanks in advance,
Abhishek
Re: Sending email on failure of TI process
Posted: Fri Nov 13, 2009 12:22 pm
by jim wood
The work around we use is that we use SQL to control all of our schedules. If that fails it sends out an email,
Jim.
(Bit of a cheat I know but we handle a large amount of data each week and completing any tranformations in SQL has decreased the schedule run time by around an hour.)
Re: Sending email on failure of TI process
Posted: Fri Nov 13, 2009 12:30 pm
by aagrawal12
hi jim,
can u guide how can we use sql to montior the TI process
Any help would be useful.
Thanks,
Abhishek
Re: Sending email on failure of TI process
Posted: Fri Nov 13, 2009 9:16 pm
by Railroader
We user Microsoft Operations Manager with a service that monitors the logs folder
Re: Sending email on failure of TI process
Posted: Sun Nov 15, 2009 10:37 pm
by lotsaram
The best solution is probably external to TM1 with batch scheduling and control software such as Tivoli, Control M or Operations Manager but for companies without such a solution it can be done all within TM1 using a combination of TI, batch files or vb script and an email executable.
There are 2 basic approaches which are generally used and probably many variations thereof:
1/ "Alerting for specific process errors"
- Call the process with ExecuteProcess
- Check the ProcessReturnCode
- If not ProcessExitNormal (such as ProcessExitSeriousError) then send an email
2/ "Scanning the logging directory for process error logs"
- Use a TI with WildcardFileSearch to regularly (hourly, daily, etc.) scan the logging directory for files matching "TM1ProcessError*.log"
- when a file is found send an email to the TM1 admin with the name of the TI process, maybe attach the log file to the email
- move the process error log files for which mails have been dispatched to another directory to prevent emailing again for the same log file
That should give you something to go on ...
Re: Sending email on failure of TI process
Posted: Wed Aug 29, 2012 7:05 pm
by dfrench77
Lotsaram,
I am trying to implement this solution and I am stuck at the 2nd step.
2/ "Scanning the logging directory for process error logs"
- Use a TI with WildcardFileSearch to regularly (hourly, daily, etc.) scan the logging directory for files matching "TM1ProcessError*.log"
- when a file is found send an email to the TM1 admin with the name of the TI process, maybe attach the log file to the email
- move the process error log files for which mails have been dispatched to another directory to prevent emailing again for the same log file
My code in TI is as follows in the Epilog:
Code: Select all
file = WildcardFileSearch( 'C:\TM1Files\Logs\TM1ProcessError_2012*load*.log', ' ');
ExecuteCommand('C:\SendEmail\sendEmail.exe -f fromemail@xxxx.com -t toemail@xxx.com -s emailserver -u file -m Testing Email Message', 0);
AsciiOutput('email_test.txt', file);
My 1st question:
This code works fine. I receive email but the Subject line does is not the TM1ProcessError_2012*load*.log file name. It is just file. However my Asciiuotput file provides the file name. How can I get the file name in the subject line of the email?
My 2nd question:
How would you attach a file to the email message? Has anyone done this?
Thanks,
dfrench77
Re: Sending email on failure of TI process
Posted: Wed Aug 29, 2012 7:17 pm
by Duncan P
You need to get the name of the file into the command line. The TI function to do this is
EXPAND (
http://publib.boulder.ibm.com/infocente ... xpand.html).
Try
Code: Select all
file = WildcardFileSearch( 'C:\TM1Files\Logs\TM1ProcessError_2012*load*.log', ' ');
command = EXPAND( 'C:\SendEmail\sendEmail.exe -f fromemail@xxxx.com -t toemail@xxx.com -s emailserver -u "%file%" -m "Testing Email Message"'
ExecuteCommand(command, 0);
AsciiOutput('email_test.txt', file);
Re: Sending email on failure of TI process
Posted: Wed Aug 29, 2012 7:49 pm
by dfrench77
Duncan,
Thanks the code work perfectly. I have used the expand function before in an export to ODBC tables.
Can you help with my 2nd question?
How would you attach a file to the email message? Has anyone done this?
Regards,
dfrench77
Re: Sending email on failure of TI process
Posted: Wed Aug 29, 2012 8:10 pm
by lotsaram
The issue as Duncan pointed out is that you are passing in the literal string "file" and not the value of the string variable. This can also be done without using Expand just with concatenating.
Code: Select all
file = WildcardFileSearch( 'C:\TM1Files\Logs\TM1ProcessError_2012*load*.log', ' ');
command = 'C:\SendEmail\sendEmail.exe -f fromemail@xxxx.com -t toemail@xxx.com -s emailserver -u ' | file | '-m Testing Email Message';
ExecuteCommand(command, 0);
AsciiOutput('email_test.txt', file);
Is that the actual code you are using? Because unless your email address is
toemail@xxx.com I don't see how you would be receiving anything.
To create an attachment will depend on the command line reference of the particular email utility you are using for sendemail.exe I think it is -a and you would need to pass in the full path and filename. (it doesn't look like you are trying too hard here as all that's needed is a quick look at the documentation of the email utility, you might want to brush up on the request for assistance guidelines. I know you are an accountant as opposed to a consultant but still we're not here to just do it for you.)
Presumably you are going to put your emailing code within a while loop so that you pass the last file found into WildcardFileSearch to return all matching files in sequence. When you do this don't forget you need to move the error log file somewhere else as well with a separate ExecuteCommand to a batch file otherwise you will find that our process is just continually sending an email notifying of the same file or files.
Re: Sending email on failure of TI process
Posted: Thu Aug 30, 2012 11:35 am
by dfrench77
Lotsaram,
Thanks for the pointer on the concatenation. No,
toemail@xxx.com is not my email account. It will be replaced with appropriate email.
Regarding the -a for file, you are correct, as usual, it is documented in the utility. Reading is essential, I heard

. To my defense, I scanned the documentation looking for attachment, instead reading and looking for file attachment.
Yes, my plan based on the research I have done in the forum, bihints, tm1-tutorals, etc.., is to use the move command to move the old log files to a another directory.
Thanks for you the assistance.
Regards,
dfrench77
Re: Sending email on failure of TI process
Posted: Fri Aug 31, 2012 3:59 pm
by dfrench77
I am back. I have come to another stumbling block.
I am using the ExecuteCommand in a TI statement to execute the move command to move a log file to another folder. Below is the code:
Code: Select all
MoveCmd= 'move'|' ' | EXPAND('C:\TM1Files\TM1_Logs\file%') | ' '| EXPAND('C:\TM1Files\TM1_Logs\Old_TM1ProcessErrorLogs\%file%');
AsciiOutput('email_test.txt',MoveCmd);
ExecuteCommand(MoveCmd, 0);
I receive the following error when executing this command in TI.
Error: Epilog procedure line (33): The system cannot find the file specified.
Below is the output of the AsciiOutput file:
move C:\TM1Files\TM1_Logs\TM1ProcessError_20120730174524_load_budget_to_forecast.log C:\TM1Files\TM1_Logs\Old_TM1ProcessErrorLogs\TM1ProcessError_20120730174524_load_budget_to_forecast.log
When I execute this command in the command prompt window it executes successfully and moves the specified file.
Can anyone tell me why the command is failing in TI but executing successfully in command prompt window?
Thank you,
dfrench77
Re: Sending email on failure of TI process
Posted: Fri Aug 31, 2012 5:37 pm
by Duncan P
ExecuteCommand can only execute programs.
move is not a program but an intrinsic command of the command shell. The easiest way to get round this is to create a batch file called
move.bat containing the line
and then call it using e.g.
Code: Select all
ExecuteCommand( 'c:\tm1files\move.bat c:\tm1files\tm1_logs\' | file | ' c:\tm1files\tm1_logs\old_tm1processerrorlogs\' | file );
Unfortunately you will get a window popping up. We have not found a way of preventing this. If anyone knows how, please share.
Re: Sending email on failure of TI process
Posted: Fri Aug 31, 2012 7:05 pm
by dfrench77
Duncan,
Thank for your assistance. The code is working! I used the switch /y after the move command (i.e., move /Y %1 %2) and I am not getting a pop up window prompting. This may be the solution for the window popping up, someone please confirm.
Thanks again,
dfrench77
Re: Sending email on failure of TI process
Posted: Tue Sep 04, 2012 1:00 pm
by Harvey
I'm currently working on a Flow solution to this problem.
Our solution involves generating an instruction file from TI using ASCIIOUTPUT and moving it into a queue folder. The file contains all the information required to generate the notification email by event type.
The Flow Responder Windows Service monitors this folder and detects when a new file is found there. It then consumes the file and generates a notification email.
Responder implements a plugin architecture, so you could do a lot more with it than just generate an email. I think it's a pretty powerful platform and opens up some very cool options for TI that are difficult to achieve any other way.
Anyway, I'll be releasing this soon, but if anyone on this thread would be interested to try out what I have, let me know and I'll send you the installer and some instructions.