The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 11-18-2008
eliraza6 eliraza6 is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 56
Quote:
Originally Posted by radoulov View Post
Something to begin with (it will print any mismatch):


Code:
#! /usr/bin/env perl


use warnings;
use strict;

my ($Thresholds_f, $Queue) = 
  ('/path/to/thresholds_file', '/users/tibprod/scripts/ShowQueues_leaiprod.sh|');
my %Thresholds_h;

open TH, '<', $Thresholds_f  or die "$Thresholds_f: $!\n";
  
while (<TH>) {
  tr/"//d;
  my @Fields = split /\s+/;
  $Thresholds_h{$Fields[0]} = [@Fields[1,2]];
  }

close TH;  

open QUEUE, '<', $Queue or die "$Queue: $!\n";

while (<QUEUE>) {
  my $Flag = 0;
  my @Fields = split /\s+/;
  while (my($Key, $Ref) = each %Thresholds_h) {
    my @Values = @$Ref;
    if ($Fields[0] =~ /^$Key$/) {
      print "\nChecking queue: $Fields[0] ... ";
      if ($Fields[1] != $Values[0]) {
        print "\n\n\t--> queue threshold mismatch: \n\n\tcurrent status: ",
        $Fields[1], "\n\tthreshold:      ", $Values[0], "\n";
        $Flag++
        }
      if ($Fields[2] != $Values[1]) {
         print "\n\t--> listeners threshold mismatch: \n\n\tcurrent status: ",
        $Fields[2], "\n\tthreshold:      ", $Values[1], "\n";
        $Flag++
        }
      print "OK\n\n" unless $Flag;    
      }
    }
  }  
  
close QUEUE;
WOW! that's look like you put a lot of work in to it!
actually i'm not in the office right now but i'll check this and let you know first thing!

thanks alot m8!