Skip to Content
avatar image
Former Member

How to receive mail Alerts from CPS?

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Jan 10, 2014 at 09:22 AM

    Hey Rama,

    Just adding to what HP already mentioned,

    1. The Mail configure job is run only once for a redwood system to define the SMTP server address. You don't have to run it again, or mention the same parameters in System_Mail_Send job.
    2. Only "to" field is mandatory in system_mail_send job (rest all optional). You can fill the Server and From address if you want to use an SMTP server different from the one that is already configured using Mail configure job.
    3. Login to the operating system of the CPS system and ping & telnet the mail server and confirm that connection is OK.
    4. If you want a mail alert, everytime a job fails, then you have to create a job chain for every single job you have and follow the method HP mentioned.
    5. Always use a distribution list for the "to" address. That way, when some one leaves the company tomorrow, you don't have to edit thousands of job chains to remove one single mail address.
    6. I would rather buy Alerting module. Because this basic alerting is time consuming work. If you have jobs that run in parallel in a job chain (which means they are withing a single step), then you will have to make each of them a job chain, then include those small chains inside the bigger chain.
    7. Also, this basic alert doesn't include a lot of required information about the job. When there is a change in sequence of the steps, then again you will have to rearrange the mail alert steps

    thanks

    Nanda

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 10, 2014 at 08:31 AM

    Hi Ramakrishnan,

    From: someone@company.com

    Server: smtp.company.com

    To: someone@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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 12, 2014 at 03:42 AM

    Hi @Nanda Kumar 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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

      JCDiagram.png (22.3 kB)
  • avatar image
    Former Member
    Jan 10, 2014 at 09:45 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Jan 15, 2014 at 07:28 AM

    Hi Former Member 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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

      job failure.png (65.6 kB)
      Job chain.png (39.3 kB)
  • avatar image
    Former Member
    Jan 15, 2014 at 11:29 AM

    @ 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

    Add comment
    10|10000 characters needed characters exceeded