Lab_4_SysOps_Monitoring_Linux_v2.5
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的更多相关文章
随机推荐
- HSLA颜色
CSS2中色彩模式只有RGB色彩模式(RGB即RED.Green.BLue)和十六进制模式,为了能支持 透明opacity 的Alpha值,CSS3又增加了RGBA色彩模式(RGBA即RED.Gree ...
- MyEclipse 10.7.1 最新版官网下载地址
MyEclipse 10.7.1(Windows): http://downloads.myeclipseide.com/downloads/products/eworkbench/indigo/in ...
- 鼠标焦点变化引起mouseout事件
做了个小手术,渐渐回归网络啦! 问题: 在自制的提示离鼠标太近时,会引起无法提示的功能. 自制提示离图片太近时,提示图片一直一闪一闪的,截图截不出来,就只放改善后的图片(不闪). 原因: 为什么呢?书 ...
- Android倒计时:计算两个时间将得到的时间差转化为倒计时(xx时xx分xx秒格式)
首先是一个自定义控件: public class RushBuyCountDownTimerView extends LinearLayout { // 小时,十位 private TextView ...
- Neo4j 查询已经创建的索引与约束
在Neo4j 2.0之后为cypher语法增加了一些类似于DDL的语法,能够自己创建索引,约束等等. 有如下的方法可以查询到当前图数据库的索引数量: neo4j-shell 使用:index –ind ...
- git命令大全
git init # 初始化本地git仓库(创建新仓库)git config --global user.name "xxx" ...
- Android.os.NetworkOnMainThreadException
出现Android.os.NetworkOnMainThreadException错误提示的原因原因:不允许在主线程中进行网络访问解决办法:将网络访问的操作单独放到一个线程中
- LeetCode() Merge Intervals 还是有问题,留待,脑袋疼。
感觉有一点进步了,但是思路还是不够犀利. /** * Definition for an interval. * struct Interval { * int start; * int end; * ...
- ubuntu 14.04安装 ruby on rails
安装完成ubuntu14.04以后 第一步: 1.sudo apt-get update 2.sudo apt-get upgrade 第二步: RVM 安装 $ gpg --keyserver ...
- Oracle、MySql、SQLServer数据分页查询
看过此博文后Oracle.MySql.SQLServer 数据分页查询,在根据公司的RegionRes表格做出了 SQLserver的分页查询语句: 别名.字段 FROM( SELECT row_nu ...