Is it possible to send AWS infrastructure metrics to QuestdB? - questdb

I have some infra on AWS and I was curious if there's an easy way of getting metrics into QuestDB so I can run some averages or aggregates on daily / weekly / monthly insights. What's interesting for me would be EC2 metrics, load balancer metrics, request count for a service, or other generic cloud resource metrics. Is there an API that I can use to grab these and load them through Python or similar?

Related

Can you upload historical metrics to Cloudwatch?

We use AWS Cloudwatch Metrics and the associated dashboards a lot. Sometimes we want to add a new visualisation, but now we can only find the metric from our first PutMetricData onwards. We however often have the data retrospectively, just not uploaded at the time.
Can you retrospectively upload metrics to Cloudwatch?

How to send Counter metrics of RDS's Performance insights to cloudwatch or Grafana

Hi Im trying to create alerts for My AWS services and i'm trying to collect the metrics like Aborted_connects,Aborted_clients,innodb_deadlocks for creating an alerts. I have enabled the performance insights and i can see the matrics in the performance insights page in RDS console. But only DBLoad,DBLoadCPU metrics are showing in cloudwatch. SO is there a way i can use these metrics to create an alerts from cloudwatch?
The rest of the metrics are in cloudwatch and Grafana.
How can i create alerts for the Counter metrics from Performance insights?
Thanks in Advance.

Send weekly performance metric(CPU,Memory,I/O,Network) reports for AWS resources(ec2, RDS)

I need to send weekly emails to my team for the complete performance metrics dashboard snapshot which includes CPU, Memory, I/O, Network graphs for the production server in AWS EC2,RDS database for the last week.
I prefer to use AWS CloudWatch Custom dashboard. However, i am not able to send automatic emails for Custom Dashboards on weekly basis.
Should i use AWS Cloud Watch or some other monitoring tool to achieve this task.
I have created AWS cloudwatch alerts but will only trigger email, if certain threshold reaches which will not serve my purpose as i need complete dashboard to be emailed to my team which includes CPU, Memory, Network for Web server, RDS..etc etc in the same email.
I created custom dashboard in Cloudwatch which displays graphs for Ec2 and RDS (CPU, Memory, Network..etc).
Is there a way to send Custom Dashboards in email
Expected Results: Setup a email notification ever week that send complete performance metric dashboard to my team members
I think no way to take snap and send the metrics in AWS.
This may help you...
If you need AWS CloudWatch console UI snapshot, Create Automation Script and configure it.
Way1:
Write automation script to get Statistics by using below awscli and get metrics by changing "--metric-name", "--start-time" and "--end-time".
Include sending mail in the script using this link
Configure CRON job and configure the script by running weekly basis.
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization \
--dimensions Name=InstanceId,Value=i-1234567890abcdef0 --statistics Maximum \
--start-time 2016-10-18T23:18:00 --end-time 2016-10-19T23:18:00 --period 360
Way 2:
create UI automation script to take snap using Selenium driver
Use this link for Console login and this link for Taking
screenshot.
Configure UI automation script in JOB1 and enable "Poll SCM" for daily run basis.
Create Jenkins JOB2 and enable "Poll SCM" for Weekly basis and add automation script as downstream project

How to setup Cloudwatch SQL monitor?

I have a view on a PostgreSQL RDS instance that lists any ongoing deadlocks. Ideally, there are no deadlocks in the database, causing the view to show nothing, but on rare occasions, there are.
How would I setup an alarm in Cloudwatch to query this view and raise an alarm if any records return?
I found the cool script on Github specifically for this:
A Serverless MySQL RDS Data Collection script to push Custom Metrics to CloudWatch on AWS
Basically, there are 2 main possibilities to publish any custom metrics on CloudWatch:
Via API
You can run it on a schedule on EC2 instance (AWS example) or as a lambda function (great manual with code examples)
With CloudWatch agent
Here is the pretty example for Monitor your Microsoft SQL Server using custom metrics with Amazon CloudWatch and AWS Systems Manager.
After all, you should set up CloudWatch alarms with Metric Math and relevant thresholds.
It is not possible to configure Amazon CloudWatch to look inside an Amazon RDS database.
You will need some code running somewhere that regularly runs a query on the database and sends a custom metric to Amazon CloudWatch.
For example, you could trigger an AWS Lambda function, or use cron on an Amazon EC2 instance to trigger a script.

