[pve-devel] [RFC manager 4/4] split ram usage into usage types

Folke Gleumes f.gleumes at proxmox.com
Mon Dec 11 15:47:21 CET 2023


Signed-off-by: Folke Gleumes <f.gleumes at proxmox.com>
---
 PVE/API2/Nodes.pm            |  6 +++---
 PVE/API2Tools.pm             |  2 +-
 PVE/Service/pvestatd.pm      | 15 +++++++++++----
 www/manager6/node/Summary.js |  6 ++++--
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 3619190d..7dd8e5c2 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -430,7 +430,7 @@ __PACKAGE__->register_method({
 	$res->{memory} = {
 	    free => $meminfo->{memfree},
 	    total => $meminfo->{memtotal},
-	    used => $meminfo->{memused},
+	    used => $meminfo->{memused} - ($meminfo->{memcached} + $meminfo->{membuffers} + $meminfo->{arcsize}),
 	};
 
 	$res->{ksm} = {
@@ -715,7 +715,7 @@ __PACKAGE__->register_method({
 	my ($param) = @_;
 
 	return PVE::RRD::create_rrd_graph(
-	    "pve2-node/$param->{node}", $param->{timeframe},
+	    "pve8-node/$param->{node}", $param->{timeframe},
 	    $param->{ds}, $param->{cf});
 
     }});
@@ -757,7 +757,7 @@ __PACKAGE__->register_method({
 	my ($param) = @_;
 
 	return PVE::RRD::create_rrd_data(
-	    "pve2-node/$param->{node}", $param->{timeframe}, $param->{cf});
+	    "pve8-node/$param->{node}", $param->{timeframe}, $param->{cf});
     }});
 
 __PACKAGE__->register_method({
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index a56eb732..f5ddff6e 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -49,7 +49,7 @@ sub extract_node_stats {
 	status => 'unknown',
     };
 
-    if (my $d = $rrd->{"pve2-node/$node"}) {
+    if (my $d = $rrd->{"pve8-node/$node"}) {
 
 	if (!$members || # no cluster
 	    ($members->{$node} && $members->{$node}->{online})) {
diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index 2515120c..3fed4247 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -29,6 +29,7 @@ use PVE::AccessControl;
 use PVE::Ceph::Services;
 use PVE::Ceph::Tools;
 use PVE::pvecfg;
+use Data::Dumper;
 
 use PVE::ExtMetric;
 use PVE::Status::Plugin;
@@ -177,13 +178,19 @@ sub update_node_status {
 
     my $ctime = time();
 
+    my $memused = $meminfo->{memtotal} - $meminfo->{memfree};
+    my $mem_non_cache = $memused - ($meminfo->{memcached} + $meminfo->{membuffers} + $meminfo->{arcsize});
+
     my $data = $generate_rrd_string->(
 	[$uptime, $sublevel, $ctime, $avg1, $maxcpu, $stat->{cpu}, $stat->{wait},
-	 $meminfo->{memtotal}, $meminfo->{memused},
-	 $meminfo->{swaptotal}, $meminfo->{swapused},
-	 $dinfo->{blocks}, $dused, $netin, $netout]
+	 $meminfo->{memtotal}, $meminfo->{memfree},
+	 $mem_non_cache,
+	 $meminfo->{membuffers} + $meminfo->{memcached},
+	 $meminfo->{arcsize}, $meminfo->{swaptotal},
+	 $meminfo->{swapused}, $dinfo->{blocks},
+	 $dused, $netin, $netout]
     );
-    PVE::Cluster::broadcast_rrd("pve2-node/$nodename", $data);
+    PVE::Cluster::broadcast_rrd("pve8-node/$nodename", $data);
 
     my $node_metric = {
 	uptime => $uptime,
diff --git a/www/manager6/node/Summary.js b/www/manager6/node/Summary.js
index c2dca0df..d7bb8815 100644
--- a/www/manager6/node/Summary.js
+++ b/www/manager6/node/Summary.js
@@ -174,11 +174,13 @@ Ext.define('PVE.node.Summary', {
 			{
 			    xtype: 'proxmoxRRDChart',
 			    title: gettext('Memory usage'),
-			    fields: ['memtotal', 'memused'],
-			    fieldTitles: [gettext('Total'), gettext('RAM usage')],
+			    fields: ['memused', 'membuffercache', 'arcsize', 'memfree'],
+			    fieldTitles: [gettext('Used'), gettext('Buffer/Cache'), 'ZFS Arc', gettext('Free')],
 			    unit: 'bytes',
 			    powerOfTwo: true,
 			    store: rrdstore,
+			    colors: ['#115fa6', '#a61187', '#ff8809', '#94ae0a'],
+			    stacking: true,
 			},
 			{
 			    xtype: 'proxmoxRRDChart',
-- 
2.39.2





More information about the pve-devel mailing list