[pve-devel] [PATCH container] Proposed fix for #1326: Added secondary server to graphite plugin as secondary_server parameter. It may be required if graphite data needs to be mirrored as in the case here. Carbon-relay is too much...

Pavel Andreev pavel at andreew.spb.ru
Thu Mar 30 17:10:02 CEST 2017


Signed-off-by: Pavel Andreev <pavel at andreew.spb.ru>
---
 PVE/Status/Graphite.pm |    6 +++++-
 PVE/Status/Plugin.pm   |    4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm
index 849930f..50075cc 100644
--- a/PVE/Status/Graphite.pm
+++ b/PVE/Status/Graphite.pm
@@ -7,6 +7,7 @@ use PVE::Status::Plugin;
 # example config (/etc/pve/status.cfg)
 #graphite:
 #	server test
+#	secondary_server test
 #	port 2003
 #	path proxmox.mycluster
 #	disable 0
@@ -30,6 +31,7 @@ sub properties {
 sub options {
     return {
 	server => {},
+        secondary_server => {},
 	port => { optional => 1 },
 	path => { optional => 1 },
 	disable => { optional => 1 },
@@ -64,7 +66,8 @@ sub update_storage_status {
 sub write_graphite_hash {
     my ($plugin_config, $d, $ctime, $object) = @_;
 
-    my $host = $plugin_config->{server};
+    my @hosts = ($plugin_config->{server},$plugin_config->{secondary_server});
+    foreach my $host (@hosts) {
     my $port = $plugin_config->{port} ? $plugin_config->{port} : 2003;
     my $path = $plugin_config->{path} ? $plugin_config->{path} : 'proxmox';
 
@@ -78,6 +81,7 @@ sub write_graphite_hash {
 
     $carbon_socket->close() if $carbon_socket;
 
+    }
 }
 
 sub write_graphite {
diff --git a/PVE/Status/Plugin.pm b/PVE/Status/Plugin.pm
index ff7af89..8e40d58 100644
--- a/PVE/Status/Plugin.pm
+++ b/PVE/Status/Plugin.pm
@@ -30,6 +30,10 @@ my $defaultData = {
 	    type => 'string', format => 'address',
 	    description => "server dns name or IP address",
 	},
+        secondary_server => {
+            type => 'string', format => 'address',
+            description => "server dns name or IP address",
+        },
 	port => {
 	    type => 'integer',
 	    description => "server network port",
-- 
1.7.9.5




More information about the pve-devel mailing list