on 01-10-2014 8:08 AM
Hi Experts,
Need help on receiving alert mail from CPS.
I do not even want the log files. Just need a alert if a job goes to ERROR status.
As far as I analysed, I got to now that we have to submit the definitions System_Mail_Configure and System_Mail_Send with the necessary details.
But though I tried, I did not get any mails.
Can you help me out in filling the below blanks.
In the job definition System_mail_configure.
Help me in filling the below.
Below question might sound silly but please bear.
Can I give "DETECT" in From and give any email ID in Server (gmail or my company's mail id)?
Similarly, In the job definition System_mail_Send
Help me in filling the below.
My assumptions:
To: My mail id
Subject: Job failure Alert CPS
Text : ---------
Relative Job: Should I give the job chain name/Job name?
Job File: What should I provide here?
Server And From: Can I give same details as provided in System_Mail Configure?
After all this, should I submit these two, first CONFIGURE job and second SEND job?
Many thanks in advance!!
Thanks
Ramakrishnan R
Hey Rama,
Just adding to what HP already mentioned,
thanks
Nanda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ Nanda and HP:
I am scheduling the system_mail_send job under the same step of the job that want to get alerts.
Hence I will not be able to use Status Handlers right?
Do you suggest me to create a new step for System_mail_send?
I tried doing this and I am able to get all the logs. I gave * in Job file.
Many thanks for your help.
I could not have done this without your help
Regards,
Ramakrishnan R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am scheduling the system_mail_send job under the same step of the job that want to get alerts.
No, do not do that, it will never work. Jobs in a step are executed in parallel, which means the mail job will not be able to get the file since it is not yet finished being created. Put the Mail job in a separate step that is executed AFTER the job that generates the file.
Regards,
HP
Hi ramakirshnan,
Since you are beginning to explore SAP CPS, i highly recommend the admin guide. It has all these information with easy examples. The above tests that we suggested, all are in the guide.
Also it has methods of improving this basic emailing mechanism to a better alerting tool using REL and Redwood scripting.
Thanks
Nanda
Hi and http://scn.sap.com/people/nanda.kumar21
Many thanks..
Finally managed to receive mails.
I'm getting the subject, and Text of the mail.
But i'm not getting the job log.
Most of the jobs does not create Spool but atleast I would require the Job log file.
And how do I make sure that I get alerts only for job in KILLED or ERROR status.
The mistake I made was that instead of creating a new job under a step inside the job chain, I was running the System_mail_send job directly from the Definitions
Please help me for getting the job log as an attachment in my mail.
Regards
Ramakrishnan R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nanda,
Understood the below.
"Yes, everything in a job chain.
Step 1 - job you want to monitor
step 2 - system_mail_send".
Which job did you try in step 1?
Are you seeing any log for the job in step 1?
PFB job name and Log of Job in below screenshot.
Name of the log is joblog.log and i tried using that in Job File.
Also I tried joblog (without .log).
But no positive results.
We are using the version - M33.85-65736
Regards,
Ramakrishnan R
Hi HP,
Please find screenshots below.
Also Job chain's diagram below.
I am shading out my company's names in the screenshots as I am not sure whether this kind of screenshot sharing is allowed in my company.
@ Nanda and Hp:
I am scheduling the system_mail_send job under the same step of the job that want to get alerts.
Hence I will not be able to use Status Handlers right?
Do you suggest me to create a new step for System_mail_send?
Regards,
Ramakrishnan R
Hi and http://scn.sap.com/people/h.carpenter,
Many thanks for detailed replies.
I will be trying your suggestions on wednesday (pls bear the delay).
Will get back immediately with my results.
In the meanwhile I tried to run System_Mail_send without any Relative job.
But I got some issues like could not detect SMTP server and port 25 is blocked.
Am not sure if the above line is exact but that is the message it conveyed.
If It did not accept my Company's mail id, can I do something in CPS and correct that or is there now way where I can get mails to my company mail Id?
Thanks
Ramakrishnan R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramakrishnan,
The CPS server needs to be able to connect to your SMTP server. Please try
telnet <mail_server> 25
That should connect, if it does not work, you get an error message. My expectation is that it will fail, see with your network administration team - most likely it is a firewall.
As for the relative job issue, which version are you running ?
Also, please inspect the following:
Note: I have left out Server, because I want to use the default. I have deleted the from and to addresses (first and last):
Subject: Test
Text: Test info
Result: I received an email with the output of System_Info (Step 1, Job 1)
Regards,
HP
Message was edited by: h. Carpenter Added job chain diagram image
Hi Both,
Thanks for helping me.
But i'm still stuck at this part.
Relative Job: Step 1, Job 2 <<- the job number 2 of step named "Step 1" in the job chain
For example,
Job Chain: TEST_JOB
Step 1:
Job Name: TEST_RK
now, in Relative job, what should I give?
Option 1: Step 1, TEST_RK
Option 2: TEST_RK
Or, are both options wrong?
Thanks
Ramakrishnan R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramakrishnan,
Ok, you are almost there ... the syntax is: <step_name>, Job <job_number>
For example: "Step 1, Job 1" or "Data Retrieval, Job 2" ...
You are specifying "Step 1, <Some name I cannot see because you have hidden it ;-)>"
So, assuming your step is named Step 1, and you want the first job of step 1, try:
Step 1, Job 1
Regards,
HP
Hi HP,
Thanks. But still I am facing issues.
By the syntax is: <step_name>, Job <job_number>
I am giving Step 1, Job ID (took from a already failed instance).
I'm giving you screenshots of my job definition below.
Can you please provide me the syntax.
Step Name
Job Name
The job id that I gave was based on the earlier failed Job ID's.
Please help
Regards,
Ramakrishnan R
Hi Ramakrishnan,
Ok, please try "Step 1, Job 1".
Note that you can also specify "Job 123456" without Step, but that is not really what you want because you would have to fill the parameter with the job id ... Your step has 1 job, so that job is "Job 1".
See attached image, imagine you have 3 jobs in Step 1, you would specify the relative jobs as follows:
Step 1, Job 1
Step 1, Job 2
Step 1, Job 3
This is really powerful, because it automatically looks up the job id under the hood. Note that if you delete Job 2 in the above example, Job 3 will become Job 2 -> watch out when you delete a job from the step because it will not update "Relative Job" expressions automatically.
Regards,
HP
Hi Radhakrishnan,
Are you receiving mails when you submit System_Mail_send separately?
If yes can you try adding any one of job ids (completed, error, anyone) in the relative job field and see what you're getting?
When the log says, relative job is step 1, jobid xx, the current job id is yy, what is that job with id yy?
in this case, did you supply the job id manually? like Step 1, yy. this wouldn't have worked.because in step 1, there is no job with id yy.
You shouldn't manually fill job id, because for every run the job id is generated and automatically assigned to job. So if you hard code it, how will it pick the current job id?
You should only use number '1' or '2' etc.., as HP mentioned. Simply, step 1, job 1. this wil alert about the first job in step 1.
Also if you search for notes section in the service market place with you CPS version, you will a note that describes the changes and bug fixes that are available in the next version from your CPS version, where you can check against your issue. If it's not mentioned there, you can raise an OSS message, for which i assume, SAP would recommend upgrading to a higher version of CPS.
Thanks
Nanda
Something about the job id in the logs, intrigued me. Message was edited by: Nanda Kumar
Hi Ramakrishnan,
From: someone@company.com
Server: smtp.company.com
Subject: Job failure Alert CPS
Text : ---------
Relative Job: Step 1, Job 2 <<- the job number 2 of step named "Step 1" in the job chain
Job File: stderr.log <<-if you want a job file
Basically, you can have the following job chain with three steps, first to do actual work (named "Run Abap"), second only run if error occurred in first step (named "Error Handling"), last step does nothing, used to jump over step number 2 :
Run Abap (Step 1)-> Status Handlers -> onCompleted Goto "Do nothing, all is fine", onError goto "Error Handling"
-> Some AbapRun
Error Handling (Step 2)
-> System_Mail_Send
-->To: someone@company.com
-->Subject: Job chain failed
-->Text: This job chain failed, see attached error log.
-->Relative Job: Run Abap, Job 1 <------ only fill if you want the stderr.log
-->Job File:stderr.log <------ only fill if you want the stderr.log
-->Server:use default, so don't fill
-->From: use default, so don't fill
Do nothing, all is fine (Step 3)
There are other ways to do it, of course, but this keeps it simple.
You can also search the log file for errors and send just the lines containing errors, or send the first, last 15 lines, for example ... but that is another subject for another thread ... I guess ... 😉
See
http://<server>:<port>/scheduler/help/user_guide/definitions/job_definition_types/mail_job_definition_type.html
http://<server>:<port>/scheduler/help/modules/mail/main_mail.html
for more information.
Regards from
HP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.