hasnat / docker-events-notifier Goto Github PK
View Code? Open in Web Editor NEWDocker events notifier
License: MIT License
Docker events notifier
License: MIT License
As stated in title: if you try to use smtp server with authentication - email is not sent and logs always show error "wrong host name".
This is due to fact, that smtp.PlainAuth expects host name without port, and smtp.SendMail needs port.
Will attach PR.
Can you add Discord Webhook Support ?
Hey, I am using config:
---
version: "3"
services:
docker-events-notifier-config:
image: hairyhenderson/gomplate:v3.10.0-alpine
container_name: docker-events-notifier-config
entrypoint: ["/bin/sh","-c"]
environment:
CONFIG: |
notifiers:
slack:
url: "https://hooks.slack.com/services/XXXX"
template: /etc/docker-events-notifier/templates/slack.json
email:
url: "smtp://user:[email protected]:[email protected]&[email protected]&[email protected]"
template: /etc/docker-events-notifier/templates/email.txt
filters:
event: ["stop", "die", "destroy"]
notifications:
- title: "Alert me when tianon/.* based container dies with exitCode 1"
when_regex:
status: ["(die|destroy)"]
"Actor.Attributes.image": ["tianon/.*"]
when:
"Actor.Attributes.exitCode": ["1"]
notify:
- email
- slack
- title: "Alert only on slack when container dies with exitCode 0"
when_regex:
status: ["(die|destroy)"]
"Actor.Attributes.image": ["hasnat/.*"]
when:
"Actor.Attributes.exitCode": ["0"]
notify:
- slack
- title: "Alert me on anything happening to images by hasnat"
when_regex:
"Actor.Attributes.image": ["hasnat/.*"]
notify:
- email
- slack
command:
- gomplate -i '{{ tmpl.Inline .Env.CONFIG }}' -o /etc/docker-events-notifier/config.yml
volumes:
- docker-events-notifier-config:/etc/docker-events-notifier/
restart: on-failure:5
docker-events-notifier:
image: hasnat/docker-events-notifier:0.0.2
container_name: docker-events-notifier
depends_on:
- docker-events-notifier-config
environment:
HOST_TAG: foo
RLOG_LOG_LEVEL: DEBUG
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- docker-events-notifier-config:/etc/docker-events-notifier/
restart: unless-stopped
networks:
production-network:
name: production-network
volumes:
docker-events-notifier-config:
driver: local
but getting:
2022-04-01T11:24:06Z DEBUG : Event: HTTP/1.0 404 Not Found
2022-04-01T11:24:06Z DEBUG : Not valid json event
2022-04-01T11:24:06Z DEBUG : invalid character 'H' looking for beginning of value
2022-04-01T11:24:06Z DEBUG : Event: Content-Type: application/json
2022-04-01T11:24:06Z DEBUG : Not valid json event
2022-04-01T11:24:06Z DEBUG : invalid character 'C' looking for beginning of value
2022-04-01T11:24:06Z DEBUG : Event: Date: Fri, 01 Apr 2022 11:24:06 GMT
2022-04-01T11:24:06Z DEBUG : Not valid json event
2022-04-01T11:24:06Z DEBUG : invalid character 'D' looking for beginning of value
2022-04-01T11:24:06Z DEBUG : Event: Content-Length: 29
2022-04-01T11:24:06Z DEBUG : Not valid json event
2022-04-01T11:24:06Z DEBUG : invalid character 'C' looking for beginning of value
2022-04-01T11:24:06Z DEBUG : Event:
2022-04-01T11:24:06Z DEBUG : Not valid json event
2022-04-01T11:24:06Z DEBUG : EOF
2022-04-01T11:24:06Z DEBUG : Event: {"message":"page not found"}
2022-04-01T11:24:06Z DEBUG : Checking "Alert me when tianon/.* based container dies with exitCode 1"
2022-04-01T11:24:06Z DEBUG : Checking "Alert only on slack when container dies with exitCode 0"
2022-04-01T11:24:06Z DEBUG : Checking "Alert me on anything happening to images by hasnat"
2022-04-01T11:24:06Z CRITICAL : EOF
panic: EOF
goroutine 1 [running]:
main.MustNoErr(0x86e460, 0xc000010050, 0x0, 0x0, 0x0)
/go/src/github.com/hasnat/docker-events-notifier/main.go:36 +0x194
main.MustByteArray(...)
/go/src/github.com/hasnat/docker-events-notifier/main.go:62
main.main()
/go/src/github.com/hasnat/docker-events-notifier/main.go:236 +0x3b7
Docker version: 20.10.14
Any ideas?
Thanks
Hello,
I configured the container on a Raspberry Pi 4B with Debian GNU/Linux 12 (bookworm) and Docker 25.03 as operating system.
The problem I report is that it does not start displaying the following error "exec ./docker-events-notifier: exec format error" .
I checked the config file with a yaml validator and there are no errors.
What's the problem?
Thanks for the help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.