用于检查aws cloudwatch度量的nagios插件
nagios-cloudwatch-plugin的Python项目详细描述
此插件用于检查aws cloudwatch度量。它使用流行的boto 用于收集度量值的库此插件当前没有 直接提供aws凭据-为此,请咨询botodocs。
设置
pip安装nagios cloudwatch插件
/usr/local/bin/check_cloudwatch.py-h:
usage: check_cloudwatch.py [-h] -n NAMESPACE -m METRIC [-d DIMENSIONS] [-s {Average,Sum,SampleCount,Maximum,Minimum}] [-p PERIOD] [-l LAG] [-r] [--divisor-namespace DIVISOR_NAMESPACE] [--divisor-metric DIVISOR_METRIC] [--divisor-dimensions DIVISOR_DIMENSIONS] [--divisor-statistic {Average,Sum,SampleCount,Maximum,Minimum}] [--delta DELTA] [-w RANGE] [-c RANGE] [-v] [-R REGION] [-P profile_name] Nagios plugin to check cloudwatch metrics optional arguments: -h, --help show this help message and exit -n NAMESPACE, --namespace NAMESPACE namespace for cloudwatch metric -m METRIC, --metric METRIC metric name -d DIMENSIONS, --dimensions DIMENSIONS dimensions of cloudwatch metric in the format dimension=value[,dimension=value...] -s {Average,Sum,SampleCount,Maximum,Minimum}, --statistic {Average,Sum,SampleCount,Maximum,Minimum} statistic used to evaluate metric -p PERIOD, --period PERIOD the period in seconds over which the statistic is applied -l LAG, --lag LAG delay in seconds to add to starting time for gathering metric. useful for ec2 basic monitoring which aggregates over 5min periods -r, --ratio this activates ratio mode --divisor-namespace DIVISOR_NAMESPACE ratio mode: namespace for cloudwatch metric of the divisor --divisor-metric DIVISOR_METRIC ratio mode: metric name of the divisor --divisor-dimensions DIVISOR_DIMENSIONS ratio mode: dimensions of cloudwatch metric of the divisor --divisor-statistic {Average,Sum,SampleCount,Maximum,Minimum} ratio mode: statistic used to evaluate metric of the divisor --delta DELTA time in seconds to build a delta mesurement -w RANGE, --warning RANGE warning if threshold is outside RANGE -c RANGE, --critical RANGE critical if threshold is outside RANGE -v, --verbose increase verbosity (use up to 3 times) -R REGION, --region REGION The AWS region to read metrics from -P profile_name, --profile profile_name Profile name from ~/.aws/credentials
用法
cloudwatch度量
有关CloudWatch如何存储度量的信息,请查看doc
简单的EC2 CPU利用率检查,具有警告和临界阈值范围:
check_cloudwatch.py -R us-west-2 -n AWS/EC2 -m CPUUtilization -p 600 -d InstanceId=i-abcd1234 -w 0:75 -c 0:90
check_cloudwatch.py -R us-west-2 -n AWS/EC2 -m CPUUtilization -p 600 -d InstanceId=i-1bcd1234 -w 0:75 -c 0:90 -P dc-live
check_cloudwatch.py -R us-west-2 -n AWS/EC2 -m CPUUtilization -p 600 -d InstanceId=i-2bcd1234 -w 0:75 -c 0:90 -P dc-staging
简单的EC2 CPU利用率检查,具有警告和临界阈值范围:
check_cloudwatch.py -R us-west-2 -n AWS/EC2 -m CPUUtilization -p 600 -d InstanceId=i-abcd1234 -w 0:75 -c 0:90 check_cloudwatch.py -R us-west-2 -n AWS/EC2 -m CPUUtilization -p 600 -d InstanceId=i-1bcd1234 -w 0:75 -c 0:90 -P dc-live check_cloudwatch.py -R us-west-2 -n AWS/EC2 -m CPUUtilization -p 600 -d InstanceId=i-2bcd1234 -w 0:75 -c 0:90 -P dc-staging
释放量
0.2.7-2018年5月1日:添加了指定AWS凭证配置文件的选项。谢谢l13t
0.2.6-2014年10月23日:更新了自述示例,修复了输入错误。谢谢桑皮尔森!
0.2.5-2014年9月9日:支持将区域作为参数传递,默认为boto default。谢谢格雷厄姆里昂!
0.2.4-2013年11月20日:增加了对单个度量的增量监控的支持。感谢nesquick&skenke!
0.2.3-2013年11月20日:增加了对两个指标之间的监控比率的支持感谢nesQuick&skenke
开发
把我叉在Github上。