The UNIX and Linux Forums  

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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help for a perl script - writing to a data file meghana Shell Programming and Scripting 2 02-04-2008 05:05 PM
Perl Unix Script Writing Dinkster UNIX for Dummies Questions & Answers 1 02-01-2008 04:09 PM
Writing CGI scripting using perl alma Shell Programming and Scripting 7 04-23-2007 10:46 PM
help for writing a script amodha UNIX for Dummies Questions & Answers 2 04-10-2006 07:21 AM
Writing perl module jo_aze Shell Programming and Scripting 4 08-06-2003 12:10 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-18-2008
eliraza6 eliraza6 is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 56
Need help with writing a perl script

Hi all!

I have to write a perl script that gets trashholds from a file and match them with an output of a command.

The trashhold file looks like this:

Code:
"pl-it_prod.GW.Sync.reply.*"    "500"   "-1"    ""      ""
"pl-it_prod.A.*"        "100"   "-1"    ""      ""
"application.log"       "50"    "-1"    ""      ""
"eai.log.process.*"     "50"    "-1"    ""      ""
"pl-it_prod.S.*"        "10"    "-2"    ""      ""
"pl-it_prod.P.*"        "10"    "-2"    ""      ""
"pl-it_prod.GW.>"       "10"    "-2"    ""      ""
"pl-it_prod.*.GW.Async.Reply.JMS"       "10"    "-1"    ""      ""
The first filed is the queue name (or part of it), the second filed is the trashold of the queue and the third is the trashold of the number of listeners handling this queue.
When there is a "-" (minus) that meens that the trashold should be checked backwords (less than the trashold...).

