Commit e9f05037 by Bach Dániel

dashboard: add NodeGraphView

fixes #82
parent 5f1cd2ab
......@@ -8,9 +8,10 @@
</dl>
</div>
<div class="col-md-8">
<img src="/static/grafikon.png" style="width:45%"/>
<img src="/static/grafikon.png" style="width:45%"/>
<img src="/static/grafikon.png" style="width:45%"/>
<img src="/static/grafikon.png" style="width:45%"/>
{% if graphite_enabled %}
<img src="{% url "dashboard.views.node-graph" node.pk "cpu" "6h" %}" style="width:100%"/>
<img src="{% url "dashboard.views.node-graph" node.pk "memory" "6h" %}" style="width:100%"/>
<img src="{% url "dashboard.views.node-graph" node.pk "network" "6h" %}" style="width:100%"/>
{% endif %}
</div>
</div>
......@@ -8,7 +8,7 @@ from .views import (
TemplateList, LeaseDetail, NodeCreate, LeaseCreate, TemplateCreate,
FavouriteView, NodeStatus, GroupList, TemplateDelete, LeaseDelete,
VmGraphView, TemplateAclUpdateView, GroupDetailView, GroupDelete,
GroupAclUpdateView, GroupUserDelete,
GroupAclUpdateView, GroupUserDelete, NodeGraphView
)
urlpatterns = patterns(
......@@ -71,6 +71,10 @@ urlpatterns = patterns(
r'(?P<time>[0-9]{1,2}[hdwy])$'),
VmGraphView.as_view(),
name='dashboard.views.vm-graph'),
url((r'^node/(?P<pk>\d+)/graph/(?P<metric>cpu|memory|network)/'
r'(?P<time>[0-9]{1,2}[hdwy])$'),
NodeGraphView.as_view(),
name='dashboard.views.node-graph'),
url(r'^group/(?P<pk>\d+)/$', GroupDetailView.as_view(),
name='dashboard.views.group-detail'),
url(r'^group/(?P<pk>\d+)/acl/$', GroupAclUpdateView.as_view(),
......
......@@ -449,6 +449,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
node=self.object, parent=None
).order_by('-started').select_related()
context['activities'] = na
context['graphite_enabled'] = (
NodeGraphView.get_graphite_url() is not None)
return context
def post(self, request, *args, **kwargs):
......@@ -1637,3 +1639,16 @@ class VmGraphView(GraphViewBase):
def get_title(self, instance, metric):
return '%s (%s) - %s' % (instance.name, instance.vm_name, metric)
class NodeGraphView(SuperuserRequiredMixin, GraphViewBase):
model = Node
def get_prefix(self, instance):
return 'circle.%s' % instance.name
def get_title(self, instance, metric):
return '%s - %s' % (instance.name, metric)
def get_object(self, request, pk):
return self.model.objects.get(id=pk)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment