Check if MON can resolve a grafana service.
This is currently useful in the transition to K8s,
or in OSM distros with absent Grafana.
Fixes Bug 932
Change-Id: I3b5ebf3d8ee3397f16793cd730e7e1fa5f6676d4
Signed-off-by: lavado <glavado@whitestack.com>
##
import logging
import time
-
+import socket
import peewee
from osm_mon.dashboarder.service import DashboarderService
def dashboard_forever(self):
log.debug('dashboard_forever')
while True:
+ try:
+ socket.gethostbyname("grafana")
+ log.debug("Dashboard backend is running")
+ except socket.error:
+ log.debug("Dashboard backend is not available")
+ time.sleep(int(self.conf.get('dashboarder', 'interval')))
+ continue
try:
self.create_dashboards()
time.sleep(int(self.conf.get('dashboarder', 'interval')))