Hello DataMiners,
Need to monitor AWS EC2 instance (mainly uptime) where CloudWatch driver is not an option.
So far the possibilities are:
• Using AWS SDK for .NET V3 API.
• Rest Call, using instance metadata endpoint "http://<aws>/latest/dynamic/instance-identity/document".
Uptime must be computed based on the time instances started.
Is there any early development or experiences using any of above approaches?
Thanks.
Sergio
Not aware of anything directly through the DataMiner for this at the moment.
Cloudwatch is best suited for the monitoring aspects of the AWS services, and you can also send the custom metrics of the EC2 instances (or other AWS services) to the CloudWatch as well. In your example, you need to define a custom metric for uptime as AWS doesn't provide this and get that metric integrated with the CloudWatch driver. New EC2 driver better suited if there is custom configuration and control you want to perform on the EC2 instances, rather than the monitoring.
I have used boto3 (python SDK) to calculate something similar. EC2 only publishes the launch time and this is the last restart time for the EC2 instance. So you have to calculate the uptime by using the current time and launch time.
DescribeInstance is the API method for this, DescribeInstances - Amazon Elastic Compute Cloud . Boto documentation for the same method is available at EC2 — Boto3 Docs 1.17.56 documentation (amazonaws.com) .
Hope that helps.
What would have been the drawback of polling an SNMP agent at OS layer?
E.g. through the Linux protocol? Or through a bespoke protocol, polling just one OID = Uptime ?
OS level metrics and host level metrics are different in the AWS services. CPU is shared between the EC2 instances when it comes to the physical resource, so the data available through the OS will not be accurate. However disk space used is only available through the OS, so you can pull that metric through OS or as a custom metric using the cloudwatch.
Please see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html for the list of metrics available through the cloudwatch.
I see, but what would make the actual difference when monitoring just the uptime? (Not CPU and other KPIs) – is that going to be different?
Thanks Srikanth.
Thinking long term resonates more developing a driver using the .NET SDK.
We now only need to compute uptime, but other use case might need extra EC2 control as you mention.