Yuvipanda has submitted this change and it was merged.
Change subject: shinken: Don't say 'icinga' in shinken notification emails
......................................................................
shinken: Don't say 'icinga' in shinken notification emails
Change-Id: I11e745dc3d37ce474c11a814f782f18acdee123a
---
M modules/nagios_common/manifests/notification_commands.pp
R modules/nagios_common/templates/notification_commands.cfg.erb
M modules/shinken/manifests/server.pp
3 files changed, 25 insertions(+), 12 deletions(-)
Approvals:
Yuvipanda: Looks good to me, approved
jenkins-bot: Verified
Dzahn: Looks good to me, but someone else must approve
diff --git a/modules/nagios_common/manifests/notification_commands.pp
b/modules/nagios_common/manifests/notification_commands.pp
index e39479b..ecdbb91 100644
--- a/modules/nagios_common/manifests/notification_commands.pp
+++ b/modules/nagios_common/manifests/notification_commands.pp
@@ -17,16 +17,21 @@
# The group which should own the check config files.
# Defaults to 'icinga'
#
+# [*lover_name*]
+# Name of thing that gives the recipient love when notifying
+# them via email of bad things that have happened
+#
class nagios_common::notification_commands(
$ensure = present,
$config_dir = '/etc/icinga',
$owner = 'icinga',
$group = 'icinga',
+ $lover_name = 'Icinga',
) {
file { "$config_dir/notification_commands.cfg":
- ensure => $ensure,
- source => 'puppet:///modules/nagios_common/notification_commands.cfg',
- owner => $owner,
- group => $group,
+ ensure => $ensure,
+ content => template('nagios_common/notification_commands.cfg.erb'),
+ owner => $owner,
+ group => $group,
}
}
diff --git a/modules/nagios_common/files/notification_commands.cfg
b/modules/nagios_common/templates/notification_commands.cfg.erb
similarity index 76%
rename from modules/nagios_common/files/notification_commands.cfg
rename to modules/nagios_common/templates/notification_commands.cfg.erb
index dbc3b27..81f85f0 100644
--- a/modules/nagios_common/files/notification_commands.cfg
+++ b/modules/nagios_common/templates/notification_commands.cfg.erb
@@ -16,7 +16,7 @@
# used as a template for this definition (optional)
# <objectname> = object name of command definition, referenced by other
# command definitions that use it as a template (optional)
-# <commandname> = name of the command, as recognized/used by Icinga
+# <commandname> = name of the command, as recognized/used by <%= @lover_name
%>
# <commandline> = command line
#
################################################################################
@@ -26,36 +26,36 @@
# 'host-notify-by-email' command definition
define command{
command_name host-notify-by-email
- command_line /usr/bin/printf "%b" "❤❤❤❤❤ Icinga
❤❤❤❤❤\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
$HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
$LONGDATETIME$\nLove, Icinga" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for
$HOSTNAME$!" $CONTACTEMAIL$
+ command_line /usr/bin/printf "%b" "❤❤❤❤❤ <%= @lover_name %>
❤❤❤❤❤\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
$HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
$LONGDATETIME$\nLove, <%= @lover_name %>" | /usr/bin/mail -s "Host $HOSTSTATE$
alert for $HOSTNAME$!" $CONTACTEMAIL$
}
# 'host-notify-by-epager' command definition
define command{
command_name host-notify-by-epager
- command_line /usr/bin/printf "%b" "Host '$HOSTALIAS$' is
$HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$ <3, Icinga" |
/usr/bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$"
$CONTACTPAGER$
+ command_line /usr/bin/printf "%b" "Host '$HOSTALIAS$' is
$HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$ <3, <%= @lover_name %>" |
/usr/bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$"
$CONTACTPAGER$
}
# 'notify-by-email' command definition
define command{
command_name notify-by-email
- command_line /usr/bin/printf "%b" "❤❤❤❤❤ Icinga
❤❤❤❤❤\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost:
$HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\nLove, Icinga" |
/usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$ **" $CONTACTEMAIL$
+ command_line /usr/bin/printf "%b" "❤❤❤❤❤ <%= @lover_name %>
❤❤❤❤❤\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost:
$HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\nLove, <%= @lover_name
%>" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$
is $SERVICESTATE$ **" $CONTACTEMAIL$
}
# 'notify-by-epager' command definition
define command{
command_name notify-by-epager
- command_line /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost:
$HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo:
$SERVICEOUTPUT$\nDate: $LONGDATETIME$ <3, Icinga" | /usr/bin/mail -s
"$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
+ command_line /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost:
$HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo:
$SERVICEOUTPUT$\nDate: $LONGDATETIME$ <3, <%= @lover_name %>" | /usr/bin/mail
-s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"
$CONTACTPAGER$
}
define command{
command_name host-notify-by-sms-gateway
- command_line echo "Host $HOSTALIAS$ is $HOSTSTATE$\nInfo:
$HOSTOUTPUT$\nTime: $LONGDATETIME$ <3, Icinga" | /usr/bin/mail -s "Host
$HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTADDRESS1$
+ command_line echo "Host $HOSTALIAS$ is $HOSTSTATE$\nInfo:
$HOSTOUTPUT$\nTime: $LONGDATETIME$ <3, <%= @lover_name %>" | /usr/bin/mail -s
"Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTADDRESS1$
}
define command{
command_name notify-by-sms-gateway
- command_line echo "$SERVICEDESC$ on $HOSTNAME$ is $SERVICESTATE$:
$SERVICEOUTPUT$ $SERVICEACKAUTHOR$ $SERVICEACKCOMMENT$ at $LONGDATETIME$ <3,
Icinga" | /usr/bin/mail -s "nagios" $CONTACTADDRESS1$
+ command_line echo "$SERVICEDESC$ on $HOSTNAME$ is $SERVICESTATE$:
$SERVICEOUTPUT$ $SERVICEACKAUTHOR$ $SERVICEACKCOMMENT$ at $LONGDATETIME$ <3,
<%= @lover_name %>" | /usr/bin/mail -s "nagios" $CONTACTADDRESS1$
}
# global IRC output for operations
diff --git a/modules/shinken/manifests/server.pp
b/modules/shinken/manifests/server.pp
index bd466a9..b01b0c3 100644
--- a/modules/shinken/manifests/server.pp
+++ b/modules/shinken/manifests/server.pp
@@ -83,7 +83,6 @@
class { [
'nagios_common::user_macros',
'nagios_common::timeperiods',
- 'nagios_common::notification_commands',
] :
config_dir => '/etc/shinken',
owner => 'shinken',
@@ -92,6 +91,15 @@
require => Package['shinken'],
}
+ class { 'nagios_common::notification_commands':
+ config_dir => '/etc/shinken',
+ owner => 'shinken',
+ group => 'shinken',
+ notify => Service['shinken'],
+ require => Package['shinken'],
+ lover_name => 'Shinken',
+ }
+
# Default localhost config, we do not need this
file { '/etc/shinken/hosts/localhost.cfg':
ensure => absent,
--
To view, visit https://gerrit.wikimedia.org/r/172802
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I11e745dc3d37ce474c11a814f782f18acdee123a
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits