zoukankan      html  css  js  c++  java
  • AWS上获取监控数据(EC2/RDS都支持)

    方法1:mon-cmd

    http://docs.aws.amazon.com/zh_cn/AmazonCloudWatch/latest/cli/SetupCLI.html(安装连接)
    ● Step 1: Install the CLI
    ● Step 2: Configure the CLI for Your Credentials
    ● Step 3: Set the Region
    ● Step 4: Test Your CLI Configuration


    安装过程:

    一、安装java(1.5以上)

    安装包:jre-8u-linux-x64.rpm
    export JAVA_HOME=/usr/java/jre1.8.0_131/
    export PATH=$PATH:$JAVA_HOME/bin

    二、安装cloudwatch

    1、下载CloudWatch-2010-08-01.zip包
    export AWS_CLOUDWATCH_HOME=/usr/local/src/aws/CloudWatch-1.0.20.0
    export PATH=$PATH:$AWS_CLOUDWATCH_HOME/bin


    2、修改credential-file-path.template 文件
    cat CloudWatch-1.0.20.0/credential-file-path.template
    AWSAccessKeyId=
    AWSSecretKey=

    3、set the region

    export AWS_CLOUDWATCH_URL=http://monitoring.us-west-1.amazonaws.com/

    4、测试命令

    venv) [root@virtul-test-xq aws]# mon-【tab】
    mon-cmd mon-describe-alarms-for-metric.cmd mon-put-data
    mon-cmd.cmd mon-disable-alarm-actions mon-put-data.cmd
    mon-delete-alarms mon-disable-alarm-actions.cmd mon-put-metric-alarm
    mon-delete-alarms.cmd mon-enable-alarm-actions mon-put-metric-alarm.cmd
    mon-describe-alarm-history mon-enable-alarm-actions.cmd mon-set-alarm-state
    mon-describe-alarm-history.cmd mon-get-stats mon-set-alarm-state.cmd
    mon-describe-alarms mon-get-stats.cmd mon-version
    mon-describe-alarms.cmd mon-list-metrics mon-version.cmd
    mon-describe-alarms-for-metric mon-list-metrics.cmd


    (venv) [root@virtul-test-xq aws]# mon-get-stats DatabaseConnections --dimensions="DBInstanceIdentifier=*******" --statistics= Average --namespace="AWS/RDS" --start-time 2017-06-21T09:00:00 --end-time 2017-06-21T12:00:00 --I ******** --S ******* --period 600
    2017-06-21 09:00:00 30.0 Count
    2017-06-21 09:10:00 30.0 Count
    2017-06-21 09:20:00 30.0 Count
    2017-06-21 09:30:00 29.1 Count
    2017-06-21 09:40:00 29.0 Count
    2017-06-21 09:50:00 29.0 Count

    注意这里的时间参数:

    The timestamp of the first datapoint to return, inclusive. For example,
    2009-11-25T19:00:00+00:00Z. Timestamp will be rounded down to the nearest
    minute. The dateTime type uses ISO 8601 (UTC). The default for this is 1
    hour in the past.


    参考连接:
    Amazon RDS 指标
    http://docs.aws.amazon.com/zh_cn/AmazonRDS/latest/UserGuide/CHAP_Monitoring.html#USER_Monitoring
    Amazon RDS 指标和维度
    http://docs.aws.amazon.com/zh_cn/AmazonCloudWatch/latest/monitoring/rds-metricscollected.html
    boto3参考手册
    https://boto3.readthedocs.io/en/latest/guide/cw-example-metrics.html
    region地区查询
    http://docs.aws.amazon.com/zh_cn/general/latest/gr/rande.html#cw_region
    Amazon CloudWatch 工具下载
    https://aws.amazon.com/items/2534
    java下载地址
    https://www.java.com/zh_CN/download/manual.jsp
    一个不错的监控工具
    https://app.datadoghq.com/account/settings#integrations

    grafana监控aws
    http://docs.grafana.org/features/datasources/cloudwatch/

    PS:本文纯属记录个人实践经历,如有问题,可随时联系我。QQ505711559

  • 相关阅读:
    laravel 文件上传总结
    报错:SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admin' for key 'username'...
    php下intval()和(int)转换使用与区别
    js向input的value赋值
    北京ArcGis Server开发培训例子(整理)
    C#中Tostring参数机用法详解(转)
    ArcGIS Server 10 服务器要求
    arcgis10 arcmap mxd文档所有保存为相对路径
    google map api简单例子1 定位预览
    ASTER GDEM简介 30m,dem免费下载
  • 原文地址:https://www.cnblogs.com/skyflask/p/7065151.html
Copyright © 2011-2022 走看看