sorry, the git send-email is awful ;/ I hope the patch and documentation patch is now to your satisfaction as it includes a timeout for tcp as well and therefore should not cause any trouble. We use deployed it on our cluster and so far it seems to work fine. However we do not have a test environment and I'm not a perl programmer.
-- Martin Verges Managing director Mobile: +49 174 9335695 E-Mail: martin.ver...@croit.io Chat: https://t.me/MartinVerges croit GmbH, Freseniusstr. 31h, 81247 Munich CEO: Martin Verges - VAT-ID: DE310638492 Com. register: Amtsgericht Munich HRB 231263 Web: https://croit.io YouTube: https://goo.gl/PGE1Bx Am Di., 5. Nov. 2019 um 17:41 Uhr schrieb Martin Verges < martin.ver...@croit.io>: > This change allows sending statistics to graphite over TCP. > > So far only UDP is possible, which is not available in some environments, > like behind a loadbalancer. > > Configuration example: > ~ $ cat /etc/pve/status.cfg > > graphite: > server 10.20.30.40 > port 2003 > path proxmox > proto tcp > timeout 3 > > Signed-off-by: Martin Verges <martin.ver...@croit.io> > --- > PVE/Status/Graphite.pm | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm > index d0e1563d..88eaa000 100644 > --- a/PVE/Status/Graphite.pm > +++ b/PVE/Status/Graphite.pm > @@ -9,6 +9,7 @@ use PVE::Status::Plugin; > #graphite: > # server test > # port 2003 > +# proto udp > # path proxmox.mycluster > # disable 0 > # > @@ -25,6 +26,17 @@ sub properties { > type => 'string', format => 'graphite-path', > description => "root graphite path (ex: > proxmox.mycluster.mykey)", > }, > + timeout => { > + type => 'integer', > + description => "graphite tcp socket timeout (default=3)", > + optional => 1 > + }, > + proto => { > + type => 'string', > + enum => ['udp', 'tcp'], > + description => "send graphite data using tcp or udp (default)", > + optional => 1, > + }, > }; > } > > @@ -32,6 +44,8 @@ sub options { > return { > server => {}, > port => { optional => 1 }, > + proto => { optional => 1 }, > + timeout => { optional => 1 }, > path => { optional => 1 }, > disable => { optional => 1 }, > }; > @@ -76,13 +90,18 @@ sub write_graphite_hash { > my $host = $plugin_config->{server}; > my $port = $plugin_config->{port} ? $plugin_config->{port} : 2003; > my $path = $plugin_config->{path} ? $plugin_config->{path} : > 'proxmox'; > + my $proto = $plugin_config->{proto} ? $plugin_config->{proto} : 'udp'; > + my $timeout = $plugin_config->{timeout} ? $plugin_config->{timeout} : > 3; > > my $carbon_socket = IO::Socket::IP->new( > PeerAddr => $host, > PeerPort => $port, > - Proto => 'udp', > + Proto => $proto, > + Timeout => $timeout, > ) || die "couldn't create carbon socket [$host]:$port - $@\n"; > > + $socket->read_timeout($timeout); > + > write_graphite($carbon_socket, $d, $ctime, $path.".$object"); > > $carbon_socket->close() if $carbon_socket; > -- > 2.20.1 > > _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel