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.csa...@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" );
>              }
>          }
> 


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to