on 10-09-2008 7:25 PM
Hi,
Can someone point me in the right direction as to how to best:
1. Notify a person via email that a specific job chain has errored? I have been able to do this via a Step destination but I not only get "KILLED" states I get "COMPLETED" as well. I am only looking for a specific state.
2. The email needs to include in the subject the name of the job chain not just the job id. The id is not descriptive enough for us.
Seems like this would be simple to do but I cannot seem to find a thread that connects all the dots for me.
Thanks in advance.
David Carr
Netweaver Administrator
Hi David,
there are a number of methods for achieving your desired result. If you are trying to address a very specific issue and don't need to do it elsewhere (unlikely) then you could include in your chain an 'alert' step that includes a script call to an email job (which will allow you to set the necessary parameters values for your subject etc). You can then define a default post running action on the chain so that if any step fails it goes to the 'alert' step. Your last two steps would be the alert step (penultimate step) and a dummy step. In normal execution the 3rd last step would have a post condition that says on completed go to the dummy step. In this way if the chain runs correctly the alert step is skipped. On the alert step you also need to add post condition to raise an error on completion so that the chain finishes with an error once its sent the email. There are of course variations on this theme.
The second and in my view the preferred option in terms of flexibility is to use an on_job_status_change trigger to raise an alert if it sees a job erroring and it's a job your interested in. This option is best when you want to alert on more than one job and you have specific information you want to convey in the alert and is the option I use for most customers. It also provides flexibility should you want to change the alerting process under certain conditions, e.g. emails during office hours, sms at other times or snmp trap to incumbant systems monitoring tool etc.
Another option is to specify a post running action for any jobs you want to alert on. This will require the creation of a procedure that needs to be called that then does all the things you require.
Regards,
Simon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Simon,
Thanks Simon your response was right on.I opted for option 2 that you suggested leveraging the on_job_status_change trigger. It is working great, however, I am receiving 2 notifications and I really just want 1. The trigger is firing for both the "step" and the "chain" changing state to error. Is there a simple method to identify each and therefore be able to exclude the chain?
Regards,
David
Hi David,
glad to be of assistance. Simple change to make is to amend your query of rs_jobs, that determines the script name, to also test if the step_id field is null. It will only be null if the the job_id being tested is for the chain itself.
if p_new_status = 'E' then
select script_name , decode(step_id, null,'CHAIN','STEP')
into v_script, v_step_id
from rs_jobs
where job_id = p_job_id;
if v_script = 'my script' and v_step_id = 'CHAIN' then
--send email
end if;
end if;
Regards,
Simon
Hello Anton,
We are not using CPS version.
Below are my Redwood version details.
BE Version 7.0.3
REP Version 7.0.3.15
thanks
Sorabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I am very new in Redwood, i am not able to schedule mail alert job failure alert in Redwood, i the above chain you have mentioned to set the alert at on_job_status_change, i am at which plase should i put this script. i am not able to find this event in my script, below is the script.
if p_new_status = 'E' then
select script_name , decode(step_id, null,'CHAIN','STEP')
into v_script, v_step_id
from rs_jobs
where job_id = p_job_id;
if v_script = 'my script' and v_step_id = 'CHAIN' then
--send email
end if;
end if;
I am also attaching the script which i have, lease help on this.
create or replace script "ECC60"."SCECC_LSCA_BC_REORG_JOBS"
( "INSTANCE" in varchar2(15) not null
description 'SAP instance'
input format 'UPPERCASE'
default expr('CT0'
)
, "CLIENT" in varchar2(3) not null
description 'Client'
default expr('100'
)
, "SAP_USER_NAME" in varchar2(16) null
constant
description 'SAP account used during Step'
nodisplay
default expr('BASISBATCH'
)
, "JOBNAME" in varchar2(32) not null
constant
description 'Jobname'
nodisplay
input format 'UPPERCASE'
default expr('SCECC_LSCA_BC_REORG_JOBS'
)
, "JOBCLASS" in varchar2(1) not null
constant
description 'Job Class'
nodisplay
default expr('C'
)
, "ABAP_PROGRAM_NAME" in varchar2(30) not null
constant
description 'ABAP Program name'
nodisplay
input format 'UPPERCASE'
default expr('RSBTCDEL'
)
, "ABAP_VARIANT_NAME" in varchar2(14) not null
description 'ABAP Variant name'
input format 'UPPERCASE'
default expr('OVER_7_DAYS'
)
, "LANGUAGE" in varchar2(1) null
constant
description 'Sap Job Language'
nodisplay
input format 'UPPERCASE'
default expr('E'
)
, "PRINT_ARCMODE" in varchar2(1) null
description 'Print/Archive mode'
nodisplay
default expr('1'
)
constraint "ARCHIVEMODE_LIST"
references "RSI_ARCHIVE_MODES"
( "ARCHIVEMODE"
)
described by "DESCRIPTION"
, "ARCHIVE_SAPOBJECT" in varchar2(10) null
constant
description 'Archive SAP object'
nodisplay
default expr(''
)
, "ARCHIVE_OBJECT" in varchar2(10) null
constant
description 'Archive object'
nodisplay
default expr(''
)
, "ARCHIVE_INFO" in varchar2(3) null
constant
description 'Archive info'
nodisplay
default expr(''
)
, "PRINT_DESTIN" in varchar2(4) null
constant
description 'Printer'
nodisplay
input format 'UPPERCASE'
default expr(''
)
, "PRINT_IMMEDIATE" in varchar2(1) null
constant
description 'Print Immediately?'
nodisplay
default expr(''
)
, "PRINT_RELEASE" in varchar2(1) null
constant
description 'Release Print job?'
nodisplay
default expr(''
)
, "PRINT_COPIES" in number(3,0) null
constant
description '# of copies?'
nodisplay
default expr(1
)
, "PRINT_SHOWPASSWD" in varchar2(12) null
constant
description 'Authority for printing'
nodisplay
default expr(''
)
, "PRINT_SAPBANNER" in varchar2(1) null
constant
description 'Print SAP banner?'
nodisplay
default expr('D'
)
, "PRINT_BANNERPAGE" in varchar2(1) null
constant
description 'Print Bannerpage?'
nodisplay
default expr(''
)
, "PRINT_EXPIRATION" in number(1,0) null
constant
description 'Expiration in day(s)'
nodisplay
default expr(8
)
, "PRINT_RECIPIENT" in varchar2(12) null
constant
description 'Print Recipient?'
nodisplay
default expr('BASISBATCH'
)
, "PRINT_NUMLINES" in number(5,0) null
constant
description 'Print lines per page?'
nodisplay
default expr(65
)
, "PRINT_NUMCOLUMNS" in number(5,0) null
constant
description 'Print columns per page?'
nodisplay
default expr(71
)
, "TARGET_SERVER" in varchar2(32) null
constant
description 'SAP Application server name'
nodisplay
default expr(''
)
, "SHOWLOG" in varchar2(1) not null
constant
description 'Show logfile'
nodisplay
default expr('Y'
)
, "SHOWSPOOL" in varchar2(1) not null
constant
description 'Show spoolfile'
nodisplay
default expr('Y'
)
, "DELETE_JOB" in varchar2(1) not null
constant
description 'Delete SAP job when it is finished?'
nodisplay
default expr('N'
)
, "EXTUSER" in varchar2(16) not null
nodisplay
noedit
runtime
default expr(substr(upper(user), 1, 16)
)
, "CONNECTSTRING" in varchar2(255) not null
description 'Internal: Connectstring'
nodisplay
noedit
runtime
default expr(rsi_gen_connectstring
)
, constraint "CLIENT_LIST"
message 'Please choose a instance/client combina
tion'
check (
select i.instance
, c.client
, i.description
into INSTANCE
, CLIENT
from rsi_sap_clients c
, rsi_sap_instances i
where i.interface = 'XBP'
and c.instance = i.instance
)
, constraint "ABAP_VARIANT_NAME_LIST"
optional
check ( select distinct apv.abap_variant_name
"Variant Name"
, min(apv.var_col_low) "Low Value"
, max(apv.var_col_high) "High Value"
into ABAP_VARIANT_NAME
from rsi_abap_program_variants apv
where apv.instance = :INSTANCE
and apv.client = :CLIENT
and apv.abap_program_name = :"ABAP_PROGRAM_NAME"
group by apv.abap_variant_name
)
, constraint "CHK_ABAP_VARIANT_NAME"
message 'Please choose a valid variant name'
check ( select null
from dual
where exists -- valid variant
( select distinct apv.abap_variant_name
from rsi_abap_program_variants apv
where apv.abap_program_name = :"ABAP_PROGRAM_NAME"
and apv.abap_variant_name = :"ABAP_VARIANT_NAME"
and apv.instance = :INSTANCE
and apv.client = :CLIENT
)
or not exists -- any variant at all
( select 1
from rsi_abap_program_variants apx
where apx.abap_program_name = :"ABAP_PROGRAM_NAME"
and apx.instance = :INSTANCE
and apx.client = :CLIENT
)
)
)
description 'RUN ABAP Program REORG JOBS'
application "ECC60"."AT_BASIS"
resource "SYSJCS"."SapR3"
format "SYSJCS"."GENERIC"
scripttype "SYSJCS"."SAPR3"
rwscript
Action Setting
ACTION="ABAP_RUN"
endrwscript
Thanks
Sorabh
Edited by: Sorabh Shinghal on Sep 22, 2009 1:30 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.