Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Hipsaint contact

  • Loading branch information...
commit 463e2b196fa05fc8e670b653e7cde65626f1fcb5 1 parent 28f43ee
@cmelbye cmelbye authored
View
6 attributes/default.rb
@@ -205,8 +205,12 @@
node.set['nagios']['pagerduty']['key'] = node['nagios']['pagerduty_key']
default['nagios']['pagerduty']['key'] = ''
+default['nagios']['additional_contacts'] = {}
unless node['nagios']['pagerduty']['key'].empty?
- default['nagios']['additional_contacts'] = { 'pagerduty' => true }
+ default['nagios']['additional_contacts']['pagerduty'] = true
+end
+if node['hipchat'] && node['hipchat']['token'] && !node['hipchat']['token'].empty?
+ default['nagios']['additional_contacts']['hipchat'] = true
end
default['nagios']['pagerduty']['script_url'] = 'https://raw.github.com/PagerDuty/pagerduty-nagios-pl/master/pagerduty_nagios.pl'
default['nagios']['pagerduty']['service_notification_options'] = 'w,u,c,r'
View
2  metadata.rb
@@ -9,7 +9,7 @@
recipe 'nagios', 'Includes the server recipe.'
recipe 'nagios::pagerduty', 'Integrates contacts w/ PagerDuty API'
-%w( apache2 build-essential php nginx nginx_simplecgi yum-epel nrpe ).each do |cb|
+%w( apache2 build-essential php python nginx nginx_simplecgi yum-epel nrpe ).each do |cb|
depends cb
end
View
21 recipes/hipsaint.rb
@@ -0,0 +1,21 @@
+#
+# Cookbook Name:: nagios
+# Recipe:: hipsaint
+#
+# Copyright 2013, YOUR_COMPANY_NAME
+#
+# All rights reserved - Do Not Redistribute
+#
+
+include_recipe 'python'
+
+python_pip 'hipsaint' do
+ action :install
+end
+
+template "#{node['nagios']['config_dir']}/hipsaint.cfg" do
+ owner node['nagios']['user']
+ group node['nagios']['group']
+ mode 00640
+ source "hipsaint_nagios.cfg.erb"
+end
View
21 templates/default/hipsaint_nagios.cfg.erb
@@ -0,0 +1,21 @@
+define command {
+ command_name notify-host-by-hipchat
+ command_line hipsaint --token=<%= node["hipchat"]["token"] %> --room=<%= node["hipchat"]["event_room_id"] %> --type=host --inputs="$HOSTNAME$|$LONGDATETIME$|$NOTIFICATIONTYPE$|$HOSTADDRESS$|$HOSTSTATE$|$HOSTOUTPUT$" -n
+}
+
+define command {
+ command_name notify-service-by-hipchat
+ command_line hipsaint --token=<%= node["hipchat"]["token"] %> --room=<%= node["hipchat"]["event_room_id"] %> --type=service --inputs="$SERVICEDESC$|$HOSTALIAS$|$LONGDATETIME$|$NOTIFICATIONTYPE$|$HOSTADDRESS$|$SERVICESTATE$|$SERVICEOUTPUT$" -n
+}
+
+define contact {
+ contact_name hipchat
+ alias HipChat Pseudo-Contact
+ service_notification_period 24x7
+ host_notification_period 24x7
+ service_notification_options w,u,c,r
+ host_notification_options d,r
+ service_notification_commands notify-service-by-hipchat
+ host_notification_commands notify-host-by-hipchat
+ email /dev/null
+}
Please sign in to comment.
Something went wrong with that request. Please try again.