[pve-devel] [PATCH manager 2/3] Status: report errors on socket creation problems

Thomas Lamprecht t.lamprecht at proxmox.com
Fri May 20 12:07:39 CEST 2016


If the socket couldn't be created (e.g. FQDN not resolvable) we
continued witouth any hint, when actualy writing the data we then
die'd. The user then does not really know why, so report errors
if the socket creation failed.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/Status/Graphite.pm | 2 +-
 PVE/Status/InfluxDB.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm
index c125c90..f8d95d1 100644
--- a/PVE/Status/Graphite.pm
+++ b/PVE/Status/Graphite.pm
@@ -72,7 +72,7 @@ sub write_graphite_hash {
         PeerAddr    => $host,
         PeerPort    => $port,
         Proto       => 'udp',
-    );
+    ) || die "couldn't create carbon socket [$host]:$port - $@\n";
 
     write_graphite($carbon_socket, $d, $ctime, $path.".$object");
 
diff --git a/PVE/Status/InfluxDB.pm b/PVE/Status/InfluxDB.pm
index 4d1a237..8300147 100644
--- a/PVE/Status/InfluxDB.pm
+++ b/PVE/Status/InfluxDB.pm
@@ -92,7 +92,7 @@ sub write_influxdb_hash {
         PeerAddr    => $host,
         PeerPort    => $port,
         Proto       => 'udp',
-    );
+    ) || die "couldn't create influxdb socket [$host]:$port - $@\n";
 
     $socket->send($payload->{string});
     $socket->close() if $socket;
-- 
2.1.4





More information about the pve-devel mailing list