所以我得到一个在亚马逊云中build立的公司 – 创buildIAAS协议/解决scheme/标准化实施等,同时也是个人系统,应用程序环境和日常正常运行时间的系统pipe理员。
我遇到的最大的问题之一是跟踪各种系统/应用程序日志,以及logging/监控/存档系统度量,如内存使用情况,CPU使用情况等等。 例如 – > Nagios + Urchin。
我的努力最大的障碍是:
公司应用程序以Java * .WAR文件的forms部署,上传到Elastic BeanStalk应用程序环境,在3(min)和10(max)服务器之间进行负载均衡和自动扩展,运行应用程序的EC2是开火并处理特设。
也就是说,我无法长时间监控单独的EC2,因为很多terminal都被终止了,然后自动提供/自动缩放 – 所以我总是不得不“监视我正在监视的内容“,并不断删除/添加EC2机器地址到我的监控列表。
是否有某种方式使用像Zabbix或Nagios监视工具来监视ElasticBeanStalk,并自动添加新的EC2,并从监视列表中自动删除终止/失败的EC2?
此外,有什么我可以用GrayLog做些什么来实现类似的结果:将来自多个EC2实例的应用程序日志聚合/集中到一个统一的一组日志/事件中? 如果不是GrayLog,有没有像GrayLog那样可以自动检测到哪些EC2成员正在被添加/从环境中删除,并自动从中收集日志?
任何和所有的build议或方向表示赞赏。
非常感谢,欢呼!
如果要在弹性beanstalk上部署WAR,则可以通过在WEB-INF下的.ebextensions文件夹中创buildconfiguration文件来安装度量标准。 有关configuration和使用此实例的更多信息,请参阅以下链接: – http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
要安装磁盘/内存指标,您需要安装“适用于Linux的Amazon CloudWatch监控脚本” – 请参阅http://aws.amazon.com/code/8720044071969977
files: "/opt/aws/cwms/CloudWatchMonitoringScripts.zip": mode: "000777" owner: ec2-user group: ec2-user source: http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip container_commands: 01_unzip_cloud_watch_zip: command: unzip -d /opt/aws/cwms /opt/aws/cwms/CloudWatchMonitoringScripts.zip ignoreErrors: true 02_update_password_file: command: sed -i 's/Key=$/Key=<VALUE OF YOUR SECRET KEY>/;s/KeyId=$/KeyId=<VALUE OF YOUR ACCESS ID>/' /opt/aws/cwms/awscreds.conf 03_update_crontab: command: echo "*/1 * * * * /opt/aws/cwms/mon-put-instance-data.pl --mem-util --disk-path=/ --disk-space-util --from-cron" | crontab - -u ec2-user
基本上,这个脚本所做的就是将基于Linux的CloudWatchMonitoringScripts.zip下载到/ opt / aws / cwms文件夹(这可以在任何地方)。 然后解压文件,更新访问/密钥(使用“sed”命令),最后创buildcrontab标签。
请注意crontab选项卡部分,因为它可能会擦除现有的crontab条目。
更新(2016年2月)
这里有一个更新的脚本,在2016年2月相当适合我(请参阅http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-cw.html )。
sources: /opt/cloudwatch: http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip commands: 00-installpackages: command: yum install -y perl-Switch perl-Sys-Syslog perl-LWP-Protocol-https container_commands: 01-setupcron: command: | echo '* * * * * root perl /opt/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl `{"Fn::GetOptionSetting" : { "OptionName" : "CloudWatchMetrics", "DefaultValue" : "--mem-used --memory-units=megabytes --mem-util --disk-space-util --disk-space-used --disk-space-avail --disk-path=/" }}` >> /var/log/cwpump.log 2>&1' > /etc/cron.d/cwpump 02-changeperm: command: chmod 644 /etc/cron.d/cwpump 03-changeperm: command: chmod u+x /opt/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl option_settings: "aws:autoscaling:launchconfiguration" : IamInstanceProfile : "MonitorRole" "aws:elasticbeanstalk:customoption" : CloudWatchMetrics : "--mem-used --memory-units=megabytes --mem-util --disk-space-util --disk-space-used --disk-space-avail --disk-path=/"
注意:您必须具有一个名为MonitorRule的IAMangular色。 它的angular色策略应该如下(另见http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-cw.html):
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "cloudwatch:PutMetricData", "ec2:DescribeTags" ], "Effect": "Allow", "Resource": [ "*" ] } ] }
我们正在使用EC2,S3等,但还没有ElasticBeanStalk。 我可以给你一些build议和想法…
Cloudwatch:我们使用来自Amazon AWS的CloudWatch,它提供了关于我们的EC2实例的相当好的细节。 监控设置非常简单,GUI的东西..没有脚本或任何需要的东西。 Cloudwatch入门指南将提供有关CLI的大量信息,但是developerGuide会提供我们需要的确切信息: http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/AlarmThatSendsEmail.html http://docs.amazonwebservices。 COM / AmazonCloudWatch /最新/ DeveloperGuide / choosing_your_cloudwatch_interface.html
我在Amazon ElasticBeanStack论坛上发现了这个链接: http ://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/using-features.healthstatus.html
对于Elastic Beanstack的磁盘使用情况,可以启用RootFileSysmtemUtil云监视实例指标。 这在Elastic beanstalk的运行状况configuration部分下可用。 “健康”configuration下有一个“健康报告”部分。 请selectRootFileSysmtemUtil选项并保存configuration。
现在,如果您转到CloudWatch的ElasticBeanstack指标,则可以看到新的指标。