[smokeping-users] Slave/Master Update Patch

Tobias Oetiker tobi at oetiker.ch
Fri Sep 28 16:15:09 CEST 2007


Users,

Several people reported problems with the master slave setup.

The reason for the problems was as fahr as I can see that they used
hostnames which did not match [-a-z0-9] ...

With this patch things should work now even when your hostnames are
not just lowercase with numbers and dash ...

the patch also allows you do launch a slave claiming whatever name
you think it should have.

cheers
tobi
-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten
http://it.oetiker.ch tobi at oetiker.ch ++41 62 213 9902
-------------- next part --------------
Index: lib/Smokeping.pm
===================================================================
--- lib/Smokeping.pm	(revision 840)
+++ lib/Smokeping.pm	(working copy)
@@ -1956,7 +1956,7 @@
 If you want to have alerts for this target and all targets below it go to a particular address
 on top of the address already specified in the alert, you can add it here. This can be a comma separated list of items.
 DOC
-           slaves => { _re => '[-a-z0-9]+(?:\s+[-a-z0-9]+)*',
+           slaves => { _re => '${KEYD_RE}(?:\s+${KEYD_RE})*',
                         _re_error => 'slave1 [slave2]',
                         _doc => <<DOC },
 The slave names must match the slaves you have setup in the slaves section.
@@ -3712,7 +3712,7 @@
     GetOptions(\%opt, 'version', 'email', 'man:s','help','logfile=s','static-pages:s', 'debug-daemon',
                       'nosleep', 'makepod:s','debug','restart', 'filter=s', 'nodaemon|nodemon',
                       'config=s', 'check', 'gen-examples', 'reload', 
-                      'master-url=s','cache-dir=s','shared-secret=s') or pod2usage(2);
+                      'master-url=s','cache-dir=s','shared-secret=s','slave-name=s') or pod2usage(2);
     if($opt{version})  { print "$VERSION\n"; exit(0) };
     if(exists $opt{man}) {
         if ($opt{man}) {
@@ -3753,7 +3753,7 @@
             master_url => $opt{'master-url'},
             cache_dir => $opt{'cache-dir'},
             shared_secret => $secret,
-            slave_name => hostname,
+            slave_name => $opt{'slave-name'} || hostname(),
         };
         # this should get us a config set from the server
         my $new_conf = Smokeping::Slave::submit_results($slave_cfg,$cfg);
Index: bin/smokeping.dist
===================================================================
--- bin/smokeping.dist	(revision 838)
+++ bin/smokeping.dist	(working copy)
@@ -58,6 +58,11 @@
 
  --master-url=s Run smokeping in slave mode. Attach to master for config.
 
+ --slave-name=s By default the slave will use whatever it thinks its name
+                is, when talking to its master. In some cases you may
+                probably want to override this.
+
+
  --shared-secret=s File containing the shared secret for talking to the server.
 
  --cache-dir=s Directory for temporary data storage when running in slave mode.
Index: CHANGES
===================================================================
--- CHANGES	(revision 842)
+++ CHANGES	(working copy)
@@ -1,3 +1,7 @@
+* Make master/slave work when slave names contain uppercase letters and full dots. -- tobi
+
+* Allow slave-name to be configured -- tobi
+
 * switched to config grammar 1.10  -- tobi
 
 * make sure reload_config reloads in any case even when the config has not changed ... 


More information about the smokeping-users mailing list