3
votes

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."

  • How do I add a custom metric to a specific instance?
  • Is this possible at all?

many thanks,

2

2 Answers

4
votes

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

1
votes

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`