AWS Cloudwatch monitoring for S3

Amazon Cloudwatch provides some very useful metrics for monitoring my EC2s, load balancers, elasticache and RDS databases, etc and allows me to set alarms for a whole range of criteria; but is there any way to configure it to monitor my S3s as well? Or are there any other monitoring tools (besides simply enabling logging) that will help me monitor the numbers of POST/GET requests and data volumes for my S3 resources? And to provide alarms for thresholds of activity or increased datastorage?
AWS S3 is a managed storage service. The only metrics available in AWS CloudWatch for S3 are NumberOfObjects and BucketSizeBytes. In order to understand your S3 usage better you need to do some extra work.
I have recently written an AWS Lambda function to do exactly what you ask for and it's available here:
https://github.com/maginetv/s3logs-cloudwatch
It works by parsing S3 Server side log files and aggregates/exports metrics to AWS Cloudwatch (CloudWatch allows you to publish custom metrics).
Example graphs that you will get in AWS CloudWatch after deploying this function on your AWS account are:
RestGetObject_RequestCount
RestPutObject_RequestCount
RestHeadObject_RequestCount
BatchDeleteObject_RequestCount
RestPostMultiObjectDelete_RequestCount
RestGetObject_HTTP_2XX_RequestCount
RestGetObject_HTTP_4XX_RequestCount
RestGetObject_HTTP_5XX_RequestCount
+ many others
Since metrics are exported to CloudWatch, you can easily set up alarms for them as well.
CloudFormation template is included in GitHub repo and you can deploy this function very quickly to gain visibility into your S3 bucket usage.
EDIT 2016-12-10:
In November 2016 AWS has added extra S3 request metrics in CloudWatch that can be enabled when needed. This includes metrics like AllRequests, GetRequests, PutRequests, DeleteRequests, HeadRequests etc. See Monitoring Metrics with Amazon CloudWatch documentation for more details about this feature.
I was also unable to find any way to do this with CloudWatch. This question from April 2012 was answered by Derek#AWS as not having S3 support in CloudWatch. https://forums.aws.amazon.com/message.jspa?messageID=338089
The only thing I could think of would be to import the S3 access logs to a log service (like Splunk). Then create a custom cloud watch metric where you post the data that you parse from the logs. But then you have to filter out the polling of the access logs and…
And while you were at it, you could just create the alarms in Splunk instead of in S3.
If your use case is to simply alert when you are using it too much, you could set up an account billing alert for your S3 usage.
I think this might depend on where you are looking to track the access from. I.e. if you are trying to measure/watch usage of S3 objects from outside http/https requests then Anthony's suggestion if enabling S3 logging and then importing into splunk (or redshift) for analysis might work. You can also watch billing status on requests every day.
If trying to guage usage from within your own applications, there are some AWS SDK cloudwatch metrics:
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/metrics/package-summary.html
and
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/metrics/S3ServiceMetric.html
S3 is a managed service, meaning that you don't need to take action based on system events in order to keep it up and running (as long as you can afford to pay for the service's usage). The spirit of CloudWatch is to help with monitoring services that require you to take action in order to keep them running.
For example, EC2 instances (which you manage yourself) typically need monitoring to alert when they're overloaded or when they're underused or else when they crash; at some point action needs to be taken in order to spin up new instances to scale out, spin down unused instances to scale back in, or reboot instances that have crashed. CloudWatch is meant to help you do the job of managing these resources more effectively.
To enable Request and Data transfer metrics in your bucket you can run the below command. Be aware that these are paid metrics.
aws s3api put-bucket-metrics-configuration \
--bucket YOUR-BUCKET-NAME \
--metrics-configuration Id=EntireBucket
--id EntireBucket
This tutorial describes how to do it in AWS Console with point and click interface.