summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDarren Murphy <darren@victoriajd.com>2012-03-23 06:25:28 +0100
committerDarren Murphy <darren@victoriajd.com>2012-03-23 06:25:28 +0100
commit11cf1d954dc92e4d4f2a8dc8fed729f0ef04bf7a (patch)
treeedc8bc12c004e8bb6a2a5908f2174ac0643cecf9 /lib
parent8e9692b5f8a39eea12521f7ae9ad9b62c28ae6f5 (diff)
parent79b6c9346c950d0b3e22dc9ba337bbcdcbed052e (diff)
downloadsmokeping-11cf1d954dc92e4d4f2a8dc8fed729f0ef04bf7a.tar.gz
smokeping-11cf1d954dc92e4d4f2a8dc8fed729f0ef04bf7a.tar.xz
Merge remote branch 'tobi/master' into integration
Diffstat (limited to 'lib')
-rw-r--r--lib/Smokeping.pm16
-rw-r--r--lib/Smokeping/probes/SipSak.pm15
2 files changed, 24 insertions, 7 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index b15880b..bba2a6b 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -1874,10 +1874,18 @@ sub check_alerts {
next unless $addr;
if ( $addr =~ /^\|(.+)/) {
my $cmd = $1;
- if ($edgetrigger) {
- system $cmd,$_,$line,$loss,$rtt,$tree->{host}, ($what =~/raise/);
- } else {
- system $cmd,$_,$line,$loss,$rtt,$tree->{host};
+ # fork them in case they
+ unless ($pid = fork) {
+ unless (fork) {
+ $SIG{CHLD} = 'DEFAULT';
+ if ($edgetrigger) {
+ exec $cmd,$_,$line,$loss,$rtt,$tree->{host}, ($what =~/raise/);
+ } else {
+ exec $cmd,$_,$line,$loss,$rtt,$tree->{host};
+ }
+ die "exec failed!";
+ }
+ exit 0;
}
}
elsif ( $addr =~ /^snpp:(.+)/ ) {
diff --git a/lib/Smokeping/probes/SipSak.pm b/lib/Smokeping/probes/SipSak.pm
index 9e6c3a2..25f1649 100644
--- a/lib/Smokeping/probes/SipSak.pm
+++ b/lib/Smokeping/probes/SipSak.pm
@@ -73,14 +73,23 @@ sub pingone {
shift @reply;
my $filter = '.*';
+ $self->do_debug("SipSak: got ".(scalar @reply)." replies, expected $pingcount");
if (scalar @reply > $pingcount){
- $filter = $keep eq 'yes' ? 'final' : 'provisional';
+ $filter = $keep eq 'yes' ? 'final received' : 'provisional received';
}
for my $item (@reply){
- next unless $item =~ /$filter/;
- if (/^(?:\s+and|\sreceived\safter)\s(\d+(?:\.\d+))\sms\s/){
+ $self->do_debug("SipSak: looking at '$item'");
+ if (not $item =~ /$filter/){
+ $self->do_debug("SipSak: skipping as there was not match for $filter");
+ next;
+ }
+ if ($item =~ /(?:\sand|\sreceived\safter)\s(\d+(?:\.\d+)?)\sms\s/){
+ $self->do_debug("SipSak: match");
push @times,$1/1000;
}
+ else {
+ $self->do_debug("SipSak: no match");
+ }
}
return sort { $a <=> $b } @times;
}