Skip navigation.
spilling the beans

monitoring chores by email part 2

| | |

Following up on monitoring chores by email, we will take a slightly different approach this time.
We use a "metaprocess" to execute all the processes listed in the original chore, check their return status and eventually act on it.
This allows for maximum flexibility as you can get that controlling process to react differently to any exit status of any process.

1. create process ProcessCheck
--- Data Source tab
choose ASCII, Data Source Name points to an already existing chore file, for example called Daily Update.cho
monitor data source

--- Variables tab
Variables tab has to be that way:
monitor variables

--- Advanced/Data tab

#mind that future TM1 versions might use a different format for .cho files and that might break this script
If(Tag @= '6');

MailServer = '';
LogDir = '\\server\f$\TM1Data\myTM1\Log';

#get the process names from the deactivated chore

NumericGlobalVariable( 'ProcessReturnCode');

ErrorCode = ExecuteProcess(Process);

If(ErrorCode <> ProcessExitNormal());

If(ProcessReturnCode = ProcessExitByChoreQuit());
Status = 'Exit by ChoreQuit';
#Honour the chore flow so stop here and quit too
If(ProcessReturnCode = ProcessExitMinorError());
Status = 'Exit with Minor Error';
If(ProcessReturnCode = ProcessExitByQuit());
Status = 'Exit by Quit';
If(ProcessReturnCode = ProcessExitWithMessage());
Status = 'Exit with Message';
If(ProcessReturnCode = ProcessExitSeriousError());
Status = 'Exit with Serious Error';
If(ProcessReturnCode = ProcessExitOnInit());
Status = 'Exit on Init';
If(ProcessReturnCode = ProcessExitByBreak());
Status = 'Exit by Break';

vbody=Process|' failed: '|Status|'. Check details in '|LogDir;
Email = CellGetS('}ClientProperties','Admin','Email');
If(Email @<> '');
S_Run='cmd /c F:\TM1Data\CDOMail.vbs '| MailServer |' 25 '|Email|' '|Email|' "TM1 chore alert" "'|vBody|'"';


The code only differs from the first method when the process returns a ChoreQuit exit. Because we will be running the chore Daily Update from another chore, the ChoreQuit will not apply to the later, so we need to specify it explicitly to respect the flow and stop at the same point.

2. create chore ProcessCheck
just add the process above and set it to the same frequency and time as the Daily Update chore that you want to monitor

3. deactivate Daily Update
since the ProcessCheck chore will run the Daily Update chore there is no need to execute Daily Update another time

Average rating
(0 votes)