diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 50c6541e..6fd14ff5 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -875,8 +875,9 @@ fn get_rrd_stats( &rrd_dir, &[ "total", "used", - "read_ios", "read_bytes", "read_ticks", - "write_ios", "write_bytes", "write_ticks", + "read_ios", "read_bytes", + "write_ios", "write_bytes", + "io_ticks", ], timeframe, cf, diff --git a/src/api2/node/rrd.rs b/src/api2/node/rrd.rs index e8f45f99..80e5c35c 100644 --- a/src/api2/node/rrd.rs +++ b/src/api2/node/rrd.rs @@ -36,8 +36,9 @@ fn get_node_stats( "netin", "netout", "loadavg", "total", "used", - "read_ios", "read_bytes", "read_ticks", - "write_ios", "write_bytes", "write_ticks", + "read_ios", "read_bytes", + "write_ios", "write_bytes", + "io_ticks", ], timeframe, cf, diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 7515e788..2bef6ecc 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -741,15 +741,14 @@ fn gather_disk_stats(disk_manager: Arc, path: &Path, rrd_prefix: &st rrd_update_derive(&rrd_key, stat.read_ios as f64); let rrd_key = format!("{}/read_bytes", rrd_prefix); rrd_update_derive(&rrd_key, (stat.read_sectors*512) as f64); - let rrd_key = format!("{}/read_ticks", rrd_prefix); - rrd_update_derive(&rrd_key, (stat.read_ticks as f64)/1000.0); let rrd_key = format!("{}/write_ios", rrd_prefix); rrd_update_derive(&rrd_key, stat.write_ios as f64); let rrd_key = format!("{}/write_bytes", rrd_prefix); rrd_update_derive(&rrd_key, (stat.write_sectors*512) as f64); - let rrd_key = format!("{}/write_ticks", rrd_prefix); - rrd_update_derive(&rrd_key, (stat.write_ticks as f64)/1000.0); + + let rrd_key = format!("{}/io_ticks", rrd_prefix); + rrd_update_derive(&rrd_key, (stat.io_ticks as f64)/1000.0); } } } diff --git a/src/tools/disks.rs b/src/tools/disks.rs index fb299aad..f82f9f7c 100644 --- a/src/tools/disks.rs +++ b/src/tools/disks.rs @@ -427,6 +427,8 @@ impl Disk { } /// Read block device stats + /// + /// see https://www.kernel.org/doc/Documentation/block/stat.txt pub fn read_stat(&self) -> std::io::Result> { if let Some(stat) = self.read_sys(Path::new("stat"))? { let stat = unsafe { std::str::from_utf8_unchecked(&stat) }; @@ -434,18 +436,15 @@ impl Disk { u64::from_str_radix(s, 10).unwrap_or(0) }).collect(); - if stat.len() < 8 { return Ok(None); } + if stat.len() < 15 { return Ok(None); } return Ok(Some(BlockDevStat { read_ios: stat[0], - read_merges: stat[1], read_sectors: stat[2], - read_ticks: stat[3], - write_ios: stat[4], - write_merges: stat[5], - write_sectors: stat[6], - write_ticks: stat[7], - })); + write_ios: stat[4] + stat[11], // write + discard + write_sectors: stat[6] + stat[13], // write + discard + io_ticks: stat[10], + })); } Ok(None) } @@ -470,11 +469,8 @@ pub enum DiskType { /// Represents the contents of the /sys/block//stat file. pub struct BlockDevStat { pub read_ios: u64, - pub read_merges: u64, pub read_sectors: u64, - pub read_ticks: u64, //milliseconds pub write_ios: u64, - pub write_merges: u64, pub write_sectors: u64, - pub write_ticks: u64, //milliseconds + pub io_ticks: u64, // milliseconds } diff --git a/src/tools/disks/zfs.rs b/src/tools/disks/zfs.rs index fbd57bc1..ec004590 100644 --- a/src/tools/disks/zfs.rs +++ b/src/tools/disks/zfs.rs @@ -37,10 +37,7 @@ pub fn zfs_pool_stats(pool: &OsStr) -> Result, Error> { write_sectors: stat[1]>>9, read_ios: stat[2], write_ios: stat[3], - read_merges: 0, // there is no such info - write_merges: 0, // there is no such info - write_ticks: ticks, - read_ticks: ticks, + io_ticks: ticks, }; Ok(Some(stat)) diff --git a/www/DataStoreStatistic.js b/www/DataStoreStatistic.js index 5b6c3703..3c54fc80 100644 --- a/www/DataStoreStatistic.js +++ b/www/DataStoreStatistic.js @@ -5,24 +5,18 @@ Ext.define('pve-rrd-datastore', { 'total', 'read_ios', 'read_bytes', - 'read_ticks', 'write_ios', 'write_bytes', - 'write_ticks', + 'io_ticks', { - name: 'read_delay', calculate: function(data) { - if (data.read_ios === undefined || data.read_ios === 0 || data.read_ticks == undefined) { + 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 (ios == 0 || data.io_ticks === undefined) { return undefined; } - return (data.read_ticks*1000)/data.read_ios; - } - }, - { - name: 'write_delay', calculate: function(data) { - if (data.write_ios === undefined || data.write_ios === 0 || data.write_ticks == undefined) { - return undefined; - } - return (data.write_ticks*1000)/data.write_ios; + return (data.io_ticks*1000.0)/ios; } }, { type: 'date', dateFormat: 'timestamp', name: 'time' } @@ -85,9 +79,9 @@ Ext.define('PBS.DataStoreStatistic', { }, { xtype: 'proxmoxRRDChart', - title: gettext('Delay (ms)'), - fields: ['read_delay','write_delay'], - fieldTitles: [gettext('Read'), gettext('Write')], + title: gettext('IO Delay (ms)'), + fields: ['io_delay'], + fieldTitles: [gettext('IO Delay')], store: rrdstore }, ] diff --git a/www/ServerStatus.js b/www/ServerStatus.js index 9bbed127..f86517c7 100644 --- a/www/ServerStatus.js +++ b/www/ServerStatus.js @@ -21,8 +21,24 @@ Ext.define('pve-rrd-node', { 'memused', 'swaptotal', 'swapused', - 'roottotal', - 'rootused', + 'total', + 'used', + '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 (ios == 0 || data.io_ticks === undefined) { + return undefined; + } + return (data.io_ticks*1000.0)/ios; + } + }, 'loadavg', { type: 'date', dateFormat: 'timestamp', name: 'time' } ] @@ -146,8 +162,8 @@ Ext.define('PBS.ServerStatus', { { xtype: 'proxmoxRRDChart', title: gettext('Root Disk IO Delay (ms)'), - fields: ['read_delay','write_delay'], - fieldTitles: [gettext('Read'), gettext('Write')], + fields: ['io_delay'], + fieldTitles: [gettext('IO Delay')], store: rrdstore }, ]