Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable email notification to external address #310

Open
ckotte opened this issue Sep 6, 2020 · 5 comments
Open

Enable email notification to external address #310

ckotte opened this issue Sep 6, 2020 · 5 comments

Comments

@ckotte
Copy link

ckotte commented Sep 6, 2020

Could you implement email notification to external addresses?

Probably a copy of system-email plus at least one parameters like recipient.

@dshearer
Copy link
Owner

dshearer commented Sep 7, 2020 via email

@ckotte
Copy link
Author

ckotte commented Sep 7, 2020

Is there a message passed to the program as a parameter?

@ckotte
Copy link
Author

ckotte commented Sep 7, 2020

Wouldn't is be possible to just duplicate result_sink_system_email.go and change execResult, err := common.ExecAndWait([]string{"sendmail", rec.Job.User}, msgBytes) and replace rec.Job.User with the recipient parameter?

@dshearer
Copy link
Owner

dshearer commented Sep 9, 2020 via email

@ckotte
Copy link
Author

ckotte commented Sep 13, 2020

I created a job where the command errors every time. However, the job doesn't never fails. It should eventually fail if onError is set to Backoff, righ?

I configured it to run every minute, but the schedule changes after two failures:

bash-5.0# jobber log
TIME                  JOB       RESULT     NEW JOB STATUS  
Sep 13 17:09:00 2020  TestEcho  succeeded  Good            
Sep 13 17:08:45 2020  TestEcho  succeeded  Good            
Sep 13 17:08:00 2020  TestEcho  succeeded  Good            
Sep 13 17:07:45 2020  TestEcho  succeeded  Good            
Sep 13 17:07:00 2020  TestEcho  succeeded  Good            
Sep 13 17:06:45 2020  TestEcho  succeeded  Good            
Sep 13 17:06:00 2020  TestEcho  succeeded  Good            
Sep 13 17:05:45 2020  TestEcho  succeeded  Good            
Sep 13 17:05:00 2020  TestEcho  succeeded  Good            
Sep 13 17:05:00 2020  TestFail  failed     Backoff         
Sep 13 17:04:45 2020  TestEcho  succeeded  Good            
Sep 13 17:04:00 2020  TestEcho  succeeded  Good            
Sep 13 17:03:45 2020  TestEcho  succeeded  Good            
Sep 13 17:03:00 2020  TestEcho  succeeded  Good            
Sep 13 17:02:45 2020  TestEcho  succeeded  Good            
Sep 13 17:02:00 2020  TestEcho  succeeded  Good            
Sep 13 17:01:45 2020  TestEcho  succeeded  Good            
Sep 13 17:01:00 2020  TestEcho  succeeded  Good            
Sep 13 17:01:00 2020  TestFail  failed     Backoff         
Sep 13 17:00:45 2020  TestEcho  succeeded  Good            
Sep 13 17:00:00 2020  TestEcho  succeeded  Good            
Sep 13 16:59:45 2020  TestEcho  succeeded  Good            
Sep 13 16:59:00 2020  TestEcho  succeeded  Good            
Sep 13 16:59:00 2020  TestFail  failed     Backoff         
Sep 13 16:58:45 2020  TestEcho  succeeded  Good            
Sep 13 16:58:00 2020  TestEcho  succeeded  Good            
Sep 13 16:58:00 2020  TestFail  failed     Backoff         
Sep 13 16:57:45 2020  TestEcho  succeeded  Good
bash-5.0# jobber list
NAME      STATUS   SEC/MIN/HR/MDAY/MTH/WDAY  NEXT RUN TIME              NOTIFY ON SUCCESS  NOTIFY ON ERR  NOTIFY ON FAIL  ERR HANDLER
TestEcho  Good     */45 * * * * *            Sep 13 17:09:45 +0000 UTC  program            program        program         Backoff
TestFail  Backoff  */60 * * * * *            Sep 13 17:10:00 +0000 UTC                     program                        Backoff

When will it fail and will the JSON be different? I can differentiate between success and error via "succeeded", but how can I get the failure state?

{
    "job": {
        "command": "cat 'hello world'",
        "name": "TestFail",
        "status": "Backoff",
        "time": "*/60 * * * * *"
    },
    "startTime": "Sep 13 17:01:00 2020",
    "stderr": "cat: can't open 'hello world': No such file or directoryn",
    "stderr_base64": false,
    "stdout": "",
    "stdout_base64": false,
    "succeeded": false,
    "user": "root"
}

Edit: Ok. I got it. I should use Stop for testing. The job is now in failure state. I get the same JSON with notifyOnError and notifyOnFailure. How my script check if notifyOnFailure triggered it?

{
    "job": {
        "command": "cat 'hello world'",
        "name": "TestFail",
        "status": "Failed",
        "time": "*/60 * * * * *"
    },
    "startTime": "Sep 13 17:35:00 2020",
    "stderr": "cat: can't open 'hello world': No such file or directoryn",
    "stderr_base64": false,
    "stdout": "",
    "stdout_base64": false,
    "succeeded": false,
    "user": "root"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants