Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
johnc10uk
byjohnc10uk, June 5, 2014
For ELB and RDS you don't need to define the instance_id so updated code to take hostname and shorten it for the elb/rds name. You can then use $HOSTNAME$ in the Nagios service check
check_cloudwatch_status.rb! YOURPATH/nagios/plugins/check_cloudwatch_status.rb -a $HOSTNAME$ -f ec2_credentials.cfg -L RequestCount -S Sum
line 348 :-
if namespace.eql?(AWS_NAMESPACE_EC2)
dimensions = "InstanceId=#{instance_id}"
elsif namespace.eql?(AWS_NAMESPACE_RDS)
# Strip off the name from the address
instance_id, *restofvalues = address.split('.')
instance_id = instance_id.split('-')[0...-1].join('-')
dimensions = "DBInstanceIdentifier=#{instance_id}"
elsif namespace.eql?(AWS_NAMESPACE_ELB)
# Strip off the name Load-Balancer-Name from the address Load-Balancer-Name-123456789.elb.amazon.com
instance_id, *restofvalues = address.split('.')
instance_id = instance_id.split('-')[0...-1].join('-')
dimensions = "LoadBalancerName=#{instance_id}"
end
check_cloudwatch_status.rb! YOURPATH/nagios/plugins/check_cloudwatch_status.rb -a $HOSTNAME$ -f ec2_credentials.cfg -L RequestCount -S Sum
line 348 :-
if namespace.eql?(AWS_NAMESPACE_EC2)
dimensions = "InstanceId=#{instance_id}"
elsif namespace.eql?(AWS_NAMESPACE_RDS)
# Strip off the name from the address
instance_id, *restofvalues = address.split('.')
instance_id = instance_id.split('-')[0...-1].join('-')
dimensions = "DBInstanceIdentifier=#{instance_id}"
elsif namespace.eql?(AWS_NAMESPACE_ELB)
# Strip off the name Load-Balancer-Name from the address Load-Balancer-Name-123456789.elb.amazon.com
instance_id, *restofvalues = address.split('.')
instance_id = instance_id.split('-')[0...-1].join('-')
dimensions = "LoadBalancerName=#{instance_id}"
end