Styling node detail graphs
Partially-Implements blueprint: node-details-attribute-update Change-Id: I6bd2ba8164806f2c5dcabc18acac4b614b0dbf3f
This commit is contained in:
parent
6f2c0f6336
commit
2d335e59ae
@ -151,9 +151,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="node-charts" class="clearfix">
|
<div id="node-charts" class="clearfix">
|
||||||
{% for meter_label, url_part in meter_conf %}
|
{% for meter_label, url_part, y_max in meter_conf %}
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
{% include "infrastructure/_performance_chart.html" with label=meter_label url=node_perf_url|add:"?"|add:url_part only %}
|
{% include "infrastructure/_performance_chart.html" with label=meter_label y_max=y_max url=node_perf_url|add:"?"|add:url_part only %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
@ -74,16 +74,20 @@ class DetailView(horizon_views.APIView):
|
|||||||
# (meter label, url part, barchart (True/False))
|
# (meter label, url part, barchart (True/False))
|
||||||
context['meter_conf'] = (
|
context['meter_conf'] = (
|
||||||
(_('System Load'),
|
(_('System Load'),
|
||||||
url_part('hardware.cpu.load.1min', False)),
|
url_part('hardware.cpu.load.1min', False),
|
||||||
|
None),
|
||||||
(_('CPU Utilization'),
|
(_('CPU Utilization'),
|
||||||
url_part('hardware.system_stats.cpu.util', True)),
|
url_part('hardware.system_stats.cpu.util', True),
|
||||||
#TODO(akrivoka) need this metric expressed in percentages
|
'100'),
|
||||||
(_('Swap Utilization'),
|
(_('Swap Utilization'),
|
||||||
url_part('hardware.memory.swap.util', True)),
|
url_part('swap-util', True),
|
||||||
|
'100'),
|
||||||
(_('Disk I/O '),
|
(_('Disk I/O '),
|
||||||
url_part('disk-io', False)),
|
url_part('disk-io', False),
|
||||||
|
None),
|
||||||
(_('Network I/O '),
|
(_('Network I/O '),
|
||||||
url_part('network-io', False)),
|
url_part('network-io', False),
|
||||||
|
None),
|
||||||
)
|
)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@ -126,24 +130,53 @@ class PerformanceView(base.TemplateView):
|
|||||||
'hardware.network.ip.out_requests',
|
'hardware.network.ip.out_requests',
|
||||||
'hardware.network.ip.in_receives'
|
'hardware.network.ip.in_receives'
|
||||||
])
|
])
|
||||||
|
elif meter == 'swap-util':
|
||||||
|
meters = get_meters([
|
||||||
|
'hardware.memory.swap.util',
|
||||||
|
'hardware.memory.swap.total'
|
||||||
|
])
|
||||||
else:
|
else:
|
||||||
meters = get_meters([meter])
|
meters = get_meters([meter])
|
||||||
|
|
||||||
for meter, meter_name in meters:
|
for meter_id, meter_name in meters:
|
||||||
resources, unit = metering.query_data(
|
resources, unit = metering.query_data(
|
||||||
request=request,
|
request=request,
|
||||||
date_from=date_from,
|
date_from=date_from,
|
||||||
date_to=date_to,
|
date_to=date_to,
|
||||||
date_options=date_options,
|
date_options=date_options,
|
||||||
group_by=group_by,
|
group_by=group_by,
|
||||||
meter=meter,
|
meter=meter_id,
|
||||||
additional_query=additional_query)
|
additional_query=additional_query)
|
||||||
series.extend(metering.SamplesView._series_for_meter(
|
next_series = metering.SamplesView._series_for_meter(
|
||||||
resources,
|
resources,
|
||||||
resource_name,
|
resource_name,
|
||||||
meter_name,
|
meter_name,
|
||||||
stats_attr,
|
stats_attr,
|
||||||
unit))
|
unit)
|
||||||
|
# You would think the meter name would be a part of the
|
||||||
|
# returned data...
|
||||||
|
for serie in next_series:
|
||||||
|
serie['meter'] = meter_id
|
||||||
|
series.extend(next_series)
|
||||||
|
|
||||||
|
if meter == 'swap-util':
|
||||||
|
# Divide available swap with used swap, multiply by 100.
|
||||||
|
# Integers are good enough here.
|
||||||
|
for serie in series:
|
||||||
|
if serie['meter'] == 'hardware.memory.swap.util':
|
||||||
|
util = serie.copy()
|
||||||
|
if serie['meter'] == 'hardware.memory.swap.total':
|
||||||
|
total = serie.copy()
|
||||||
|
|
||||||
|
for i, d in enumerate(util['data']):
|
||||||
|
try:
|
||||||
|
util['data'][i]['y'] =\
|
||||||
|
int((100*d['y'])//total['data'][i]['y'])
|
||||||
|
except IndexError:
|
||||||
|
# Could happen if one series is shorter.
|
||||||
|
del util['data'][i]
|
||||||
|
util['unit'] = '%'
|
||||||
|
series = [util]
|
||||||
|
|
||||||
if barchart:
|
if barchart:
|
||||||
average, used, tooltip_average = get_barchart_stats(series,
|
average, used, tooltip_average = get_barchart_stats(series,
|
||||||
|
@ -63,4 +63,18 @@
|
|||||||
#node-charts {
|
#node-charts {
|
||||||
margin-left: -20px;
|
margin-left: -20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chart svg {
|
||||||
|
height: 120px;
|
||||||
|
width: 144px;
|
||||||
|
|
||||||
|
path.undefined {
|
||||||
|
stroke-width: 1px;
|
||||||
|
stroke: #ff7f0e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.y_ticks text {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
data-chart-type="line_chart"
|
data-chart-type="line_chart"
|
||||||
data-url="{{ url }}"
|
data-url="{{ url }}"
|
||||||
data-form-selector='#linechart_general_form'
|
data-form-selector='#linechart_general_form'
|
||||||
data-settings='{ "auto_size": false, "axes_x" : false, "axes_y" : false }'>
|
data-settings='{ "auto_size": false, "axes_x" : false, "axes_y" : false {% if y_max %}, "yMax": {{ y_max }} {% endif %} }'>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bar_chart_container">
|
<div class="bar_chart_container">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user