Skip to content

Instantly share code, notes, and snippets.

@ralphbean
Created August 5, 2012 16:01
Show Gist options
  • Select an option

  • Save ralphbean/3265538 to your computer and use it in GitHub Desktop.

Select an option

Save ralphbean/3265538 to your computer and use it in GitHub Desktop.
Requires fedmsg-0.2.7 or greater.
diff --git a/modules/nagios/files/nagios/misccommands.cfg b/modules/nagios/files/nagios/misccommands.cfg
index 19ce5b8..18425e9 100644
--- a/modules/nagios/files/nagios/misccommands.cfg
+++ b/modules/nagios/files/nagios/misccommands.cfg
@@ -98,6 +98,12 @@ define command{
command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$
}
+# 'notify-by-fedmsg' command definition
+define command{
+ command_name notify-by-fedmsg
+ command_line /usr/bin/echo '{"type": "$NOTIFICATIONTYPE", "description": "$SERVICEDESC", "host_alias": "$HOSTALIAS", "host_address": "$HOSTADDRESS", "service_state": "$SERVICESTATE", "long_datetime": "$LONGDATETIME", "service_outp
+ }
+
################################################################################
diff --git a/modules/nagios/manifests/init.pp b/modules/nagios/manifests/init.pp
index f5fcbd2..352dd82 100644
--- a/modules/nagios/manifests/init.pp
+++ b/modules/nagios/manifests/init.pp
@@ -16,6 +16,14 @@ class nagios::server inherits nagios {
include httpd::base
include httpd::mod_auth_pgsql
+ # Include the fedmsg config and load a nagios cert/key pair from the
+ # private repo with read permissions for the "nagios" group.
+ include fedmsg::config
+ fedmsg::certificate { "nagios":
+ service => "nagios",
+ group => "nagios",
+ }
+
# Add the apache user to the nagios group so that it has permissions
# to do stuff in /var/spool/nagios/*
user { 'apache': groups => 'nagios' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment