From 6b1caa83cb4d3d7e9ea74a8a8c3d446c971cb2ec Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Thu, 18 Jul 2019 15:37:21 +0100 Subject: [PATCH] mgr/dashboard: Show iSCSI gateways status in the health page Fixes: https://tracker.ceph.com/issues/39028 Signed-off-by: Ricardo Marques --- src/pybind/mgr/dashboard/controllers/health.py | 13 +++++++++++-- .../app/ceph/dashboard/health/health.component.html | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/health.py b/src/pybind/mgr/dashboard/controllers/health.py index d2b232a6afa42..30d1e5285299a 100644 --- a/src/pybind/mgr/dashboard/controllers/health.py +++ b/src/pybind/mgr/dashboard/controllers/health.py @@ -6,9 +6,11 @@ import json from . import ApiController, Endpoint, BaseController from .. import mgr +from ..rest_client import RequestException from ..security import Permission, Scope from ..services.ceph_service import CephService from ..services.iscsi_cli import IscsiGatewaysConfig +from ..services.iscsi_client import IscsiClient class HealthData(object): @@ -121,8 +123,15 @@ class HealthData(object): return len(mgr.list_servers()) def iscsi_daemons(self): - gateways = IscsiGatewaysConfig.get_gateways_config()['gateways'] - return len(gateways) if gateways else 0 + up_counter = 0 + down_counter = 0 + for gateway_name in IscsiGatewaysConfig.get_gateways_config()['gateways']: + try: + IscsiClient.instance(gateway_name=gateway_name).ping() + up_counter += 1 + except RequestException: + down_counter += 1 + return {'up': up_counter, 'down': down_counter} def mgr_map(self): mgr_map = mgr.get('mgr_map') diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html index 4ac9b3421503a..8fe797e28c37c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html @@ -113,7 +113,10 @@ class="cd-status-card" contentClass="content-highlight" *ngIf="enabledFeature.iscsi && healthData.iscsi_daemons != null"> - {{ healthData.iscsi_daemons }} total + {{ healthData.iscsi_daemons.up + healthData.iscsi_daemons.down }} total + + {{ healthData.iscsi_daemons.up }} up, + {{ healthData.iscsi_daemons.down }} down -- 2.39.5