From: Ricardo Marques Date: Thu, 18 Jul 2019 14:37:21 +0000 (+0100) Subject: mgr/dashboard: Show iSCSI gateways status in the health page X-Git-Tag: v15.1.0~2164^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6b1caa83cb4d3d7e9ea74a8a8c3d446c971cb2ec;p=ceph.git mgr/dashboard: Show iSCSI gateways status in the health page Fixes: https://tracker.ceph.com/issues/39028 Signed-off-by: Ricardo Marques --- diff --git a/src/pybind/mgr/dashboard/controllers/health.py b/src/pybind/mgr/dashboard/controllers/health.py index d2b232a6afa4..30d1e5285299 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 4ac9b3421503..8fe797e28c37 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