2020-10-27 15:20:07 +00:00
|
|
|
Ext.define('pve-rrd-datastore', {
|
|
|
|
extend: 'Ext.data.Model',
|
|
|
|
fields: [
|
2020-10-28 20:24:25 +00:00
|
|
|
'used',
|
|
|
|
'total',
|
|
|
|
'read_ios',
|
|
|
|
'read_bytes',
|
|
|
|
'write_ios',
|
|
|
|
'write_bytes',
|
|
|
|
'io_ticks',
|
|
|
|
{
|
|
|
|
name: 'io_delay', calculate: function(data) {
|
|
|
|
let ios = 0;
|
|
|
|
if (data.read_ios !== undefined) { ios += data.read_ios; }
|
|
|
|
if (data.write_ios !== undefined) { ios += data.write_ios; }
|
|
|
|
if (data.io_ticks === undefined) {
|
|
|
|
return undefined;
|
|
|
|
} else if (ios === 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return (data.io_ticks*1000.0)/ios;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ type: 'date', dateFormat: 'timestamp', name: 'time' },
|
2020-10-27 15:20:07 +00:00
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.DataStoreInfo', {
|
|
|
|
extend: 'Ext.panel.Panel',
|
|
|
|
alias: 'widget.pbsDataStoreInfo',
|
|
|
|
|
|
|
|
viewModel: {
|
|
|
|
data: {
|
|
|
|
countstext: '',
|
|
|
|
usage: {},
|
|
|
|
stillbad: 0,
|
|
|
|
mountpoint: "",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
controller: {
|
|
|
|
xclass: 'Ext.app.ViewController',
|
|
|
|
|
|
|
|
onLoad: function(store, data, success) {
|
|
|
|
if (!success) return;
|
|
|
|
let me = this;
|
|
|
|
let vm = me.getViewModel();
|
|
|
|
|
|
|
|
let counts = store.getById('counts').data.value;
|
2020-10-29 10:51:26 +00:00
|
|
|
let total = store.getById('total').data.value;
|
|
|
|
let used = store.getById('used').data.value;
|
2020-10-27 15:20:07 +00:00
|
|
|
|
2020-11-09 15:01:23 +00:00
|
|
|
let usage = PBS.Utils.render_size_usage(used, total);
|
2020-10-27 15:20:07 +00:00
|
|
|
vm.set('usagetext', usage);
|
2020-10-29 10:51:26 +00:00
|
|
|
vm.set('usage', used/total);
|
2020-10-27 15:20:07 +00:00
|
|
|
|
|
|
|
let gcstatus = store.getById('gc-status').data.value;
|
|
|
|
|
2020-11-10 09:18:07 +00:00
|
|
|
let dedup = PBS.Utils.calculate_dedup_factor(gcstatus);
|
2020-10-27 15:20:07 +00:00
|
|
|
|
|
|
|
let countstext = function(count) {
|
2020-10-29 14:52:45 +00:00
|
|
|
count = count || {};
|
2020-10-29 10:51:26 +00:00
|
|
|
return `${count.groups || 0} ${gettext('Groups')}, ${count.snapshots || 0} ${gettext('Snapshots')}`;
|
2020-10-27 15:20:07 +00:00
|
|
|
};
|
|
|
|
|
2020-10-29 10:51:26 +00:00
|
|
|
vm.set('ctcount', countstext(counts.ct));
|
|
|
|
vm.set('vmcount', countstext(counts.vm));
|
|
|
|
vm.set('hostcount', countstext(counts.host));
|
2020-10-27 15:20:07 +00:00
|
|
|
vm.set('deduplication', dedup.toFixed(2));
|
|
|
|
vm.set('stillbad', gcstatus['still-bad']);
|
|
|
|
},
|
|
|
|
|
|
|
|
startStore: function() { this.store.startUpdate(); },
|
|
|
|
stopStore: function() { this.store.stopUpdate(); },
|
|
|
|
|
|
|
|
init: function(view) {
|
|
|
|
let me = this;
|
|
|
|
let datastore = encodeURIComponent(view.datastore);
|
|
|
|
me.store = Ext.create('Proxmox.data.ObjectStore', {
|
|
|
|
interval: 5*1000,
|
|
|
|
url: `/api2/json/admin/datastore/${datastore}/status`,
|
|
|
|
});
|
|
|
|
me.store.on('load', me.onLoad, me);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
listeners: {
|
|
|
|
activate: 'startStore',
|
|
|
|
destroy: 'stopStore',
|
|
|
|
deactivate: 'stopStore',
|
|
|
|
},
|
|
|
|
|
|
|
|
defaults: {
|
|
|
|
xtype: 'pmxInfoWidget',
|
|
|
|
},
|
|
|
|
|
|
|
|
bodyPadding: 20,
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
2020-10-27 16:43:10 +00:00
|
|
|
iconCls: 'fa fa-fw fa-hdd-o',
|
2020-10-27 15:20:07 +00:00
|
|
|
title: gettext('Usage'),
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
usage: '{usage}',
|
|
|
|
text: '{usagetext}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'box',
|
|
|
|
html: `<b>${gettext('Backup Count')}</b>`,
|
|
|
|
padding: '10 0 5 0',
|
|
|
|
},
|
|
|
|
{
|
2020-10-27 16:43:10 +00:00
|
|
|
iconCls: 'fa fa-fw fa-cube',
|
2020-10-27 15:20:07 +00:00
|
|
|
title: gettext('CT'),
|
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{ctcount}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-10-27 16:43:10 +00:00
|
|
|
iconCls: 'fa fa-fw fa-building',
|
2020-10-27 15:20:07 +00:00
|
|
|
title: gettext('Host'),
|
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{hostcount}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-10-27 16:43:10 +00:00
|
|
|
iconCls: 'fa fa-fw fa-desktop',
|
2020-10-27 15:20:07 +00:00
|
|
|
title: gettext('VM'),
|
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{vmcount}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'box',
|
|
|
|
html: `<b>${gettext('Stats from last Garbage Collection')}</b>`,
|
|
|
|
padding: '10 0 5 0',
|
|
|
|
},
|
|
|
|
{
|
2020-10-27 16:43:10 +00:00
|
|
|
iconCls: 'fa fa-fw fa-compress',
|
2020-10-27 16:43:43 +00:00
|
|
|
title: gettext('Deduplication Factor'),
|
2020-10-27 15:20:07 +00:00
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{deduplication}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-10-27 16:43:10 +00:00
|
|
|
iconCls: 'fa critical fa-fw fa-exclamation-triangle',
|
2020-10-27 15:20:07 +00:00
|
|
|
title: gettext('Bad Chunks'),
|
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{stillbad}',
|
|
|
|
},
|
|
|
|
visible: '{stillbad}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.DataStoreSummary', {
|
|
|
|
extend: 'Ext.panel.Panel',
|
|
|
|
alias: 'widget.pbsDataStoreSummary',
|
|
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
|
|
|
|
layout: 'column',
|
|
|
|
scrollable: true,
|
|
|
|
|
|
|
|
bodyPadding: 5,
|
|
|
|
defaults: {
|
|
|
|
columnWidth: 1,
|
|
|
|
padding: 5,
|
|
|
|
},
|
|
|
|
|
|
|
|
tbar: ['->', { xtype: 'proxmoxRRDTypeSelector' }],
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
|
|
|
height: 300,
|
|
|
|
layout: {
|
|
|
|
type: 'hbox',
|
|
|
|
align: 'stretch',
|
|
|
|
},
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'pbsDataStoreInfo',
|
|
|
|
flex: 1,
|
|
|
|
padding: '0 10 0 0',
|
|
|
|
cbind: {
|
|
|
|
title: '{datastore}',
|
|
|
|
datastore: '{datastore}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pbsDataStoreNotes',
|
|
|
|
flex: 1,
|
|
|
|
cbind: {
|
|
|
|
datastore: '{datastore}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Storage usage (bytes)'),
|
|
|
|
fields: ['total', 'used'],
|
|
|
|
fieldTitles: [gettext('Total'), gettext('Storage usage')],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Transfer Rate (bytes/second)'),
|
|
|
|
fields: ['read_bytes', 'write_bytes'],
|
|
|
|
fieldTitles: [gettext('Read'), gettext('Write')],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Input/Output Operations per Second (IOPS)'),
|
|
|
|
fields: ['read_ios', 'write_ios'],
|
|
|
|
fieldTitles: [gettext('Read'), gettext('Write')],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('IO Delay (ms)'),
|
|
|
|
fields: ['io_delay'],
|
|
|
|
fieldTitles: [gettext('IO Delay')],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
listeners: {
|
|
|
|
activate: function() { this.rrdstore.startUpdate(); },
|
|
|
|
deactivate: function() { this.rrdstore.stopUpdate(); },
|
|
|
|
destroy: function() { this.rrdstore.stopUpdate(); },
|
|
|
|
},
|
|
|
|
|
|
|
|
initComponent: function() {
|
|
|
|
let me = this;
|
|
|
|
|
|
|
|
me.rrdstore = Ext.create('Proxmox.data.RRDStore', {
|
|
|
|
rrdurl: "/api2/json/admin/datastore/" + me.datastore + "/rrd",
|
|
|
|
model: 'pve-rrd-datastore',
|
|
|
|
});
|
|
|
|
|
|
|
|
me.callParent();
|
|
|
|
|
|
|
|
Proxmox.Utils.API2Request({
|
|
|
|
url: `/config/datastore/${me.datastore}`,
|
|
|
|
waitMsgTarget: me.down('pbsDataStoreInfo'),
|
|
|
|
success: function(response) {
|
|
|
|
let path = Ext.htmlEncode(response.result.data.path);
|
|
|
|
me.down('pbsDataStoreInfo').setTitle(`${me.datastore} (${path})`);
|
|
|
|
me.down('pbsDataStoreNotes').setNotes(response.result.data.comment);
|
|
|
|
},
|
2020-11-13 14:02:36 +00:00
|
|
|
failure: function(response) {
|
|
|
|
// fallback if e.g. we have no permissions to the config
|
|
|
|
let rec = Ext.getStore('pbs-datastore-list').findRecord('store', me.datastore);
|
|
|
|
if (rec) {
|
|
|
|
me.down('pbsDataStoreNotes').setNotes(rec.data.comment || "");
|
|
|
|
}
|
|
|
|
},
|
2020-10-27 15:20:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
me.query('proxmoxRRDChart').forEach((chart) => {
|
|
|
|
chart.setStore(me.rrdstore);
|
|
|
|
});
|
|
|
|
|
|
|
|
me.down('pbsDataStoreInfo').relayEvents(me, ['activate', 'deactivate']);
|
|
|
|
},
|
|
|
|
});
|