[pve-devel] [PATCH manager] fix #1683: do not send non-numeric values to graphite
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Mar 2 09:58:02 CET 2018
On 3/1/18 4:44 PM, Dominik Csapak wrote:
> the graphite daemons which accept the data (carbon), only
> accepts numeric values, and logs all invalid lines
>
> since that were about 5 values per vm/ct this generated lot of noise
> in the carbon log
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> PVE/Status/Graphite.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm
> index 849930f0..636b9566 100644
> --- a/PVE/Status/Graphite.pm
> +++ b/PVE/Status/Graphite.pm
> @@ -93,7 +93,7 @@ sub write_graphite {
> if ( defined $value ) {
> if ( ref $value eq 'HASH' ) {
> write_graphite($carbon_socket, $value, $ctime, $path);
> - }else {
> + } elsif ($value =~ m/^[+-]?(?:[0-9]*\.)?[0-9]+$/){
can we use:
m/^[+-]?[0-9]*\.?[0-9]+$/
here? no need for the capturing group, only to make it non-capturing.
Also maybe an else branch with a warning log instead of silently throwing away the value?
> $carbon_socket->send( "$path $value $ctime\n" );
> }
> }
>
More information about the pve-devel
mailing list