]> jspc29.x-matter.uni-frankfurt.de Git - hadesicinga.git/commitdiff
New dirs added. Sergey.
authorhadaq <hadaq>
Mon, 10 May 2010 17:12:15 +0000 (17:12 +0000)
committerhadaq <hadaq>
Mon, 10 May 2010 17:12:15 +0000 (17:12 +0000)
plugins/check_backup.pl

index 4820c57a046e37c6557a399694a716b066215c6f..aa24c3488f951b82fd5f2edced69886a58138e9f 100755 (executable)
@@ -28,6 +28,16 @@ my $count = 0;
 my $status : shared = "OK";
 my @screenPID;
 
+my @backup_list = ("depc234",  
+                  "hadeb05",
+                  "hades17",  
+                  "hades25",  
+                  "hades27",  
+                  "hadesdaq",  
+                  "kp1pc098",
+                  "lxhadeb01",
+                  "lxhadesdaq");
+
 our $server_port = '50501';
 our $protocol    = 'tcp';
 
@@ -37,6 +47,7 @@ threads->new( \&statusServer);
 
 exit(0);
 
+##################### END OF MAIN #####################
 
 sub main {
 
@@ -47,19 +58,22 @@ sub main {
 
        #--- check the presence of all 5 directories inside
        my @array = `ls /data/backup/.snapshots/hourly.0/`;
+
        #--- check time of only the latest dir: hourly.0
        my @dir   = `ls -ltr /data/backup/.snapshots/`;
        
        foreach my $line (@array) 
        {
            #--- count directories
-           if( $line =~ /(\bhadesdaq\b|\blxhadesdaq\b|\bhadeb05\b|\bhades25\b|\bdepc234\b)/ ) { 
-               $count ++;
-           }   
+           foreach my $bdir (@backup_list){
+               if( $line =~ /($bdir)/ ){
+                   $count ++;
+               }
+           }
        } 
 
-       #--- backup must have 5 main directories inside!
-       if( $count < 5 ){
+       #--- backup must have all directories inside!
+       if( $count < 1 + $#backup_list ){
            $status = "WARNING - backup directory missing";
        }
        else{