From 45daf229475d4059c8e128a09397d0b426bef932 Mon Sep 17 00:00:00 2001 From: Ernest Allen Date: Mon, 16 Oct 2017 08:41:49 -0400 Subject: [PATCH] DISPATCH-856 Add hostName to router entity --- python/qpid_dispatch/management/qdrouter.json | 4 ++++ python/qpid_dispatch_internal/management/agent.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json index c7dabc8e99..c3ec65f781 100644 --- a/python/qpid_dispatch/management/qdrouter.json +++ b/python/qpid_dispatch/management/qdrouter.json @@ -397,6 +397,10 @@ "type": "string", "description": "Software Version" }, + "hostName": { + "type": "string", + "description": "hostName of machine on which router is running" + }, "helloInterval": { "type": "integer", "default": 1, diff --git a/python/qpid_dispatch_internal/management/agent.py b/python/qpid_dispatch_internal/management/agent.py index cd5ec7d4a4..b752eb1e7f 100644 --- a/python/qpid_dispatch_internal/management/agent.py +++ b/python/qpid_dispatch_internal/management/agent.py @@ -63,6 +63,7 @@ """ import traceback, json, pstats +import socket from itertools import ifilter, chain from traceback import format_exc from threading import Lock @@ -241,6 +242,10 @@ def _identifier(self): return self.attributes.get('id') def create(self): + try: + self.attributes[u"hostName"] = socket.gethostbyaddr(socket.gethostname())[0] + except: + self.attributes[u"hostName"] = '' self._qd.qd_dispatch_configure_router(self._dispatch, self) def __str__(self):