diff options
author | Kerim Gokarslan <kgokarsl@cisco.com> | 2017-10-11 10:52:03 -0700 |
---|---|---|
committer | Kerim Gokarslan <kgokarsl@cisco.com> | 2017-10-11 10:53:20 -0700 |
commit | 5d5b6edef2d6f7628c804ca2d1bdcbe5d11425b4 (patch) | |
tree | 9a7501e1b685440c4a4243a93a693f8019b1f91a | |
parent | 5511522fce8d3d394f2d9b73fbd910032f75f53d (diff) |
NFVBENCH-37 Read fluentd result tag from configuration file
Change-Id: I08489ffedf81c0ad20b70d198989453a29dcbed8
Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
-rw-r--r-- | nfvbench/cfg.default.yaml | 5 | ||||
-rw-r--r-- | nfvbench/nfvbench.py | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml index fee65cb..c26991c 100644 --- a/nfvbench/cfg.default.yaml +++ b/nfvbench/cfg.default.yaml @@ -375,6 +375,11 @@ fluentd: # log records logging_tag: + # by default (result_tag is empty) nfvbench results are not sent to fluentd + # to enable sending nfvbench results to fluentd, specify a valid fluentd tag name + # to be used for the results records, which is different than logging_tag + result_tag: + # IP address of the server, defaults to loopback ip: 127.0.0.1 diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py index f09af90..52fb57b 100644 --- a/nfvbench/nfvbench.py +++ b/nfvbench/nfvbench.py @@ -131,8 +131,8 @@ class NFVBench(object): """Prepares summary of the result to print and send it to logger (eg: fluentd)""" global fluent_logger sender = None - if fluent_logger: - sender = FluentLogHandler("resultnfvbench", + if self.config.fluentd.result_tag: + sender = FluentLogHandler(self.config.fluentd.result_tag, fluentd_ip=self.config.fluentd.ip, fluentd_port=self.config.fluentd.port) sender.runlogdate = fluent_logger.runlogdate @@ -467,7 +467,14 @@ def main(): result = json.load(json_data) if opts.user_label: result['config']['user_label'] = opts.user_label - print NFVBenchSummarizer(result, fluent_logger) + if config.fluentd.result_tag: + sender = FluentLogHandler(config.fluentd.result_tag, + fluentd_ip=config.fluentd.ip, + fluentd_port=config.fluentd.port) + sender.runlogdate = fluent_logger.runlogdate + print NFVBenchSummarizer(result, sender) + else: + print NFVBenchSummarizer(result, None) sys.exit(0) # show default config in text/yaml format |