summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Salkeld <asalkeld@redhat.com>2013-07-29 22:50:32 +1000
committerAngus Salkeld <asalkeld@redhat.com>2013-07-31 10:58:39 +1000
commitcfa33e160bb8da389940b4239ac13cb81d5b8cdf (patch)
tree2ac65121d0e9760b92e383f610ef47ed2bc0a38f
parentb97fb83dc070cee1d12ea23b1cd7a99da42a6243 (diff)
downloadheat-cfntools-cfa33e160bb8da389940b4239ac13cb81d5b8cdf.tar.gz
Use the server tags for dimensions and make watch_name optional.
This allows us to stop creating templates with circular dependancies. So we can change: cfn-push-stats --watch {Ref: TheAlarm} to: cfn-push-stats This makes it closer to AWS and actually better as users can add their own dimensions via the tags. Change-Id: I365ae57c2275a2d064075eb1b3e14aa1e418d1ee
-rwxr-xr-xbin/cfn-push-stats11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/cfn-push-stats b/bin/cfn-push-stats
index d8aa3d9..1fdce9f 100755
--- a/bin/cfn-push-stats
+++ b/bin/cfn-push-stats
@@ -90,7 +90,7 @@ parser.add_argument('--haproxy-latency', required=False, action='store_true',
help='Reports HAProxy latency')
parser.add_argument('--heartbeat', required=False, action='store_true',
help='Sends a Heartbeat.')
-parser.add_argument('--watch', required=True,
+parser.add_argument('--watch', required=False,
help='the name of the watch to post to.')
parser.add_argument('--metric', required=False,
help='name of the metric to post to.')
@@ -252,10 +252,13 @@ def send_stats(info):
# contain multiple keys as the options parsed above are noe exclusive
# The alarm name is passed as a dimension so the metric datapoint can
# be associated with the alarm/watch in the engine
- metric_dims = [{'AlarmName': args.watch}]
+ metadata = cfn_helper.Metadata('not-used', None)
+ metric_dims = metadata.get_tags()
+ if args.watch:
+ metric_dims['AlarmName'] = args.watch
for key in info:
- LOG.info("Sending watch %s metric %s, Units %s, Value %s" %
- (args.watch, key, info[key]['Units'], info[key]['Value']))
+ LOG.info("Sending metric %s, Units %s, Value %s" %
+ (key, info[key]['Units'], info[key]['Value']))
client.put_metric_data(namespace=namespace,
name=key,
value=info[key]['Value'],