mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-24 21:53:40 +00:00
metrics: influx: send along auth token on connection test too
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
9f8d8f2b05
commit
bb35a833d1
@ -207,6 +207,11 @@ sub test_connection {
|
||||
my $url = "${proto}://${host}:${port}/health";
|
||||
my $ua = LWP::UserAgent->new();
|
||||
$ua->timeout($cfg->{timeout} // 1);
|
||||
# in the initial add connection test, the token may still be in $cfg
|
||||
my $token = $cfg->{token} // get_credentials($id);
|
||||
if (defined($token)) {
|
||||
$ua->default_header("Authorization" => "Token $token");
|
||||
}
|
||||
my $response = $ua->get($url);
|
||||
|
||||
if (!$response->is_success) {
|
||||
|
Loading…
Reference in New Issue
Block a user