Open wojtas911 opened 7 years ago
Hi @wojtas911. I don't have access to AWS account with active ELBv2. I can implement it in "blind" mode in a new branch and instruct you on how to test it and show me actual data. Works for you?
Hi @wawastein Thank You for fast replay. As I mention before I'm not good at python at all, but i will try my best to assist You. Maybe that will be good opportunity to learn something new.
I will be happy to help :)
Hi @wojtas911 I've adapted the template for using ELB Application. It was something... but after all it works! Thanks to @wawastein he did a great job, that is way you can monitor a lot in AWS with its help. If you want I can provide you with additional information.
@dartua could you please do it as a pull-request? If it works for you.
I'm not sure, that is necessary. @wawastein Let me describe you what I did and then you will be able to decide should I create an pull request or not.
You can find out the name of the instance in two ways:
a) With aws cli: aws elbv2 describe-load-balancers in line "LoadBalancerArn": "arn:aws-cn:elasticloadbalancing:cn-north-1:11111112222333:loadbalancer/app/SomeBalancerName/28bcxxxx8ccb you can find information about the name. In this example the name will be "app/SomeBalancerName/28bcxxxx8ccb"
b) Or you can find the name from WEB GUI in AWS Console.
Like this
I didn't create discovery rule for this type of ELB, because I have only a couple of these instances.
I see. This works, but is "manual", i.e. you need to specify ARN. Poses a problem if environment is fluid and/or there are multiple Ops guys and someone can forget to add new resource. When I have a moment later this week I'll try to write discovery rule.
@dartua i took a look at your template for elbv2 but i cant understand how you are able to get numbers for healthy and unhealthy hosts. elbv2 needs both the load balancer name and the target group name to get this number. i have been unable to get that to work. maybe @wawastein can help us officially support elbv2.
here are two examples with and without target group:
# ./cloudwatch.metric --interval 600 --metric HealthyHostCount --namespace AWS/ApplicationELB --statistic Average --region us-east-1 --dimension LoadBalancer=app/xxx/xxxx --account test-east --debug 1
{u'Datapoints': [], 'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': 'c8b4d04f-18aa-11e8-af4d-6b50fd79ca6c', 'HTTPHeaders': {'x-amzn-requestid': 'c8b4d04f-18aa-11e8-af4d-6b50fd79ca6c', 'date': 'Fri, 23 Feb 2018 15:04:02 GMT', 'content-length': '339', 'content-type': 'text/xml'}}, u'Label': 'HealthyHostCount'}
-1
# ./cloudwatch.metric --interval 600 --metric HealthyHostCount --namespace AWS/ApplicationELB --statistic Average --region us-east-1 --dimension LoadBalancer=app/xxx/xxx,TargetGroup=targetgroup/xxx/xxx --account test-east --debug 1
{u'Datapoints': [{u'Timestamp': datetime.datetime(2018, 2, 23, 14, 53, tzinfo=tzlocal()), u'Average': 1.0, u'Unit': 'Count'}], 'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': 'bac77227-18aa-11e8-9283-2f5cf764a982', 'HTTPHeaders': {'x-amzn-requestid': 'bac77227-18aa-11e8-9283-2f5cf764a982', 'date': 'Fri, 23 Feb 2018 15:03:38 GMT', 'content-length': '497', 'content-type': 'text/xml'}}, u'Label': 'HealthyHostCount'}
1.0
Thanks!
@wawastein nothing with regards to ELBv2 support or a discovery script for this?
@Doodaz as I said in other issue, I currently don't have access to AWS environment with all these types of resources, I'm working mostly with Google Cloud nowadays. If in the future I get the access I'll probably go back and review this issue, hence not closed.
@Doodaz you can checkout PR #16 - post your comments on the same pull request.
Thanks a million @diegosainz will test it out ASAP! 👍
PR #16 merged - @Doodaz please verify if it works for you and if we can close the issue.
Hi, Will be that possible to get support for elbv2 http://boto3.readthedocs.io/en/latest/reference/services/elbv2.html#client
I'm not good at python. But I did notice the same on aws-cli on one account i have 3 ELB - one classic and two applications. In AWSCLI $ aws elb describe-load-balancers|jq ".LoadBalancerDescriptions[].LoadBalancerName"|wc -l 1 and I start to searching what is going on here, and the answer is $ aws elbv2 describe-load-balancers|jq ".LoadBalancers[].LoadBalancerArn"|wc -l 2
Please kindly notice that the out put is totally different.