diff options
author | mbeierl <mark.beierl@emc.com> | 2015-10-07 19:19:11 -0700 |
---|---|---|
committer | Mark Beierl <mark.beierl@emc.com> | 2015-10-15 18:51:41 +0000 |
commit | 003e39f7afa940febcb93a6b16b86893c5dd97db (patch) | |
tree | 8ae69fc6bd29b67387624795c57e5e63f0c23c2f | |
parent | 2313923abdffd35bb6644956355617999f1a5f06 (diff) |
Creation of emitters
JIRA: STORPERF-7
Change-Id: I0a34af62ef850c9fc3e117b5c53283fc8d17561f
Signed-off-by: mbeierl <mark.beierl@emc.com>
-rw-r--r-- | storperf/carbon/emitter.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/storperf/carbon/emitter.py b/storperf/carbon/emitter.py new file mode 100644 index 0000000..1a3f89b --- /dev/null +++ b/storperf/carbon/emitter.py @@ -0,0 +1,28 @@ +############################################################################## +# Copyright (c) 2015 EMC and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import socket + +class CarbonMetricTransmitter(): + + carbon_host = '127.0.0.1' + carbon_port = 2003 + + def __init__(self): + pass + + def transmit_metrics(self, metrics): + self.carbon_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.carbon_socket.connect((self.carbon_host, self.carbon_port)) + + for key, metric in metrics.items(): + message = key + " " + metric + "\n" + self.carbon_socket.send(message) + + self.carbon_socket.close() |