mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-19 03:42:25 -06:00
Live device status PoC
This commit is contained in:
67
netbox/templates/dcim/device_status.html
Normal file
67
netbox/templates/dcim/device_status.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{% extends '_base.html' %}
|
||||
|
||||
{% block title %}{{ device }} - NAPALM{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'dcim/inc/device_header.html' with active_tab='status' %}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><strong>Device Facts</strong></div>
|
||||
<table class="table panel-body">
|
||||
<tr>
|
||||
<th>Hostname</th>
|
||||
<td id="hostname"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>FQDN</th>
|
||||
<td id="fqdn"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Vendor</th>
|
||||
<td id="vendor"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Model</th>
|
||||
<td id="model"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Serial Number</th>
|
||||
<td id="serial_number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>OS Version</th>
|
||||
<td id="os_version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Uptime</th>
|
||||
<td id="uptime"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_facts",
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
$('#hostname').html(json['get_facts']['hostname']);
|
||||
$('#fqdn').html(json['get_facts']['fqdn']);
|
||||
$('#vendor').html(json['get_facts']['vendor']);
|
||||
$('#model').html(json['get_facts']['model']);
|
||||
$('#serial_number').html(json['get_facts']['serial_number']);
|
||||
$('#os_version').html(json['get_facts']['os_version']);
|
||||
$('#uptime').html(json['get_facts']['uptime']);
|
||||
},
|
||||
error: function(xhr) {
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -45,6 +45,7 @@
|
||||
<ul class="nav nav-tabs" style="margin-bottom: 20px">
|
||||
<li role="presentation"{% if active_tab == 'info' %} class="active"{% endif %}><a href="{% url 'dcim:device' pk=device.pk %}">Info</a></li>
|
||||
<li role="presentation"{% if active_tab == 'inventory' %} class="active"{% endif %}><a href="{% url 'dcim:device_inventory' pk=device.pk %}">Inventory</a></li>
|
||||
<li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}><a href="{% url 'dcim:device_status' pk=device.pk %}">Status</a></li>
|
||||
{% if device.status == 1 and device.platform.rpc_client and device.primary_ip %}
|
||||
<li role="presentation"{% if active_tab == 'lldp-neighbors' %} class="active"{% endif %}><a href="{% url 'dcim:device_lldp_neighbors' pk=device.pk %}">LLDP Neighbors</a></li>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user