From fb75fcec220f9e2943d2e7af292ff884fd237f6d Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 12 Apr 2011 18:29:54 -0400 Subject: Fix nagios check_smtp duplicate definition On Debian, the nagios-plugins packages install /etc/nagios-plugins/config/mail.cfg which contains the check_smtp/check_imap commands, and these commands cannot be duplicated. The addition of these commands in this module in c9c4f5bb895e98e31d84c751a7fcbdae9bf57008 and 1c4de48baf4ffcf5f39894a101a3c59479959b47 now cause Debian nagios servers to fail to start with this message: Warning: Duplicate definition found for command 'check_smtp' (config file '/etc/starting on line 9) The versions of these check commands that were added in the above commits are actually more full-featured than the ones that Debian ships, most notably because they allow for the port to be passed as an option. In most cases their names are the same, although the imap and pop ssl commands are different. This leads to a somewhat unfortunate situation where the module defines duplicated commands, which are better, but in some cases are differently named than the ones shipped in the package. Ideally, those names would converge, and the debian package commands would add the port options by default, and we'd case out debian/ubuntu to not ship these in this module. However, due to the added benefit of the options provided in the commands shipped in this module, along with the benefits that come with the module being able to automatically configure these, I've elected to simply remove the debian package file (which is a config file, so it will be honored by the packaging system). --- manifests/defaults/commands.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 0a7ad4f..9068c63 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -6,6 +6,12 @@ class nagios::defaults::commands { # common service commands case $operatingsystem { debian,ubuntu: { + # debian and ubuntu ship the nagios::command::smtp and + # nagios::command::imap_pop3 commands in the nagios-plugins packages, + # which are placed in /etc/nagios-plugins/config/mail.cfg, however they + # are inferior to the ones provided in this module below because they do + # not provide port options, so we just remove them + file { '/etc/nagios-plugins/config/mail.cfg': ensure => absent; } nagios_command { check_dummy: command_line => '$USER1$/check_dummy $ARG1$'; -- cgit v1.2.3