mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
parent
ff40a13f29
commit
afb4c636fe
@ -73,6 +73,7 @@ $(document).ready(function() {
|
|||||||
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_facts&method=get_environment",
|
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_facts&method=get_environment",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
|
if (!json['get_facts']['error']) {
|
||||||
$('#hostname').html(json['get_facts']['hostname']);
|
$('#hostname').html(json['get_facts']['hostname']);
|
||||||
$('#fqdn').html(json['get_facts']['fqdn']);
|
$('#fqdn').html(json['get_facts']['fqdn']);
|
||||||
$('#vendor').html(json['get_facts']['vendor']);
|
$('#vendor').html(json['get_facts']['vendor']);
|
||||||
@ -86,6 +87,9 @@ $(document).ready(function() {
|
|||||||
var uptime_hours = Math.floor(uptime % 86400 / 3600);
|
var uptime_hours = Math.floor(uptime % 86400 / 3600);
|
||||||
var uptime_minutes = Math.floor(uptime % 3600 / 60);
|
var uptime_minutes = Math.floor(uptime % 3600 / 60);
|
||||||
$('#uptime').html(uptime_days + "d " + uptime_hours + "h " + uptime_minutes + "m");
|
$('#uptime').html(uptime_days + "d " + uptime_hours + "h " + uptime_minutes + "m");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!json['get_environment']['error']) {
|
||||||
$.each(json['get_environment']['cpu'], function(name, obj) {
|
$.each(json['get_environment']['cpu'], function(name, obj) {
|
||||||
var row="<tr><td>" + name + "</td><td>" + obj['%usage'] + "%</td></tr>";
|
var row="<tr><td>" + name + "</td><td>" + obj['%usage'] + "%</td></tr>";
|
||||||
$("#cpu").after(row)
|
$("#cpu").after(row)
|
||||||
@ -120,6 +124,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
$("#power").after(row)
|
$("#power").after(row)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
alert(xhr.responseText);
|
alert(xhr.responseText);
|
||||||
|
Loading…
Reference in New Issue
Block a user