~vcs-imports/mysql-mmm/2.0

« back to all changes in this revision

Viewing changes to lib/Monitor/Agent.pm

  • Committer: mail at pascalhofmann
  • Date: 2009-02-05 09:34:25 UTC
  • Revision ID: vcs-imports@canonical.com-20090205093425-kc4rq5hdbtj6t885
ph:
- Removed may_get_flapping-stuff from preferred host handling
- Removed some notes
- Deny move_role if the role is assigned to the preferred host
- Removed bad log messages about agent availability.
- ignore replication fail for 60 seconds (default value of master-connect-retry) after peer host went back online.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
        uptime          => '$',
24
24
        last_uptime     => '$',
25
25
 
 
26
        online_since=> '$',
 
27
 
26
28
        flapping        => '$',
27
29
        flapstart       => '$',
28
30
        flapcount       => '$',
36
38
                my $new_state = shift;
37
39
                my $old_state = $self->{'MMM::Monitor::Agent::state'};
38
40
 
 
41
                if ($old_state ne $new_state && $new_state eq 'ONLINE') {
 
42
                        $self->online_since(time());
 
43
                }
 
44
 
39
45
                if ($old_state ne $new_state && $main::config->{monitor}->{flap_count}) {
40
46
                        if ($old_state eq 'ONLINE' and $new_state ne 'ADMIN_OFFLINE') {
41
47
                                if (!$self->flapstart || $self->flapstart < time() - $main::config->{monitor}->{flap_duration}) {
58
64
        return $self->{'MMM::Monitor::Agent::state'};
59
65
}
60
66
 
61
 
sub may_get_flapping($) {
62
 
        my $self = shift;
63
 
        if (    !$self->flapcount
64
 
                ||      $self->flapcount < 2
65
 
                ||      !$self->flapstart
66
 
                ||      $self->flapstart < time() - $main::config->{monitor}->{flap_duration}
67
 
        ) {
68
 
                return 0;
69
 
        }
70
 
        
71
 
        return 1;
72
 
}
73
 
 
74
67
sub _send_command {
75
68
        my $self        = shift;
76
69
        my $cmd         = shift;