Subversion Repositories sysadmin_scripts

Rev

Rev 89 | Rev 91 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89 Rev 90
Line 115... Line 115...
115
# forget to do it everyplace it is needed
115
# forget to do it everyplace it is needed
116
sub flagFileName {
116
sub flagFileName {
117
   my $name = shift;
117
   my $name = shift;
118
   return "/tmp/$name.down";
118
   return "/tmp/$name.down";
119
}
119
}
-
 
120
 
-
 
121
# report the outage
-
 
122
sub reportOutage {
-
 
123
   my ( $name,$parameters ) = @_;
-
 
124
   # do something really nice here
120
   
125
}
121
 
126
 
122
# this will put a flag file in /tmp/monitorNetwork which will control
127
# this will put a flag file in /tmp/monitorNetwork which will control
123
# countdown in case of failure
128
# countdown in case of failure
124
# if the countdown is exceeded, it will report the status 
129
# if the countdown is exceeded, it will report the status 
125
sub processFailure {
130
sub processFailure {
126
   my ( $name, $parameters ) = @_;
131
   my ( $name, $parameters ) = @_;
-
 
132
   # temporary for testing
127
   print "Failed test for $name\n";
133
   print "Failed test for $name\n";
-
 
134
   my $flagFileName = $flagFileName( $name );
-
 
135
   my $remainingCounts = $parameters->{'failure count'};
-
 
136
   if ( -f $flagFileName ) {
-
 
137
      # open flag file, read the value into $remaingCounts
-
 
138
      return if $remainingCounts == -1;
-
 
139
   }
-
 
140
   if ( $remainingCounts-- == 0 ) {
-
 
141
      &ReportOutage( $name, $parameters );
-
 
142
   }
-
 
143
   # open flag file, write new $remainingCounts to it
128
}
144
}
129
 
145
 
130
# we are up, so check for any flag file and unlink if found
146
# we are up, so check for any flag file and unlink if found
131
sub cleanUp {
147
sub cleanUp {
132
   my $name = shift;
148
   my $name = shift;