var refresh = function() {
$.get("/toplevel_data", function(data) {
- _.extend(toplevel_data.health, data.health);
+ _.extend(toplevel_data, data);
setTimeout(refresh, refresh_interval);
});
};
}
}
+ rivets.formatters.health_ok = function(status_str) {
+ if (status_str == "HEALTH_OK") {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
var truncate = function(n, max_width) {
var stringized = n.toString();
var parts = stringized.split(".");
<!--rivet.formatters.mon_summary = function(mon_map) {-->
<!--}-->
- rivets.bind($("#health"), toplevel_data.health);
+ rivets.bind($("#health"), toplevel_data);
rivets.bind($("section.sidebar"), toplevel_data);
setTimeout(refresh, refresh_interval);
});
<span class="sr-only">Toggle navigation</span>
</a>
- <div id="health" style="font-size: 20px; padding: 12px 12px;">
- Health:
- <span rv-style="overall_status | health_color">
- {overall_status}
+ <div id="health" style="font-size: 18px; padding: 12px 12px;">
+ <span rv-hide="health_status | health_ok" >
+ <span rv-style="health_status | health_color">
+ {health_status}
+ </span>
</span>
</div>
<!-- Main content -->
<section class="content">
- Overall status: <span rv-style="health.overall_status | health_color">{health.overall_status}</span>
+ <div class="box-body">
+ Overall status: <span rv-style="health.status | health_color">{health.status}</span>
<ul>
- <li rv-each-summary="health.summary">
- {summary.severity}: {summary.summary}
- </li>
+ <ul>
+ <li rv-each-check="health.checks">
+ <span rv-style="check.severity | health_color">{check.type}</span>:
+ {check.message}
+ </li>
+ </ul>
</ul>
<div class="row">
]
return {
- 'health': global_instance().get_sync_object(Health).data,
'rbd_pools': rbd_pools,
+ 'health_status': self._health_data()['status'],
'filesystems': filesystems
}
def servers_data(self):
return self._servers()
+ def _health_data(self):
+ health = global_instance().get_sync_object(Health).data
+ # Transform the `checks` dict into a list for the convenience
+ # of rendering from javascript.
+ checks = []
+ for k, v in health['checks'].iteritems():
+ v['type'] = k
+ checks.append(v)
+
+ checks = sorted(checks, cmp=lambda a, b: a['severity'] > b['severity'])
+
+ health['checks'] = checks
+
+ return health
+
def _health(self):
# Fuse osdmap with pg_summary to get description of pools
# including their PG states
del osd_map['pg_temp']
return {
- "health": global_instance().get_sync_object(Health).data,
+ "health": self._health_data(),
"mon_status": global_instance().get_sync_object(
MonStatus).data,
"osd_map": osd_map,