${ util.include('header', [title: tigase.util.DNSResolverFactory.getInstance().getDefaultHost() + ' statistics', imports: [ [ type: 'css', content:'.chart-bar-legend { display: block; } .chart-bar-legend > li { width: 100; display: block; padding: 2px; }' ] ]]) }
<% def compNames = []; compNames.addAll(result.stats.keySet()); compNames.sort(); def packetsLastSecond = [ labels : [], datasets: [[ label: 'Last second packets', fillColor: "rgba(151,187,205,0.5)", strokeColor: "rgba(151,187,205,0.8)", highlightFill: "rgba(151,187,205,0.75)", highlightStroke: "rgba(151,187,205,1)", data: [] ]] ]; compNames.each { compName -> def value = result.stats[compName].data.find { it.var.contains('Last second packets') }; if (!value) return; packetsLastSecond.labels.add(compName); packetsLastSecond.datasets[0].data.add(Integer.parseInt(value.value)); } def packetsLastMinute = [ labels : [], datasets: [[ label: 'Last minute packets', fillColor: "rgba(151,187,205,0.5)", strokeColor: "rgba(151,187,205,0.8)", highlightFill: "rgba(151,187,205,0.75)", highlightStroke: "rgba(151,187,205,1)", data: [] ]] ]; compNames.each { compName -> def value = result.stats[compName].data.find { it.var.contains('Last minute packets') }; if (!value) return; packetsLastMinute.labels.add(compName); packetsLastMinute.datasets[0].data.add(Integer.parseInt(value.value)); } def packetsLastHour = [ labels : [], datasets: [[ label: 'Last hour packets', fillColor: "rgba(151,187,205,0.5)", strokeColor: "rgba(151,187,205,0.8)", highlightFill: "rgba(151,187,205,0.75)", highlightStroke: "rgba(151,187,205,1)", data: [] ]] ]; compNames.each { compName -> def value = result.stats[compName].data.find { it.var.contains('Last hour packets') }; if (!value) return; packetsLastHour.labels.add(compName); packetsLastHour.datasets[0].data.add(Integer.parseInt(value.value)); } def tmp = null; %>

### Components: <% compNames.each { %> ${it} <% } %> |
<% def mr = result.stats['message-router'].data; tmp = Float.parseFloat(mr.find { it.var.endsWith('Load average') }?.value?.replace(',','.')); def loadAverage = [[ value : tmp, color:"#F7464A", highlight: "#FF5A5E", label : 'Load' ],[ value : (Float.parseFloat(mr.find { it.var.endsWith('CPUs no') }?.value)-tmp), color: "#46BFBD", highlight: "#5AD3D1", label : 'Free' ]]; tmp = Float.parseFloat(mr.find { it.var.endsWith('CPU usage [%]') }?.value.replace(',','.')); def cpuUsage = [[ value : tmp, color:"#F7464A", highlight: "#FF5A5E", label : 'Used' ],[ value : (((Float) 100) - (tmp)), color: "#46BFBD", highlight: "#5AD3D1", label : 'Free' ]]; tmp = Float.parseFloat(mr.find { it.var.endsWith('HEAP usage [%]') }?.value.replace(',','.')); def memHeapUsage = [[ value : tmp, color:"#F7464A", highlight: "#FF5A5E", label : 'Used' ],[ value : (((Float) 100) - (tmp)), color: "#46BFBD", highlight: "#5AD3D1", label : 'Free' ]]; %>
Uptime: ${mr.find { it.var.endsWith('Uptime') }?.value } CPUs no: ${mr.find { it.var.endsWith('CPUs no') }?.value} Threads count: ${mr.find { it.var.endsWith('Threads count') }?.value}
Load average: ${mr.find { it.var.endsWith('Load average') }?.value } | CPU usage [%]: ${mr.find { it.var.endsWith('CPU usage [%]') }?.value.replace(',','.')} | HEAP usage [%]: ${mr.find { it.var.endsWith('HEAP usage [%]') }?.value.replace(',','.')}

${ util.include('footer') }