this calls the api once when opening the dashboard, and fills the charts
with that cached data, then it continues like previously with its
interval

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 www/manager6/ceph/Status.js | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index f1fcda00..9c1e948c 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -369,6 +369,24 @@ Ext.define('PVE.node.CephStatus', {
        me.on('destroy', me.metadatastore.stopUpdate);
        me.store.startUpdate();
        me.metadatastore.startUpdate();
+       Proxmox.Utils.API2Request({
+           url: '/cluster/ceph/iostat',
+           method: 'GET',
+           failure: function(response, opts) {
+               Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+           },
+           success: function(response, options) {
+               var data = response.result.data;
+               data.forEach(entry => {
+                   // epoch is seconds, js timestamp is ms
+                   let time = entry.time * 1000;
+                   me.reads.addDataPoint(entry.bytes_r, time);
+                   me.writes.addDataPoint(entry.bytes_w, time);
+                   me.readiops.addDataPoint(entry.ops_r, time);
+                   me.writeiops.addDataPoint(entry.ops_w, time);
+               });
+           }
+       });
     }
 
 });
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to