]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
status/metrics: make MTU configurable
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 29 Oct 2020 07:32:30 +0000 (08:32 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 29 Oct 2020 07:51:51 +0000 (08:51 +0100)
since some users don't even have a full 1500 (and some systems might
have links with bigger MTU and not require as much fragmentation).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/Status/Graphite.pm
PVE/Status/InfluxDB.pm
PVE/Status/Plugin.pm

index 41839a431bb7a94077f16084455c66ded7455fae..1b196c2418f0796763fe8354919e6b0bf6c07468 100644 (file)
@@ -50,6 +50,7 @@ sub options {
     return {
        server => {},
        port => { optional => 1 },
+       mtu => { optional => 1 },
        proto => { optional => 1 },
        timeout => { optional => 1 },
        path => { optional => 1 },
index c7bc15a9a4b06e6f3d9647abb0a4c593f72ede07..589a49369af7964f8c63f8cf2b1341a616b15ba5 100644 (file)
@@ -28,6 +28,7 @@ sub options {
     return {
        server => {},
        port => {},
+       mtu => { optional => 1 },
        disable => { optional => 1 },
    };
 }
index d6fba529b36301283d927baca65a96f2860cf9a1..7b27d8fc4a963bfba20ddd5d10637708d717e425 100644 (file)
@@ -33,6 +33,14 @@ my $defaultData = {
            type => 'integer',
            description => "server network port",
        },
+       mtu => {
+           type => 'integer',
+           description => "MTU for metrics transmission over UDP",
+           default => 1500,
+           min => 512,
+           maximum => 64*1024,
+           optional => 1,
+       },
     },
 };
 
@@ -69,7 +77,10 @@ sub _disconnect {
 # UDP cannot do more than 64k at once. Overwrite for different protocol limits.
 sub _send_batch_size {
     my ($class, $cfg) = @_;
-    return 1450; # assume 1500 MTU, empty IPv6 UDP packet needs 48 bytes overhead
+
+    # default to 1500 MTU, empty IPv6 UDP packet needs 48 bytes overhead 
+    my $mtu = $cfg->{mtu} // 1500;
+    return $mtu - 50;
 }
 
 # call with the smalles $data chunks possible