Closed Al2Klimov closed 3 years ago
Hi,
thanks for creating this PR and considering msmtp
.
The PR Icinga/icinga2#8642 isn't necessary if you also install the package msmtp-mta
, which will create a sendmail
symlink. I tested it today, the already existing notification scripts works without any changes with msmtp
. I think we should stick with them since they are tested in the wild and the new scripts are basically just a copy of the existing scripts with minor changes, so we save up on maintainer resources.
Best regards Michael
Nice!
➜ icinga2 git:(master) cat msmtp/icinga2.conf
include "/etc/icinga2/conf.d/commands.conf"
include <itl>
object CheckerComponent "cc" { }
object NotificationComponent "nc" { }
object Host "crit" {
check_command = "dummy"
vars.dummy_state = 2
}
object User "me" {
email = "aklimov@netways.de"
}
object Notification "mail" {
command = "mail-host-notification"
host_name = "crit"
users = [ "me" ]
}
➜ icinga2 git:(master) cat msmtp/msmtprc
account default
host exchange.int.netways.de
from icinga@example.com
➜ icinga2 git:(master) docker run --rm -itv $(pwd)/msmtp/msmtprc:/etc/msmtprc:ro -v $(pwd)/msmtp/icinga2.conf:/icinga2.conf:ro icinga/icinga2 icinga2 daemon -c /icinga2.conf
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Initializing /data as we're the init process (PID 1)
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/data/etc/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Copying "/data-init/etc/icinga2" to "/data/etc/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/data/var/cache/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Copying "/data-init/var/cache/icinga2" to "/data/var/cache/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/data/var/lib/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Copying "/data-init/var/lib/icinga2" to "/data/var/lib/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/data/var/log/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Copying "/data-init/var/log/icinga2" to "/data/var/log/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/data/var/run/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Copying "/data-init/var/run/icinga2" to "/data/var/run/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/data/var/spool/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Copying "/data-init/var/spool/icinga2" to "/data/var/spool/icinga2"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Checking "/var/lib/icinga2/certs/ca.crt"
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Looking up "dumb-init" in $PATH
[2021-02-22 11:45:00 +0000] information/DockerEntrypoint: Running "/usr/bin/dumb-init"
[2021-02-22 11:45:00 +0000] information/cli: Icinga application loader (version: v2.12.0-506-gaa4f53009)
[2021-02-22 11:45:00 +0000] information/cli: Loading configuration file(s).
[2021-02-22 11:45:00 +0000] information/ConfigItem: Committing config item(s).
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 1 NotificationComponent.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 1 CheckerComponent.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 1 User.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 2 NotificationCommands.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 1 Notification.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 1 IcingaApplication.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 1 Host.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Instantiated 8 CheckCommands.
[2021-02-22 11:45:00 +0000] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2021-02-22 11:45:00 +0000] information/ConfigItem: Triggering Start signal for config items
[2021-02-22 11:45:00 +0000] information/NotificationComponent: 'nc' started.
[2021-02-22 11:45:00 +0000] information/CheckerComponent: 'cc' started.
[2021-02-22 11:45:00 +0000] information/ConfigItem: Activated all objects.
[2021-02-22 11:46:48 +0000] information/Checkable: Checkable 'crit' has 1 notification(s). Checking filters for type 'Problem', sends will be logged.
[2021-02-22 11:46:48 +0000] information/Notification: Sending 'Problem' notification 'crit!mail' for user 'me'
[2021-02-22 11:46:48 +0000] information/Notification: Completed sending 'Problem' notification 'crit!mail' for checkable 'crit' and user 'me' using command 'mail-host-notification'.
^C[2021-02-22 11:47:00 +0000] information/Application: Received request to shut down.
[2021-02-22 11:47:00 +0000] information/Application: Received request to shut down.
[2021-02-22 11:47:00 +0000] information/Application: Shutting down...
[2021-02-22 11:47:00 +0000] information/CheckerComponent: 'cc' stopped.
[2021-02-22 11:47:00 +0000] information/NotificationComponent: 'nc' stopped.
[2021-02-22 11:47:00 +0000] information/ConfigObject: Dumping program state to file '/var/lib/icinga2/icinga2.state'
[2021-02-22 11:47:00 +0000] information/IcingaApplication: Icinga has shut down.
➜ icinga2 git:(master) docker run --rm -ite MSMTPRC="$(< msmtp/msmtprc)" -v $(pwd)/msmtp/icinga2.conf:/icinga2.conf:ro icinga/icinga2 icinga2 daemon -c /icinga2.conf
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Initializing /data as we're the init process (PID 1)
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/data/etc/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Copying "/data-init/etc/icinga2" to "/data/etc/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/data/var/cache/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Copying "/data-init/var/cache/icinga2" to "/data/var/cache/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/data/var/lib/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Copying "/data-init/var/lib/icinga2" to "/data/var/lib/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/data/var/log/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Copying "/data-init/var/log/icinga2" to "/data/var/log/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/data/var/run/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Copying "/data-init/var/run/icinga2" to "/data/var/run/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/data/var/spool/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Copying "/data-init/var/spool/icinga2" to "/data/var/spool/icinga2"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Checking "/var/lib/icinga2/certs/ca.crt"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Writing "/var/lib/icinga2/.msmtprc"
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Looking up "dumb-init" in $PATH
[2021-02-22 11:47:08 +0000] information/DockerEntrypoint: Running "/usr/bin/dumb-init"
[2021-02-22 11:47:08 +0000] information/cli: Icinga application loader (version: v2.12.0-506-gaa4f53009)
[2021-02-22 11:47:08 +0000] information/cli: Loading configuration file(s).
[2021-02-22 11:47:08 +0000] information/ConfigItem: Committing config item(s).
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 1 NotificationComponent.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 1 CheckerComponent.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 1 User.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 2 NotificationCommands.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 1 Notification.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 1 IcingaApplication.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 1 Host.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Instantiated 8 CheckCommands.
[2021-02-22 11:47:08 +0000] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2021-02-22 11:47:08 +0000] information/ConfigItem: Triggering Start signal for config items
[2021-02-22 11:47:08 +0000] information/NotificationComponent: 'nc' started.
[2021-02-22 11:47:08 +0000] information/CheckerComponent: 'cc' started.
[2021-02-22 11:47:08 +0000] information/ConfigItem: Activated all objects.
[2021-02-22 11:48:56 +0000] information/Checkable: Checkable 'crit' has 1 notification(s). Checking filters for type 'Problem', sends will be logged.
[2021-02-22 11:48:56 +0000] information/Notification: Sending 'Problem' notification 'crit!mail' for user 'me'
[2021-02-22 11:48:56 +0000] information/Notification: Completed sending 'Problem' notification 'crit!mail' for checkable 'crit' and user 'me' using command 'mail-host-notification'.
^C[2021-02-22 11:49:07 +0000] information/Application: Received request to shut down.
➜ icinga2 git:(master)
Affects / fixes #41
I did need the additional package https://packages.debian.org/buster/ca-certificates to get email sending to work, as my mail server is only accessible via starttls.
Other than that, works like a charm.
@Al2Klimov Now what do we need to do to get this merged?
Wait for #50.
Is there anything I can do to help that pull request along? Since t kinda is included in this pull request, they probably need to be reviewed / viewed together?
Am 02.03.2021 um 10:33 schrieb Alexander Aleksandrovič Klimov notifications@github.com:
Wait for #50 https://github.com/Icinga/docker-icinga2/pull/50.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Icinga/docker-icinga2/pull/52#issuecomment-788766295, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN6366E45VHQGQJ6BXJJ3TBSWILANCNFSM4X2CLHNA.
No and no.
fixes #41 closes #51