$(document).ready(function() { renew(); setInterval(renew,5000); }); function renew(){ $.getJSON("renew.json",function(data){ console.log(data); $('#uptime').text(data.uptime.days+' days '+data.uptime.hours+'h '+data.uptime.minutes+'m'); $('#cpu_total').css('width',data.cpu+'%'); $('#cpu_total').text(data.cpu+'%'); danger('#cpu_total_handler',data.cpu); danger('#ram_usage_handler',data.mem_usage.ram_per); $('#ram').text('used '+data.mem_usage.ram[1]+'Gb from '+data.mem_usage.ram[0]+'Gb total'); $('#ram_usage').css('width',data.mem_usage.ram_per+'%'); $('#ram_usage').text(data.mem_usage.ram_per+'%'); danger('#swap_usage_handler',data.mem_usage.swap_per); $('#swap').text('used '+data.mem_usage.swap[1]+'Gb from '+data.mem_usage.swap[0]+'Gb total'); $('#swap_usage').css('width',data.mem_usage.swap_per+'%'); $('#swap_usage').text(data.mem_usage.swap_per+'%'); var disks=[] $.each(data.disks_usage, function(key, value){ disks.push('
'+key+' ('+value[4]+') used '+value[2]+'Gb from '+value[1]+'Gb total
'+key+' '+ip+'
Down: '+value[0]+'KB/s
Up: '+value[1]+'KB/s