Amazon CloudWatch - monitoring EBS volumes VolumeReadOps, VolumeWriteOps - amazon-web-services

I am interesting in adding CloudWatch for two specific stats on just a few named EBS volumes. The metrics specifically are VolumeReadOps and VolumeWriteOps. These do not show up by default under the volume graphs. My question is as follows:
Is it possible to have those graphs show up by default underneath all volumes graphs tab?
Is it possible to search volumes by tag/name when going to CloudWatch -> EBS? Do I really have to remember volumes by volume-id if I want to see some metrics?

You cannot add a custom metrics to cloud watch. But you can still monitor the VolumeReadIops and VolumeWriteIops using munin. I will give many other information like your app server performance, web server performance etc etc.

Related

Unable to understand GCP bill for Stackdriver Monitoring usage

We have implemented kube-state metrics (by following the steps mentioned in this article section 4.4.1 Install monitoring components) on one of our kubernetes clusters on GCP. So basically it created 3 new deployments node-exporter, prometheus-k8s and kube-state metrics on our cluster. After that, we were able to see all metrics inside Metric Explorer with prefix "external/prometheus/".
In order to check External metrics pricing, we referred to this link. Hence, we calculated the price accordingly but when we received the bill it's a shocking figure. GCP has charged a lot of amount but we haven't added any single metric in dashboard or not set monitoring for anything. From the ingested volume (which is around 1.38GB/day), it looks these monitoring tools do some background job (at specific time it reads some metrics or so) which consumed this volume and we received this bill.
We would like to understand how these kube-state metrics monitoring components work. Will it automatically get metrics data and increase the ingested volume and bill in such way or there is any mis-configuration in its setup?
Any guidance on this would be really appreciated!
Thank you.
By default, when implemented, kube-state-metrics exposes several metrics for events across your cluster:
If you have a number of frequently-updating resources on your cluster, you may find that a lot of data is ingested into these metrics which incurs high costs.
You need to configure what metrics you'd like to expose, as well as consult the documentation for your Kubernetes environment in order to avoid unexpected high costs.

How to setup cloudwatch alarm for beanstalk environment memory

I'm trying to setup the Cloudwatch Alarm for memory on all instances of an AWS Elastic Beanstalk environment. I've setup capability to get Memory usage on Cloudwatch using the following tutorial:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-cw.html
Now I want to setup an alarm that would trigger if the MemoryUtilization of any of these instances go beyond a certain threshold. I can select all and setup alert on each of those separately, but I want to make sure that even if Beanstalk scales up the cluster or swaps an instance, the alert doesn't have to be reconfigured.
Is there a way I can setup alarm for a condition where Instance Name = "env-name" and Metric is MemoryUtilization?
What I understand from your question are the following requirements:
You have multiple metrics and want to use a logical OR condition when configuring an alarm, e.g. (avg metric1 > x || avg metric2 > y) ==> set alarm state to ALARM
You want the alarm to consider new metrics as they become available when new instances are launched by elastic beanstalk during scale out.
You want old metrics to not be considered as soon as elastic beanstalk scales in.
I think this is currently not possible.
There is an ongoing discussion on aws discussion forums [1] which reveals that at least (1) is possible using Metric Math. The Metric Math feature supports max. 10 metrics.
Solution
What you need to do is, to create a single metric which transports the information whether the alarm should be triggered or not ('computed metric'). There are multiple ways to achieve this:
For complex metrics you could write a bash script and run it on an EC2 instance using cron. The script would first query existing metrics using a dimension filter ('list-metrics'), then gather each metric ('get-metric-data'), aggregate it and then push the computed metric data point ('put-metric-data').
If the metric is rather simple, you could try the aggregate option of the AWS put-metric-data script [2]:
option_settings:
"aws:elasticbeanstalk:customoption" :
CloudWatchMetrics : "--mem-util --mem-used --mem-avail --disk-space-util --disk-space-used --disk-space-avail --disk-path=/ --auto-scaling --aggregated"
The documentation for the aggregated option says:
Adds aggregated metrics for instance type, AMI ID, and overall for the region.
References
[1] https://forums.aws.amazon.com/thread.jspa?threadID=94984
[2] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html#put-metric-data
In the Elastic Beanstalk console for your environment:
Click the Monitoring link in the left-hand side navigation links.
Underneath the Overview, in the Monitoring section, click the Edit button.
Choose AWSEBAutoScalingGroup for the Resource.
Choose MemoryUtilization under CloudWatch Metric.
Modify Statistic and Description as desired.
Click the Add button, and then click the Save button in the Monitoring section.
Scroll down to find the new panel that was added. Click the bell icon in the upper right hand corner of the panel. This will take you to the settings to set up a new alarm.
If you do not see the MemoryUtilization metric available, verify that you have correctly set up the collection of the memory metrics.
Cloudwatch cannot create alarms in a generic way. There are only 2 ways to accomplish the task.
1) Create a startup script in your AMI. When a new instance is launched, it is responsible for its own Cloudwatch alarms. I used this a long time ago, and the approach is solid. However, running scripts on termination isn't reliable, so you'll have to periodically clean out the old alarms.
2) Use a tool that has decent capabilities (ahem.... not Cloudwatch). I recommend Blue Matador. With them, you don't even have to setup the alarms or thresholds, the machine learning automatically baselines your resources and creates alerts for you.
If you got here and don't know Beanstalk or Cloudwatch well enough to contribute, start here: How to Monitor AWS Elastic Beanstalk with CloudWatch

