From: Rubab-Syed Date: Wed, 25 Oct 2017 02:41:51 +0000 (+0500) Subject: mgr/dashboard: add monitor listing X-Git-Tag: v13.0.2~550^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=01edf5e8ea21983f3796c75fcd83b7df0dd46b07;p=ceph.git mgr/dashboard: add monitor listing Signed-off-by: Rubab Syed --- diff --git a/src/pybind/mgr/dashboard/base.html b/src/pybind/mgr/dashboard/base.html index 742327079fcf..32638f2f56f2 100644 --- a/src/pybind/mgr/dashboard/base.html +++ b/src/pybind/mgr/dashboard/base.html @@ -346,7 +346,7 @@ Failed to load data from server Cluster health -
  • +
  • Cluster @@ -359,6 +359,9 @@ Failed to load data from server OSDs
  • +
  • + Monitors +
  • diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index e141d54bf325..40a018af66d9 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -66,7 +66,6 @@ def get_prefixed_url(url): return global_instance().url_prefix + url - class StandbyModule(MgrStandbyModule): def serve(self): server_addr = self.get_localized_config('server_addr', '::') @@ -768,6 +767,48 @@ class Module(MgrModule): content_data=json.dumps(self._servers(), indent=2) ) + @cherrypy.expose + def monitors(self): + template = env.get_template("monitors.html") + return template.render( + url_prefix = global_instance().url_prefix, + ceph_version=global_instance().version, + path_info=cherrypy.request.path_info, + toplevel_data=json.dumps(self._toplevel_data(), indent=2), + content_data=json.dumps(self._monitors(), indent=2) + ) + + @cherrypy.expose + @cherrypy.tools.json_out() + def monitors_data(self): + return self._monitors + + def _monitors(self): + in_quorum, out_quorum = [], [] + + counters = [ 'mon.num_sessions' + ] + + mon_status = global_instance().get_sync_object(MonStatus).data + for mon in mon_status["monmap"]["mons"]: + mon["stats"] = {} + for counter in counters: + data = global_instance().get_counter("mon", mon["name"], counter) + if data is not None: + mon["stats"][counter.split(".")[1]] = data[counter] + else: + mon["stats"][counter.split(".")[1]] = [] + if mon["rank"] in mon_status["quorum"]: + in_quorum.append(mon) + else: + out_quorum.append(mon) + + return { + 'mon_status': mon_status, + 'in_quorum' : in_quorum, + 'out_quorum': out_quorum, + } + def _servers(self): return { 'servers': global_instance().list_servers() diff --git a/src/pybind/mgr/dashboard/monitors.html b/src/pybind/mgr/dashboard/monitors.html new file mode 100644 index 000000000000..40a26551d4c6 --- /dev/null +++ b/src/pybind/mgr/dashboard/monitors.html @@ -0,0 +1,100 @@ + +{% extends "base.html" %} + +{% block content %} + + + + + +
    +

    + Monitors +

    +
    + + +
    +
    +
    +
    + + + + + + + + +

    Cluster ID:

    {mon_status.monmap.fsid}

    monmap modified:

    {mon_status.monmap.modified}

    monmap epoch:

    {mon_status.monmap.epoch}

    quorum con:

    {mon_status.features.quorum_con}

    quorum mon:

    {mon_status.features.quorum_mon}

    required con:

    {mon_status.features.required_con}

    required mon:

    {mon_status.features.required_mon}

    +
    +
    +
    +
    +

    IN QUORUM

    +
    + + + + + + + + + + + + + +
    NameRankPublic AddrOpen Sessions
    {mon.name}{mon.rank}{mon.public_addr}{ mon.stats.num_sessions | sparkline_data }
    +
    +
    +
    +
    +
    +

    NOT IN QUORUM

    +
    + + + + + + + + + + + +
    NameRankPublic Addr
    {mon.name}{mon.rank}{mon.public_addr}
    +
    +
    +
    + + +{% endblock %}