~ubuntu-branches/ubuntu/oneiric/smokeping/oneiric-updates

« back to all changes in this revision

Viewing changes to lib/Smokeping/probes/base.pm

  • Committer: Bazaar Package Importer
  • Author(s): Niko Tyni
  • Date: 2008-08-29 18:29:34 UTC
  • mfrom: (2.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080829182934-ad5b9csusoqn1155
Tags: 2.3.6-3
* Unset LC_ALL in the init script because the daemon needs to 
  reset LC_NUMERIC. (Closes: #489766)
* Fix a bashism in the postinst script. Thanks, lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    my $class   = ref($this) || $this;
65
65
    my $self = { properties => shift, cfg => shift, 
66
66
    name => shift,
67
 
    targets => {}, rtts => {}, addrlookup => {}};
 
67
    targets => {}, rtts => {}, addrlookup => {}, rounds_count => 0};
68
68
    bless $self, $class;
69
69
    return $self;
70
70
}
74
74
    my $self = shift;
75
75
    my $tree = shift;
76
76
    
 
77
    $self->{target_count}++; # increment this anyway
 
78
    return if defined $tree->{nomasterpoll} and $tree->{nomasterpoll} eq "yes";
77
79
    $self->{targets}{$tree} = shift;
78
80
}
79
81
 
87
89
}
88
90
 
89
91
sub ProbeDesc ($) {
90
 
    return "Probe which does not overrivd the ProbeDesc methode";
91
 
}    
 
92
    return "Probe which does not override the ProbeDesc method";
 
93
}    
 
94
 
 
95
sub ProbeUnit ($) {
 
96
    return "Seconds";
 
97
}    
 
98
 
 
99
# this is a read-only variable that should get incremented by
 
100
# the ping() method
 
101
sub rounds_count ($) {
 
102
    my $self = shift;
 
103
    return $self->{rounds_count};
 
104
}
 
105
 
 
106
sub increment_rounds_count ($) {
 
107
    my $self = shift;
 
108
    $self->{rounds_count}++;
 
109
}
92
110
 
93
111
sub target2dynfile ($$) {
94
112
    # the targets are stored in the $self->{targets}
131
149
      $age = 'U';
132
150
    }
133
151
    if ( $entries == 0 ){
 
152
      $self->do_log("Warning: got zero answers from $tree->{addr}($tree->{probe}) $self->{targets}{$tree}");
134
153
      $age = 'U';
135
154
      $loss = 'U';
136
155
      if ( -f $dynbase.".adr"
264
283
 
265
284
sub target_count {
266
285
        my $self = shift;
267
 
        return scalar keys %{$self->{targets}};
 
286
        $self->{target_count} = 0 if !defined $self->{target_count};
 
287
        return $self->{target_count};
268
288
}
269
289
 
270
290
sub probevars {