How to get usage details of AWS EBS service?

My team got billing for AWS EBS and we have no idea what is it about.
Going to our console and try to open EBS section though we failed to get one as the snapshots below.
So my question is how to get breakdown details on AWS EBS usage billing?
p.s.
The EBS usage cost is viewed under EC2 section in billing tab in the management console
EBS is under EC2 in the AWS Management Console. If you look at the size of your volumes, the type of volumes and also the size of your snapshots that should help identify the cost.
E.g. faster volumes types, provisioned IOPS, large volumes/snapshots are more expensive.
You can put this information into the AWS Simple Montly Calculator to work out the cost https://calculator.s3.amazonaws.com/index.html
You can also look at the usage in CloudWatch, however it's under EBS there and shows per volume statistics.
For AWS billing you can use cost explorer for generating handsome reports.
Billing Break-Down:
In aws they have grouped multiple offerings under one service. For ex: EBS, ELB, EIP all grouped under EC2.
Same when they provide billing breakdown they provide it on service basis then region basis and then offering.
If you want better breakdown best way is to use cost tags and cost explorer.
Like in your case you can give your service_tag = ebs and application_tag = app1.
Then by using cost explorer : filter_by = app_tag and region and etc. and group_by = service_tag. By performing multiple combinations you can get a clear view of your cost and usage.

AWS realtime visualization

Are there any tools out there that would allow me to visualize my AWS instances in real-time ? For example, if I'm using auto-scaling I would be able to see the load on each instance and the scaling in real-time.
The Amazon EC2 management console has a Monitoring tab that provides graphs for CPU, Network and Disk metrics.
You can select multiple instances to view them all on one chart. Click the chart to make it bigger.
Similar statistics are available in the Amazon CloudWatch management console.
See documentation: Graph Metrics for Your Instances

Monitor Volume Size on Amazon EBS volume

I was wondering if it is possible to automatically monitor the usage percentage on a EBS volume in aws (the volume I wish to monitor is attached to a instance). Perhaps this can be done with alarms in cloudwatch? For example, I need to be alerted if the volume usage percentage reaches 95%. Any ideas?
Amazon won't do this for you - from their point of view an EBS volume is just a bunch of blocks
In the past I've done this by writing a script (run via a cronjob) that checked the amount of free space on the volume and posted it to cloudwatch (which was setup to trigger an alarm past a certain threshold).
Amazon also provide such a script
AWS provide a perl script which can be used to create CW alerts/metrics as detailed here
https://serverfault.com/questions/439928/making-alarm-in-disk-space-using-cloudwatch
An update on this question.
All the answers are now outdated and the links posted show deprecated procedures.
The new way to get disk usage in EC2, is to use the unified cloudwatch agent which has pre-built capabilities to extract metrics from EC2, if configured correctly.
You can follow the instruction from these docs: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html
Now you can actually create a cloudwatch alarm and find the EBS Volume and create a metric using freeDiskSpace and have it send notifications to the SNS.