diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2008-03-18 23:54:03 +0100 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2008-03-18 23:54:03 +0100 |
commit | 43e65375aa5d23b7cbee07996a5e10c2b95b0ffd (patch) | |
tree | 822f27c6de23636f809ad57f72e6f5f70ebd48fc /lib/Smokeping/Slave.pm | |
parent | e06a42e7920eb3ad2cafc62b5db21746126ce37c (diff) | |
download | smokeping-43e65375aa5d23b7cbee07996a5e10c2b95b0ffd.tar.gz smokeping-43e65375aa5d23b7cbee07996a5e10c2b95b0ffd.tar.xz |
added protocol level checks and upgrade notes
Diffstat (limited to 'lib/Smokeping/Slave.pm')
-rw-r--r-- | lib/Smokeping/Slave.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Smokeping/Slave.pm b/lib/Smokeping/Slave.pm index e0e6127..7cc3b7e 100644 --- a/lib/Smokeping/Slave.pm +++ b/lib/Smokeping/Slave.pm @@ -8,7 +8,9 @@ use Digest::HMAC_MD5 qw(hmac_md5_hex); use LWP::UserAgent; use Safe; use Smokeping; - +# keep this in sync with the Slave.pm part +# only update if you have to force a parallel upgrade +my $PROTOCOL = "2"; =head1 NAME @@ -81,6 +83,7 @@ sub submit_results { Content => [ slave => $slave_cfg->{slave_name}, key => hmac_md5_hex($data_dump,$slave_cfg->{shared_secret}), + protocol => $PROTOCOL, data => $data_dump, config_time => $cfg->{__last} || 0, ], @@ -88,6 +91,13 @@ sub submit_results { if ($response->is_success){ my $data = $response->content; my $key = $response->header('Key'); + my $protocol = $response->header('Protocol') || '?'; + + if ($protocol ne $PROTOCOL){ + warn "WARNING $slave_cfg->{master_url} sent data with protocol $protocol. Expected $PROTOCOL."; + return undef; + } + if ($response->header('Content-Type') ne 'application/smokeping-config'){ warn "$data\n" unless $data =~ /OK/; Smokeping::do_debuglog("Sent data to Server. Server said $data"); |