System Operations - Lab 4: Monitoring with CloudWatch (Linux) - 2.5
================================================================================================================== Using this command reference. ================================================================================================================== 1. Locate the section you need. Each section in this file matches a section in the lab instructions. 2. Replace items in angle brackets - < > - with appropriate values. For example, in this command you would replace the value - <JobFlowID> - (including the brackets) with the parameter indicated in the lab instructions: elastic-mapreduce --list <JobFlowID>. You can also use find and replace to change bracketed parameters in bulk. 3. Do NOT enable the Word Wrap feature in Windows Notepad or the text editor you use to view this file. ++++1. Create Your Web Server++++ ==================================================================================================================
1.1 Create IAM Policy
================================================================================================================== 1.1.5 Use the following custom policy {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"autoscaling:Describe*",
"cloudwatch:*",
"logs:*",
"sns:*"
],
"Effect": "Allow",
"Resource": "*"
}
]
} ==================================================================================================================
1.4 Create Web Server
================================================================================================================== 1.4.1 Review the user data script #!/bin/bash
yum -y update
yum -y install httpd php
chkconfig httpd on
/etc/init.d/httpd start mkdir /var/awslogs
mkdir /var/awslogs/state yum -y install awslogs cat > /etc/awslogs/awslogs.conf <<EOF
[general]
state_file = /var/awslogs/state/agent-state [HttpAccessLog]
file = /var/log/httpd/access_log
log_group_name = HttpAccessLog
log_stream_name = {instance_id}
datetime_format = %b %d %H:%M:%S [HttpErrorLog]
file = /var/log/httpd/error_log
log_group_name = HttpErrorLog
log_stream_name = {instance_id}
datetime_format = %b %d %H:%M:%S
EOF REGION=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -n 's/.$//p')
sed -i "s/us-east-1/$REGION/g" /etc/awslogs/awscli.conf service awslogs start
chkconfig awslogs on ++++2. Define CloudWatch Log Metrics++++ ==================================================================================================================
2.2 Create a CloudWatch Logs-Derived Metric
================================================================================================================== 2.2.4 Paste the following filter pattern into the Filter Pattern text box [ip, id, user, timestamp, request, status_code=404, size] ++++3. Generate a Custom Metric from an Instance++++ ==================================================================================================================
3.3 Generate HTTPd Memory Usage Metric
================================================================================================================== 3.3.1 Obtain current memory utilization of all HTTPd instances mem=$(ps -C httpd -O rss | gawk '{ count ++; sum += $2 }; END {count --; print sum/1024 ;};') 3.3.2 Verify $mem echo $mem 3.3.3 Retrieve the instance ID of the current instance instance_id=$(curl -s -w '\n' http://169.254.169.254/latest/meta-data/instance-id) 3.3.4 Verify $instance_id echo $instance_id 3.3.5 Define your custom metric aws cloudwatch put-metric-data --namespace HttpServerMetrics --metric-name HttpServerMemUtilization --dimension InstanceId=$instance_id --value $mem --unit "Megabytes" 漏 2016 Amazon Web Services, Inc. or its affiliates. All rights reserved.

Lab_4_SysOps_Monitoring_Linux_v2.5的更多相关文章

随机推荐

  1. HDU 3062 && HDU 1824 && POJ 3678 && BZOJ 1997 2-SAT

    一条边<u,v>表示u选那么v一定被选. #include <iostream> #include <cstring> #include <cstdio> ...

  2. system_call中断处理过程分析

    本文所有的分析内容都是基于Linux3.18.6内核,鉴于对应不同内核版本,系统调用的实现不相同.若需要分析其他版本内核的系统调用的实现过程,请谨慎参考. system_call函数的功能是用来响应外 ...

  3. 最全的运营推广方案,教你如何从零开始运营APP

    转载自:最全的运营推广方案,教你如何从零开始运营APP(http://www.kusocial.com/9319 ) 最全的运营推广方案,教你如何从零开始运营APP 2014-10-07 • 运营 • ...

  4. Largest Rectangle in Histogram

    Given n non-negative integers representing the histogram's bar height where the width of each bar is ...

  5. forEach遍历数组实例

    forEach()取出数组中2的倍数和3的倍数的数 //for IE if(!Array.prototype.forEach){ Array.prototype.forEach = function( ...

  6. TCP SYN扫描学习笔记

    1.TCP SYN包扫描主机状态的原理:tcp协议规定,当目标主机收到一个tcp syn 包时,若目标主机处于开放状态,会返回给源主机一个tcp ack 包(目的端口开放),或者向源主机发送一个tcp ...

  7. icmp_ping学习笔记

    1.用字符串指针做为发送缓冲区和接收缓冲区的指针: 2.icmp报文类型结构体可自行定义,也可用<netinet/ip_icmp.h>中定义好的strcut icmp结构体: 3.ip_h ...

  8. MyEclipse XFire Web Service

    我们在做系统集成时,经常会需要调用webservice接口,本文将讲解在myeclipse中建立一个webservice项目,编写接口和实现类, 并且发布webservice,最后在myeclipse ...

  9. Android Studio使用教程-菜单(Edit)

    3.2.1.Undo(Ctrl+Z) 撤销上一次操作 3.2.2.Redo(Ctrl+Shift+Z) 退出撤销操作 3.2.3.Cut(Ctrl+X) 剪切 3.2.4.Copy(Ctrl+C) 复 ...

  10. Ext.Window 的常见属性

    Ext.Window 的常见属性:    plain:true,(默认不是)    resizable:false,(是否可以改变大小,默认可以)    maximizable:true,(是否增加最 ...