[pve-devel] [PATCH manager] add graphite tcp support

Dominik Csapak d.csapak at proxmox.com
Tue Nov 5 11:03:09 CET 2019


Hi,

thanks for the patch :)
looks good for the most part, but afaics you did not
sign our CLA yet, please see our Developer Documentation[0] for that.

also it would be nice to extend our documentation for this
in the pve-docs git repository[1], in the file
'pve-external-metric-server.adoc'[2], but this could also be an extra patch

one nitpick inline, aside from that it looks good to me

0: https://pve.proxmox.com/wiki/Developer_Documentation
1: https://git.proxmox.com/?p=pve-docs.git;a=summary
2: 
https://git.proxmox.com/?p=pve-docs.git;a=blob;f=pve-external-metric-server.adoc;h=c9e1107fd45e0f1e205d24fd5e0fa1357bc0b658;hb=refs/heads/master

On 11/4/19 4:48 PM, Martin Verges wrote:
> 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
> 
> Signed-off-by: Martin Verges <martin.verges at croit.io>
> ---
>   PVE/Status/Graphite.pm | 5 ++++-
>   PVE/Status/Plugin.pm   | 6 ++++++
>   2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm
> index d0e1563d..1180a774 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

the indentation seems wrong here (space instead of tab)

>   #	path proxmox.mycluster
>   #	disable 0
>   #
> @@ -32,6 +33,7 @@ sub options {
>       return {
>   	server => {},
>   	port => { optional => 1 },
> +	proto => { optional => 1 },
>   	path => { optional => 1 },
>   	disable => { optional => 1 },
>       };
> @@ -76,11 +78,12 @@ 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 $carbon_socket = IO::Socket::IP->new(
>   	PeerAddr    => $host,
>   	PeerPort    => $port,
> -	Proto       => 'udp',
> +	Proto       => $proto,
>       ) || die "couldn't create carbon socket [$host]:$port - $@\n";
>   
>       write_graphite($carbon_socket, $d, $ctime, $path.".$object");
> diff --git a/PVE/Status/Plugin.pm b/PVE/Status/Plugin.pm
> index 482142c0..3012def4 100644
> --- a/PVE/Status/Plugin.pm
> +++ b/PVE/Status/Plugin.pm
> @@ -32,6 +32,12 @@ my $defaultData = {
>   	    type => 'integer',
>   	    description => "server network port",
>   	},
> +	proto => {
> +	    type => 'string',
> +	    enum => ['udp', 'tcp'],
> +	    description => "send graphite data using tcp or udp (default)",
> +	    optional => 1,
> +  },
>       },
>   };
>   
> 





More information about the pve-devel mailing list