CloudWatch custom metrics not working as expected

橙三吉。 提交于 2019-12-11 05:57:12

问题


I had already created 7 other metrics based on some log files I send to CloudWatch with no problems.

Some time ago we had a problem with MongoDB connection, and I identified that through logs, so I'd like to create a Metric, so that I can create an Alarm based on it. I did create the Metric, but (of course) there are no data being fed into that Metic, because no more "MongoError" messages exists.

But does that also mean that I can't even access the Metric to create the Alarm? Because this is what is happening right now. The Metric cannot be seen anywhere, only in the "Filters" section of the Logs, which won't allow me to create Alarms or create graphics or anything.

I have already posted this on AWS forums but that usually doesn't help.


回答1:


An Amazon CloudWatch custom metric is only created when data is stored against the custom metric. Therefore, you'll need to push a data value to make appear and then you will be able to create an alarm.

You can push some data to CloudWatch with the AWS Command-Line Interface (CLI), eg:

aws cloudwatch put-metric-data --namespace MongoDB --metric-name errors --value 0


来源:https://stackoverflow.com/questions/44951213/cloudwatch-custom-metrics-not-working-as-expected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!