Skip to content

Instantly share code, notes, and snippets.

@pcn
Created January 21, 2014 19:58
Show Gist options
  • Select an option

  • Save pcn/8547210 to your computer and use it in GitHub Desktop.

Select an option

Save pcn/8547210 to your computer and use it in GitHub Desktop.
Fixup nagios for cassandra sedeploy
include_recipe 'nagios::client'
include_recipe 'nagios_discovery::virtualenv'
# FIXME we need to move this block to ohai or cb attributes
node.chef_environment =~ /(.*)-(.*)/
billing_env = $1
kcs_env = $2
azone = node['ec2']['placement_availability_zone']
region = azone[0, azone.length - 1]
ruby_block do
block do
if node.has_key?("sedeploy") # sedeploy
sqs_cmd = "/opt/virtualenvs/nagios_discovery/bin/sqs-post-message --iam"
else # kcs
sqs_cmd = "/opt/virtualenvs/nagios_discovery/bin/sqs-post-message -e stack_iam"
end
`ec2-metadata | #{cmd} -q #{region}_nagios_#{billing_env}_#{kcs_env}`
end
end
#
#
# bash 'nagios_discovery_announce' do
# code <<-BASH
# ec2-metadata | \
# /opt/virtualenvs/nagios_discovery/bin/sqs-post-message \
# -e stack_iam -q #{region}_nagios_#{billing_env}_#{kcs_env}
# BASH
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment