Merge in bug24196

This commit is contained in:
Simon MacMullen 2012-04-24 13:39:14 +01:00
commit 3808438994
6 changed files with 118 additions and 15 deletions

View File

@ -11,7 +11,7 @@
table { border-collapse: collapse; }
table th, table td { vertical-align: top; border: 1px solid #bbb; padding: 5px; }
code { background: #ffa; }
pre { background: black; color: #0f0; padding: 10px; }
pre { background: black; color: #0f0; padding: 10px; word-wrap: break-word;}
table pre { background: #ffa; color: black; }
</style>
</head>
@ -49,6 +49,10 @@
nested component of the listed items; it does not allow you to
sort by more than one field. See the example below.</p>
<p>You can also restrict what information is returned per item
with the <code>columns</code> parameter. This is a comma-separated
list of subfields separated by dots. See the example below.</p>
<h2>Examples</h2>
<p>A few quick examples, using the Unix command line
@ -67,8 +71,9 @@ Content-Length: 5
[{"name":"/"}]</pre>
</li>
<li>
Get a list of channels, fast publishers first:
<pre>$ curl -i -u guest:guest 'http://localhost:55672/api/channels?sort=message_stats.publish_details.rate&amp;sort_reverse=true'
Get a list of channels, fast publishers first, restricting the info
items we get back:
<pre>$ curl -i -u guest:guest 'http://localhost:55672/api/channels?sort=message_stats.publish_details.rate&amp;sort_reverse=true&amp;columns=name,message_stats.publish_details.rate,message_stats.deliver_get_details.rate'
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Tue, 12 Oct 2010 10:03:21 GMT

View File

@ -22,7 +22,7 @@ function fmt_bytes(bytes) {
var num_power = f(bytes, 0);
var num = num_power[0];
var power = num_power[1];
var powers = ['B', 'kB', 'MB', 'GB', 'TB'];
var powers = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
return (power == 0 ? num.toFixed(0) : num.toFixed(1)) + powers[power];
}
@ -329,10 +329,17 @@ function fmt_idle_long(obj) {
}
function fmt_escape_html(txt) {
return fmt_escape_html0(txt).replace(/\n/g, '<br/>');
}
function fmt_escape_html_one_line(txt) {
return fmt_escape_html0(txt).replace(/\n/g, '');
}
function fmt_escape_html0(txt) {
return txt.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\n/g, '<br/>')
.replace(/\"/g, '&quot;');
}

View File

@ -70,6 +70,11 @@ HELP = {
incoming network traffic until the memory usage drops below \
the watermark.',
'disk-free-alarm':
'The disk free space alarm for this node has gone off. It will block \
incoming network traffic until the amount of free space exceeds \
the limit.',
'message-get-requeue':
'<p>Clicking "Get Message(s)" will consume messages from the queue. \
If requeue is set the message will be re-added to the queue, \
@ -175,4 +180,4 @@ HELP = {
function help(id) {
show_popup('help', HELP[id]);
}
}

View File

@ -33,8 +33,6 @@
</div>
</td>
</tr>
</table>
<table class="facts">
<tr>
<th>
Erlang processes
@ -47,6 +45,8 @@
</div>
</td>
</tr>
</table>
<table class="facts">
<tr>
<th>
Memory
@ -66,6 +66,28 @@
<sub><%= fmt_bytes(node.mem_limit) %> high watermark</sub>
<% } else { %>
<%= fmt_bytes(node.mem_used) %>
<% } %>
</td>
</tr>
<tr>
<th>
Disk space
</th>
<td class="status">
<% if (node.disk_free_limit != 'disk_free_monitoring_disabled') { %>
<% if (node.disk_free_alarm) { %>
<div class="red">
<%= fmt_bytes(node.disk_free) %>
<span class="help" id="disk-free-alarm"></span>
</div>
<% } else { %>
<div class="green">
<%= fmt_bytes(node.disk_free) %>
</div>
<% } %>
<sub><%= fmt_bytes(node.disk_free_limit) %> low watermark</sub>
<% } else { %>
(not monitored)
<% } %>
</td>
</tr>

View File

@ -1,5 +1,51 @@
<h1>Overview</h1>
<div class="updatable">
<%
var rabbit_version = 'unknown';
var erlang_version = 'unknown';
var version_warning = false;
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var r = fmt_rabbit_version(node.applications);
var e = node.erlang_version;
if (rabbit_version == 'unknown') {
rabbit_version = r;
erlang_version = e;
} else {
if (r != 'unknown' && (rabbit_version != r || erlang_version != e)) {
version_warning = true;
}
}
}
if (version_warning) {
%>
<p class="warning">
Version mismatch<br/><br/>
The nodes in this cluster are running different versions of
RabbitMQ and / or Erlang. This cluster may behave unpredictably.
You are very strongly recommended to ensure that all nodes in this cluster
run the same versions of RabbitMQ and Erlang.
</p>
<table class="list">
<tr>
<th>Name</th>
<th>RabbitMQ version</th>
<th>Erlang version</th>
</tr>
<%
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
%>
<tr<%= alt_rows(i)%>>
<td><%= fmt_string(node.name) %></td>
<td><%= fmt_rabbit_version(node.applications) %></td>
<td><%= node.erlang_version %></td>
</tr>
<% } %>
</table>
<% } %>
</div>
<div class="section">
<h2>Totals</h2>
<div class="hider updatable">
@ -44,11 +90,10 @@
<th>
Memory
</th>
<th>Uptime</th>
<th>
Version
<sub>(RabbitMQ / Erlang)</sub>
Disk space
</th>
<th>Uptime</th>
<th>Type</th>
</tr>
<%
@ -105,14 +150,28 @@
<sub><%= fmt_bytes(node.mem_limit) %> high watermark</sub>
<% } else { %>
<%= fmt_bytes(node.mem_used) %>
<% } %>
</td>
<td class="status">
<% if (node.disk_free_limit != 'disk_free_monitoring_disabled') { %>
<% if (node.disk_free_alarm) { %>
<div class="red">
<%= fmt_bytes(node.disk_free) %>
<span class="help" id="disk-free-alarm"></span>
</div>
<% } else { %>
<div class="green">
<%= fmt_bytes(node.disk_free) %>
</div>
<% } %>
<sub><%= fmt_bytes(node.disk_free_limit) %> low watermark </sub>
<% } else { %>
(not monitored)
<% } %>
</td>
<td class="r">
<%= fmt_uptime(node.uptime) %>
</td>
<td class="c">
<%= fmt_rabbit_version(node.applications) %> / <%= node.erlang_version %>
</td>
<% } %>
<td class="c">
<% if (node.type == 'disc') { %>
@ -130,6 +189,11 @@
</tr>
<% } %>
</table>
<% if (!version_warning) { %>
<p>
RabbitMQ <b><%= rabbit_version %></b> on Erlang <b><%= erlang_version %></b>
</p>
<% } %>
<% if (overview.statistics_db_node == 'not_running') { %>
<p class="status-error">Statistics database could not be contacted. Message rates and queue lengths will not be shown.</p>

View File

@ -6,5 +6,5 @@
{mod, {rabbit_mgmt_app, []}},
{env, [{http_log_dir, none},
{load_definitions, none}]},
{applications, [kernel, stdlib, rabbit, rabbitmq_mochiweb, amqp_client,
{applications, [kernel, stdlib, rabbit, xmerl, rabbitmq_mochiweb, amqp_client,
rabbitmq_management_agent]}]}.