diff --git a/pymod/metrictoqueue.py b/pymod/metrictoqueue.py index 0f4c909..9e512e1 100644 --- a/pymod/metrictoqueue.py +++ b/pymod/metrictoqueue.py @@ -30,15 +30,15 @@ def build_msg(args, *headers): timestamp, service, hostname, metric, status, nagioshost = headers - msg.header.update({'timestamp': timestamp.encode('utf-8')}) - msg.header.update({'service': service.encode('utf-8')}) - msg.header.update({'hostname': hostname.encode('utf-8')}) - msg.header.update({'metric': metric.encode('utf-8')}) - msg.header.update({'status': status.encode('utf-8')}) - msg.header.update({'monitoring_host': nagioshost.encode('utf-8')}) + msg.header.update({'timestamp': timestamp}) + msg.header.update({'service': service}) + msg.header.update({'hostname': hostname}) + msg.header.update({'metric': metric}) + msg.header.update({'status': status}) + msg.header.update({'monitoring_host': nagioshost}) for bs in ['summary', 'message', 'vofqan', 'voname', 'roc', 'actual_data', 'site']: - code = "msg.body += '%s: ' + args.%s.encode(\'utf-8\') + '\\n' if args.%s else ''" % (bs, bs, bs) + code = "msg.body += '%s: ' + args.%s + '\\n' if args.%s else ''" % (bs, bs, bs) exec code msg.text = True diff --git a/pymod/publish.py b/pymod/publish.py index 16ab165..ea55b9a 100644 --- a/pymod/publish.py +++ b/pymod/publish.py @@ -127,7 +127,7 @@ def _extract_body(self, body, fields, maps=None): if maps and key in maps: key = maps[key] - msg[key] = value.decode('utf-8', 'replace') + msg[key] = value return msg