[smokeping-users] [PATCH] bug fix for filter feature in 1.24
BALIGANT Francois WANADOO
francois.baligant at wanadoo.com
Mon Dec 1 20:12:09 MET 2003
The new filter feature in 1.24 is really useful for consolidating RRDs from various
sources but also to separate probes on a single box into different process so a timeout
doesnt affect all the probes.
There is 2 bugs in 1.24 that needs attention.
The first one is proper GetOpt handling for the new --filter argument (maybe my version of GetOpt is picky)
The second one is that even if you specify a filter, smokeping will still update *all* the RRDs regardless if they match the filter or not in update_rrds.
Yes it does only the measures for the filtered ones but all RRDs are updated which cause packet lost to mysteriously appears in FPing RRDs when another smokeping process just updating Curl RRDs write null values to FPing RRDs as well.
Patch is below, hope it helps others.
Francois Baligant (francois.baligant at wanadoo.com)
Wanadoo S.A. - Network Strategy
Tel : +33 1 58 88 53 19
48 Rue Camille Desmoulins
92791 Issy les Moulineaux Cedex 9
France
--- smokeping-1.24-orig/lib/Smokeping.pm 2003-10-05 16:20:05.000000000 +0200
+++ smokeping-1.24/lib/Smokeping.pm 2003-12-01 19:56:04.000000000 +0100
@@ -724,6 +724,7 @@
remark => ($tree->{remark} || ''),
overview => get_overview( $cfg,$q,$tree,$open ),
body => get_detail( $cfg,$q,$tree,$open ),
+ target_ip => ($tree->{host} || ''),
owner => $cfg->{General}{owner},
contact => $cfg->{General}{contact},
author => '<A HREF="http://tobi.oetiker.ch/">Tobi Oetiker</A>',
@@ -757,8 +758,25 @@
my $probe = shift;
my $tree = shift;
my $name = shift;
+
$probe = $tree->{probe} if defined $tree->{probe};
foreach my $prop (keys %{$tree}) {
+
+ if ($opt{filter} && scalar @{$opt{filter}}){
+ my $ok = 0;
+ for (@{$opt{filter}}){
+ /^\!(.+)$/ && do {
+ "$name/$prop" =~ /^$1/ && do{ $ok = 0};
+ next;
+ };
+ /^(.+)$/ && do {
+ "$name/$prop" =~ /^$1/ && do {$ok = 1};
+ next;
+ };
+ }
+ next unless $ok;
+ };
+
next if $prop eq "PROBE_CONF";
if (ref $tree->{$prop} eq 'HASH'){
update_rrds $cfg, $probes, $probe, $tree->{$prop}, $name."/$prop";
@@ -1776,7 +1794,7 @@
my $cfgfile = shift;
$opt{filter}=[];
GetOptions(\%opt, 'version', 'email', ,'man','help',
- 'makepod','debug','restart', 'nodemon|nodaemon') or pod2usage(2);
+ 'makepod','debug','restart', 'filter=s', 'nodemon|nodaemon') or pod2usage(2);
if($opt{version}) { print "$RCS_VERSION\n"; exit(0) };
if($opt{man}) { pod2usage(-verbose => 2); exit 0 };
if($opt{help}) { pod2usage(-verbose => 1); exit 0 };
--
Unsubscribe mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/smokeping-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the smokeping-users
mailing list