From 701074d427c11dd8cd5292273d4e47eb903887c8 Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 10 May 2010 17:12:15 +0000 Subject: [PATCH] New dirs added. Sergey. --- plugins/check_backup.pl | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/plugins/check_backup.pl b/plugins/check_backup.pl index 4820c57..aa24c34 100755 --- a/plugins/check_backup.pl +++ b/plugins/check_backup.pl @@ -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{ -- 2.43.0