amazon-cloudwatch

Use cloudwatch to determine if linux service is running

余生颓废 提交于 2019-12-13 12:07:46
问题 Suppose I have an ec2 instance with service /etc/init/my_service.conf with contents script exec my_exec end script How can I monitor that ec2 instance such that if my_service stopped running I can act on it? 回答1: You can publish a custom metric to CloudWatch in the form of a "heart beat". Have a small script running via cron on your server checking the process list to see whether my_service is running and if it is, make a put-metric-data call to CloudWatch. The metric could be as simple as

LWP::Protocol::https::Socket: connect: timeout error

对着背影说爱祢 提交于 2019-12-13 08:05:46
问题 I am trying to configure aws cloudwatch script for monitoring memory etc. While executing the script we get below error and I upgraded the perl package the LWP version is also latest as 6 but still script is failing with below error. I tried setting env variables as PERL_LWP_ENV_PROXY=1 and PERL_LWP_SSL_VERIFY_HOSTNAME=0 but still failing. Please help on this. [ec2-user@ip-10-175-82-195 aws-scripts-mon]$ sudo ./mon-put-instance-data.pl --mem-util --mem-used --mem-avail --aws-credential-file=.

Unable to monitor Free Disk Space for Windows Instances using Custom CloudWatch Metrics

冷暖自知 提交于 2019-12-13 07:58:49
问题 I have created a user and added the following inline policy to him. It reads the below piece : { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowAccessToSSM", "Effect": "Allow", "Action": [ "cloudwatch:PutMetricData", "logs:CreateLogGroup", "logs:CreateLogStream", "logs:DescribeLogGroups", "logs:DescribeLogStreams", "logs:PutLogEvents" ], "Resource": [ "*" ] } ] } Then, I have successfully monitored the Available Memory by making the following changes to the .json file : ... { "Id":

SQS Size growing even though messages deleted is equal to messages received

谁都会走 提交于 2019-12-13 07:36:37
问题 What can be the reason for number of messages in a SQS queue increasing if the number of messaged deleted is equal to number of messages received? 回答1: From Available CloudWatch Metrics for Amazon SQS - Amazon Simple Queue Service: NumberOfMessagesDeleted: Amazon SQS emits the NumberOfMessagesDeleted metric for every successful deletion operation that uses a valid receipt handle, including duplicate deletions. NumberOfMessagesReceived: The number of messages returned by calls to the

FilterPattern of FilterLogEvents does not pick the string explicitly

帅比萌擦擦* 提交于 2019-12-13 07:02:30
问题 With this code, and using the FilterLogEvents function I am getting the logs from Cloudwatch that match these parameters: { "endTime": number, "filterPattern": "string", "interleaved": boolean, "limit": number, "logGroupName": "string", "logStreamNames": [ "string" ], "nextToken": "string", "startTime": number } The code: response = self.cloudWatchLogs.filter_log_events(**kwargs) I defined filterPattern to be " ERROR " so that I can get all the error logs. My problem is that I get also other

How to retrieve AWS Cloudwatch metrics using AWSSDK.CloudWatch?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 05:06:00
问题 I'm trying to retrieve data about my load balancers using the AWSSDK.CloudWatch package, but having no luck in actually getting any values out of it. It seems no matter what, the Values property of the MetricData in the response is an empty array. AmazonCloudWatchClient client = new AmazonCloudWatchClient("MyAccessKeyId", "MySecretAccessKey", Amazon.RegionEndpoint.MyRegion); GetMetricDataRequest request = new GetMetricDataRequest() { StartTime = DateTime.UtcNow.AddHours(-12), EndTime =

Show Cloudwatch alarms in Grafana

喜夏-厌秋 提交于 2019-12-13 03:52:10
问题 I want to add a table that shows a list of AWS Cloudwatch alarms for a particular metric. I found this dashboard AWS SNS but that just shows number of SNS messages sent. Is there any way of querying specific Cloudwatch alarms? 回答1: No, current Grafana code and current CloudWatch API doesn't support it. Of course, you can code it on your own. 来源: https://stackoverflow.com/questions/54952667/show-cloudwatch-alarms-in-grafana

Create CloudWatch alarm on multiple SQS queues

白昼怎懂夜的黑 提交于 2019-12-12 19:25:07
问题 Suppose I have N EC2 instances in auto-scaling group, each of them is polling M SQS queues. How would I create an alarm on cumulative ApproximateNumberOfMessagesVisible across all SQS queues if possible? 回答1: There is no cumulative count of the visible messages metric available as of now. Here is how you can solve it, Create a Lambda/ cron job that can poll the queues, get ApproximateNumberOfMessages on each queue and update the total messages to a custom Cloudwatch Metric. QueueAttributes:

AWS CloudWatch to start/stop EC2 instances

╄→гoц情女王★ 提交于 2019-12-12 10:06:28
问题 Just looking the way to start/stop a AWS EC2 instance in case of CPU utilization increase or decrease on another EC2 instacne. I know there is service available Auto Scaling in AWS but I have a scenario where I can't take advantage of this service. So just looking if it is possible or anyone can help me on this. Just detailing the concern like suppose I have 2 EC2 instance on AWS account by name EC21 and EC22. By default, EC22 instance is stopped. Now I need to setup CloudWatch or any other

Trigger AWS lambda function after ECR event

荒凉一梦 提交于 2019-12-12 08:40:52
问题 I am trying to get an AWS Lambda function to run whenever a new image is pushed to an AWS container registry. I have created and tested the function which works fine. I have then created a simple CloudWatch event rule with the pattern: { "source": [ "aws.ecr" ] } which I believe will trigger on any event from ECR. The rule has a target of the lambda function. The problem is the function is not called when a new image is pushed to the registry (or deleted etc). Nothing appears in the