public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update
@ 2020-11-25 12:56 Dominik Csapak
  2020-11-25 13:56 ` [pve-devel] applied: " Thomas Lamprecht
  2020-12-03 16:55 ` [pve-devel] " Thomas Lamprecht
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Csapak @ 2020-11-25 12:56 UTC (permalink / raw)
  To: pve-devel

just a basic check, but better than not checking at all

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/API2/Cluster/MetricServer.pm | 5 +++++
 PVE/Status/Plugin.pm             | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/PVE/API2/Cluster/MetricServer.pm b/PVE/API2/Cluster/MetricServer.pm
index b96228b0..9a14985e 100644
--- a/PVE/API2/Cluster/MetricServer.pm
+++ b/PVE/API2/Cluster/MetricServer.pm
@@ -159,6 +159,9 @@ __PACKAGE__->register_method ({
 		if $cfg->{ids}->{$id};
 
 	    my $opts = $plugin->check_config($id, $param, 1, 1);
+
+	    $plugin->test_connection($opts);
+
 	    $cfg->{ids}->{$id} = $opts;
 
 	    PVE::Cluster::cfs_write_file('status.cfg', $cfg);
@@ -198,6 +201,8 @@ __PACKAGE__->register_method ({
 	    my $plugin = PVE::Status::Plugin->lookup($data->{type});
 	    my $opts = $plugin->check_config($id, $param, 0, 1);
 
+	    $plugin->test_connection($opts);
+
 	    for my $k (keys %$opts) {
 		$data->{$k} = $opts->{$k};
 	    }
diff --git a/PVE/Status/Plugin.pm b/PVE/Status/Plugin.pm
index 0faf0da6..c3e0bec1 100644
--- a/PVE/Status/Plugin.pm
+++ b/PVE/Status/Plugin.pm
@@ -126,6 +126,13 @@ sub send {
 	or die "failed to send metrics: $!\n";
 }
 
+sub test_connection {
+    my ($class, $cfg) = @_;
+
+    my $conn = $class->_connect($cfg);
+    $class->_disconnect($conn);
+}
+
 sub update_node_status {
     my ($class, $txn, $node, $data, $ctime) = @_;
     die "please implement inside plugin";
-- 
2.20.1





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH manager] api: metrics/server: test connection on add/update
  2020-11-25 12:56 [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update Dominik Csapak
@ 2020-11-25 13:56 ` Thomas Lamprecht
  2020-12-03 16:55 ` [pve-devel] " Thomas Lamprecht
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2020-11-25 13:56 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 25.11.20 13:56, Dominik Csapak wrote:
> just a basic check, but better than not checking at all
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  PVE/API2/Cluster/MetricServer.pm | 5 +++++
>  PVE/Status/Plugin.pm             | 7 +++++++
>  2 files changed, 12 insertions(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update
  2020-11-25 12:56 [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update Dominik Csapak
  2020-11-25 13:56 ` [pve-devel] applied: " Thomas Lamprecht
@ 2020-12-03 16:55 ` Thomas Lamprecht
  2020-12-07 14:30   ` Thomas Lamprecht
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Lamprecht @ 2020-12-03 16:55 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 25.11.20 13:56, Dominik Csapak wrote:
> just a basic check, but better than not checking at all
> 

so, just had an issue with the network (some test IPv6 LAN here) and had a metric
server configured on that net, thus pvestatd spammed the log with "network
unreachable" messages, and all my resources got the good ol' question mark in the
gui, so far so good.
But, I then tried to disable that ext. metrics entry, but we then *also* do a
connection check which obv. fails ^^






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update
  2020-12-03 16:55 ` [pve-devel] " Thomas Lamprecht
@ 2020-12-07 14:30   ` Thomas Lamprecht
  2020-12-07 14:32     ` Dominik Csapak
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Lamprecht @ 2020-12-07 14:30 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 03.12.20 17:55, Thomas Lamprecht wrote:
> On 25.11.20 13:56, Dominik Csapak wrote:
>> just a basic check, but better than not checking at all
>>
> 
> so, just had an issue with the network (some test IPv6 LAN here) and had a metric
> server configured on that net, thus pvestatd spammed the log with "network
> unreachable" messages, and all my resources got the good ol' question mark in the
> gui, so far so good.
> But, I then tried to disable that ext. metrics entry, but we then *also* do a
> connection check which obv. fails ^^
> 

any news on above?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update
  2020-12-07 14:30   ` Thomas Lamprecht
@ 2020-12-07 14:32     ` Dominik Csapak
  0 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2020-12-07 14:32 UTC (permalink / raw)
  To: Proxmox VE development discussion

On 12/7/20 3:30 PM, Thomas Lamprecht wrote:
> On 03.12.20 17:55, Thomas Lamprecht wrote:
>> On 25.11.20 13:56, Dominik Csapak wrote:
>>> just a basic check, but better than not checking at all
>>>
>>
>> so, just had an issue with the network (some test IPv6 LAN here) and had a metric
>> server configured on that net, thus pvestatd spammed the log with "network
>> unreachable" messages, and all my resources got the good ol' question mark in the
>> gui, so far so good.
>> But, I then tried to disable that ext. metrics entry, but we then *also* do a
>> connection check which obv. fails ^^
>>
> 
> any news on above?
> 

oh sorry, i have a patch here, i thought i sent it already...
coming right up ..




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-07 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 12:56 [pve-devel] [PATCH manager] api: metrics/server: test connection on add/update Dominik Csapak
2020-11-25 13:56 ` [pve-devel] applied: " Thomas Lamprecht
2020-12-03 16:55 ` [pve-devel] " Thomas Lamprecht
2020-12-07 14:30   ` Thomas Lamprecht
2020-12-07 14:32     ` Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal