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

No mail on job failure if global settings overridden #124

Open
0xERR0R opened this issue Oct 24, 2020 · 1 comment
Open

No mail on job failure if global settings overridden #124

0xERR0R opened this issue Oct 24, 2020 · 1 comment

Comments

@0xERR0R
Copy link
Contributor

0xERR0R commented Oct 24, 2020

Consider following example:

version: "3"
services:
  ofelia:
    image: mcuadros/ofelia:latest
    command: daemon --docker
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      ofelia.smtp-host: "smtp.gmail.com"
      ofelia.smtp-port: "587"
      ofelia.smtp-user: "XXX@googlemail.com"
      ofelia.smtp-password: "XXX"
      ofelia.email-to: "XXX@gmail.com"
      ofelia.email-from: "Ofelia <XXX@gmail.com>"
      ofelia.mail-only-on-error: "false"
      # 
      # This job is alway successful
      ofelia.job-local.job1.schedule: "@every 15s"
      ofelia.job-local.job1.command: "true"
      #
      # This job always fails
      ofelia.job-local.job2.schedule: "@every 15s"
      ofelia.job-local.job2.command: "false"
      #
      # This job always fails
      ofelia.job-local.job3.schedule: "@every 15s"
      ofelia.job-local.job3.command: "false"
      ofelia.job-local.job3.mail-only-on-error: "true"

I have 3 jobs. Job 1 is always successful, job 2 and 3 always fail. Global configuration: send always mail (for successful and failed jobs). But for job3, I want to override this behaviour: I want to receive mail only if job3 fails.

This doesn't work, I get: mail.go:57 ▶ ERROR Mail error: "dial tcp :0: connect: connection refused"

In my opinion, the global configuration can be overridden (partially) in the job definition. In this case, I must also define ALL mail properties (like host, user, password) on the job definition. So, basically, if I add

      ofelia.job-local.job3.smtp-host: "smtp.gmail.com"
      ofelia.job-local.job3.smtp-port: "587"
      ofelia.job-local.job3.smtp-user: "xxx@googlemail.com"
      ofelia.job-local.job3.smtp-password: "xxx"
      ofelia.job-local.job3.email-to: "xxx@gmail.com"
      ofelia.job-local.job3.email-from: "Ofelia <xxx@gmail.com>"

then it works

@taraspos
Copy link
Collaborator

In my opinion, the global configuration can be overridden (partially) in the job definition

This makes sense. I would need to check the logic there.

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

No branches or pull requests

2 participants