Build precise queries to find exactly what you need
Press ESC to close
@johnc10uk
Favorites0
Views
Projects0
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
Reviewed 11 years ago