metrix: influx: fix default api_prefix

we set the api prefix by default to '/' so we always triggered
the the replacement and added '///' which is wrong and does not
work for the 'health' api path
(influxdb returns 404 for 'https://ip:port///health')

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-03-15 15:28:11 +01:00
parent c7777408ea
commit bc33c73963

View File

@ -172,7 +172,7 @@ sub _get_v2url {
my ($cfg, $api_path) = @_; my ($cfg, $api_path) = @_;
my ($proto, $host, $port) = $cfg->@{qw(influxdbproto server port)}; my ($proto, $host, $port) = $cfg->@{qw(influxdbproto server port)};
my $api_prefix = $cfg->{'api-path-prefix'} // '/'; my $api_prefix = $cfg->{'api-path-prefix'} // '/';
if ($api_prefix ne '' && $api_prefix =~ m!^/*(.+)/*$!) { if ($api_prefix ne '/' && $api_prefix =~ m!^/*(.+)/*$!) {
$api_prefix = "/$1/"; $api_prefix = "/$1/";
} }