The commnad that gives the real state of the queues return an output like this:
Code:
application.log 0       2
application.log.converter       0       0
eai.log.process.activity        0       2
eai.log.process.data    0       20
eai_inspection.start_test       0       1
pl-it_prod.A.EngSystem.V.CD     0       1
pl-it_prod.A.EngSystem.V.CD.EAI_Eng-BWEAIEng-1.DynamicMain      0       1
pl-it_prod.A.EngSystem.V.CD.EAI_Eng-BWEAIEng-1.DynamicMain.Reply        0       1
pl-it_prod.A.EngSystem.V.CD.EAI_Eng-BWEAIEng-2.DynamicMain      0       1
pl-it_prod.A.EngSystem.V.CD.EAI_Eng-BWEAIEng-2.DynamicMain.Reply        0       1
pl-it_prod.A.Orchest.V.CD       0       1
pl-it_prod.A.Orchest.V.CD.Orchest-BWOrch1-1.DynamicMain 0       1
pl-it_prod.A.Orchest.V.CD.Orchest-BWOrch1-1.DynamicMain.Reply   0       1
pl-it_prod.A.Orchest.V.CD.Orchest-BWOrch1-2.DynamicMain 0       1
pl-it_prod.A.Orchest.V.CD.Orchest-BWOrch1-2.DynamicMain.Reply   0       1
pl-it_prod.A.ShavitTuxedo.V.CD  0       1
pl-it_prod.A.ShavitTuxedo.V.CD.ShavitTuxedo-BWTux-1.DynamicMain 0       1
pl-it_prod.A.ShavitTuxedo.V.CD.ShavitTuxedo-BWTux-1.DynamicMain.Reply   0       1
pl-it_prod.A.ShavitTuxedo.V.CD.ShavitTuxedo-BWTux-2.DynamicMain 0       1
pl-it_prod.A.ShavitTuxedo.V.CD.ShavitTuxedo-BWTux-2.DynamicMain.Reply   0       1
pl-it_prod.AD.LDAP.V.CD.LDAPUserAuthGroups      0       4
pl-it_prod.AD.LDAP.V.CD.LDAP_ADInetOrgPerson    0       4
pl-it_prod.AD.LDAP.V.CD.LDAP_Bind       0       4
pl-it_prod.AD.LDAP.V.CD.LDAP_Groups     0       2
pl-it_prod.AD.LDAP.V.CD.LDAP_InetOrgPerson      0       2
pl-it_prod.AD.LDAP.V.CD.LDAP_Workstation        0       2
pl-it_prod.Columbus.Columbus-BWColumbus-1.admin 0       1
pl-it_prod.EAI_Eng.EAI_Eng-BWEAIEng-1.admin     0       1
pl-it_prod.EAI_Eng.EAI_Eng-BWEAIEng-2.admin     0       1
pl-it_prod.GW.Async     0       2
pl-it_prod.GW.Publish   0       2
pl-it_prod.GW.Sync      0       2
pl-it_prod.GW.Sync.reply.SCPROD.Upd_Soc_List    0       1
pl-it_prod.Gateways-B2B.GW.Async.Reply.JMS      0       2
pl-it_prod.Gateways-NPG.GW.Async.Reply.JMS      0       2
pl-it_prod.Gateways-Pele.GW.Async.Reply.JMS     0       2
pl-it_prod.Gateways.GW.Async.Reply.JMS  0       2
pl-it_prod.LDAP.LDAP-BWLDAP-1.admin     0       1
pl-it_prod.LDAP.LDAP-BWLDAP-2.admin     0       1
pl-it_prod.LDAP.adldap.LDAP-AdActiveDir-10.exit 0       1
pl-it_prod.LDAP.adldap.LDAP-AdActiveDir-11.exit 0       1
pl-it_prod.LDAP.adldap.LDAP-AdActiveDir-20.exit 0       1
pl-it_prod.LDAP.adldap.LDAP-AdActiveDir-21.exit 0       1
pl-it_prod.LDAP.adldap.LDAP-AdLDAP-1.exit       0       1
pl-it_prod.LDAP.adldap.LDAP-AdLDAP-2.exit       0       1
pl-it_prod.LoadTester.End       0       1
pl-it_prod.LoadTester.Test.End  0       1
pl-it_prod.MaofDB.MaofDB-BWMaof-1.admin 0       1
pl-it_prod.MaofDB.MaofDB-BWMaof-2.admin 0       1
pl-it_prod.NPG.NPG-BWNPG-1.admin        0       1
pl-it_prod.NPG.NPG-BWNPG-2.admin        0       1
pl-it_prod.Orchest.Orchest-BWOrch1-1.admin      0       1
pl-it_prod.Orchest.Orchest-BWOrch1-2.admin      0       1
pl-it_prod.P.Archive.V.CD       0       2
pl-it_prod.P.Columbus.V.CD      0       2
pl-it_prod.P.EngSystem.V.CD     0       2
pl-it_prod.P.LDAP.V.CD  0       2
pl-it_prod.P.MaofDB.V.CD        0       2
pl-it_prod.P.NPG.V.CD   0       2
pl-it_prod.P.Orchest.V.CD       0       2
pl-it_prod.P.PTL.V.CD   0       2
pl-it_prod.P.ShavitTuxedo.V.CD  0       2
pl-it_prod.S.Archive.V.CD       0       2
pl-it_prod.S.Columbus.V.CD      0       2
pl-it_prod.S.EngSystem.V.CD     0       2
pl-it_prod.S.LDAP.V.CD  0       2
pl-it_prod.S.MaofDB.V.CD        0       2
pl-it_prod.S.NPG.V.CD   0       2
pl-it_prod.S.Orchest.V.CD       0       2
pl-it_prod.S.PTL.V.CD   0       2
pl-it_prod.S.ShavitTuxedo.V.CD  0       2
pl.processes.Add_User_Soc-Callback.in   0       0
pl.processes.Close_User_Soc-Callback.in 0       0
stam    0       11
umts.processes.Add_User_Soc-Callback.in 0       0
umts.processes.Close_User_Soc-Callback.in       0       0

So far my perl script looks like this and i'm stuck:
Code:
#!/usr/bin/perl



here load queue policy to hash


open(QUEUE, "/users/tibprod/scripts/ShowQueues_leaiprod.sh|") or die "failed to get queues stats" ;
foreach $line (<QUEUE>) {
    ($que_name,$que_thresh,$que_listen) = split $line;
    foreach $que_thresh (keys %QueLim) {
        if ( $que_name =~ /${que_thresh} ) {
            check the thresh
        }

    }


}
Hope that everything was explained clearly...
Please help me so i could get it done!

Thank you so much!!!

Eliraz.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0