feat(xo-server-usage-report): add VM IP addresses to the report (#5696)

This commit is contained in:
badrAZ 2021-03-26 14:39:35 +01:00 committed by GitHub
parent cb52a8b51b
commit ad3b8fa59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,7 @@
- [Backup] Run backup jobs on different system processes (PR [#5660](https://github.com/vatesfr/xen-orchestra/pull/5660))
- [VM] Display the full driver version in the general and advanced tab instead of `major.minor` [#5680](https://github.com/vatesfr/xen-orchestra/issues/5680) (PR [#5691](https://github.com/vatesfr/xen-orchestra/pull/5691))
- [Usage report] Add VM IP addresses to the report (PR [#5696](https://github.com/vatesfr/xen-orchestra/pull/5696))
### Bug fixes
@ -37,6 +38,7 @@
>
> In case of conflict, the highest (lowest in previous list) `$version` wins.
- xo-server-usage-report minor
- xo-server-backup-reports patch
- @vates/disposable patch
- xo-server-transport-email minor

View File

@ -520,6 +520,7 @@
<tr>
<th>UUID</th>
<th>Name</th>
<th>IP addresses</th>
<th>CPU</th>
<th>RAM (GiB)</th>
<th>Disk read (MiB)</th>
@ -534,6 +535,7 @@
<tr>
<td>{{shortUUID this.uuid}}</td>
<td>{{this.name}}</td>
<td>{{formatAddresses this.addresses}}</td>
<td>{{normaliseValue this.cpu}} % {{normaliseEvolution this.evolution.cpu}}</td>
<td>{{normaliseValue this.ram}} {{normaliseEvolution this.evolution.ram}}</td>
<td>{{normaliseValue this.diskRead}} {{normaliseEvolution this.evolution.diskRead}}</td>

View File

@ -136,6 +136,10 @@ Handlebars.registerHelper('math', function (lvalue, operator, rvalue, options) {
Handlebars.registerHelper('shortUUID', shortUuid)
Handlebars.registerHelper('formatAddresses', addresses =>
addresses.length === 0 ? 'No IP record' : addresses.join(', ')
)
Handlebars.registerHelper('normaliseValue', normaliseValue)
Handlebars.registerHelper(
@ -285,6 +289,7 @@ async function getVmsStats({ runningVms, xo }) {
return {
uuid: vm.uuid,
name: vm.name_label,
addresses: Object.values(vm.addresses),
cpu: METRICS_MEAN.cpu(stats.cpus),
ram: METRICS_MEAN.ram(stats),
diskRead: METRICS_MEAN.disk(get(stats.xvds, 'r')),
@ -640,6 +645,7 @@ const CSV_CAST = {
}
const CSV_COLUMNS = {
addresses: { key: 'addresses', header: 'IP addresses' },
cpu: { key: 'cpu', header: 'CPU (%)' },
cpuEvolution: { key: 'evolution.cpu', header: 'CPU evolution (%)' },
diskRead: { key: 'diskRead', header: 'Disk read (MiB)' },
@ -771,6 +777,7 @@ class UsageReportPlugin {
columns: [
CSV_COLUMNS.uuid,
CSV_COLUMNS.name,
CSV_COLUMNS.addresses,
CSV_COLUMNS.cpu,
CSV_COLUMNS.cpuEvolution,
CSV_COLUMNS.ram,