From 85dda1b0ebab75a8f9997a616cf1a759cad79558 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Mon, 9 Mar 2020 17:10:59 +0000 Subject: [PATCH] Check config file for hostname When sending an alert from the instancemonitor check the monitors config file for the hostname before sending the alert. Change-Id: If11aa1abb1142941d6dcd00c46063d9015644978 Closes-Bug: #1866638 --- .../instancemonitor/libvirt_handler/eventfilter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/masakarimonitors/instancemonitor/libvirt_handler/eventfilter.py b/masakarimonitors/instancemonitor/libvirt_handler/eventfilter.py index 6ba902b..4535fbf 100644 --- a/masakarimonitors/instancemonitor/libvirt_handler/eventfilter.py +++ b/masakarimonitors/instancemonitor/libvirt_handler/eventfilter.py @@ -20,6 +20,7 @@ from oslo_log import log as oslo_logging from oslo_utils import excutils from oslo_utils import timeutils +import masakarimonitors.conf from masakarimonitors.instancemonitor.libvirt_handler import callback from masakarimonitors.instancemonitor.libvirt_handler \ import eventfilter_table as evft @@ -27,6 +28,7 @@ from masakarimonitors.objects import event_constants as ec LOG = oslo_logging.getLogger(__name__) +CONF = masakarimonitors.conf.CONF class EventFilter(object): @@ -45,7 +47,7 @@ class EventFilter(object): """ noticeType = ec.EventConstants.TYPE_VM - hostname = socket.gethostname() + hostname = CONF.hostname or socket.gethostname() currentTime = timeutils.utcnow() # All Event Output if debug mode is on.