Reputation: 1161
I am in the process of publishing several custom metrics for CloudWatch.
When the metrics are on my own namespace, all goes well.
I now want to publish a per-instance metric, similar to CPUUtilization
, with dimensions ImageId=i-XXXXXXXX
, in the AWS/EC2
namespace.
Unfortunately, CloudWatch disagrees with me and gives me this error:
"The value AWS/ for parameter Namespace is invalid."
many thanks,
Upvotes: 3
Views: 2903
Reputation: 6774
I've done it by
aws cloudwatch put-metric-data --namespace AWS/EC2 --dimensions \
InstanceID=$inst_id --metric-name test-sessions --value $cnt
The problem is the value is put not in Per-Instance Metrics
but nearby and idk how to fix that:
Upvotes: 0
Reputation: 19975
I was trying to figure this one our for myself. Issue like the namespaces/metricnames/dimensions not being defined well in the docs left me searching around for a bit.
Here is the script I was using, and at the detailed writeup, you can see the explication for what the terms mean and why things were done the way they were. I hope it helps others get this setup :)
Detailed Writeup with examples/pictures/charts
#setup variables
export AWS_CLOUDWATCH_HOME=/home/myuser/cloudwatch/CloudWatch-1.0.12.1
export JAVA_HOME=/usr/lib/jvm/jre1.6.0_33
export AWS_CREDENTIAL_FILE=$AWS_CLOUDWATCH_HOME/credential-file-path.template
# get free memory and send to AWS CloudWatch
FREEMEMKB=$(egrep -Eio "MemFree:\s*([0-9]*)" /proc/meminfo | egrep -Eio "[0-9]*")
echo `/home/myuser/cloudwatch/CloudWatch-1.0.12.1/mon-put-data --namespace="MySite" --metric-name=FreeMemory --dimensions="InstanceId=i-d889e31d" --unit=Kilobytes --value=$FREEMEMKB`
Upvotes: 1
Reputation: 348
The AWS/EC2 namespace is reserved for EC2 published metrics, so it's not possible. I'm sure I read it in the documentation but I can't find the source today.
Check the last post in this thread: https://forums.aws.amazon.com/thread.jspa?threadID=86835
Upvotes: 5