- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to extract the number of queue on MQ
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 07:06 PM
тАО11-03-2004 07:06 PM
i have some problems to extract from MQ the number of queue from a single MQ channel.
here we are what i see from a runmqsc
*******************************************
root@sysint04:/usr/sysint/SOM# runmqsc
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
Starting MQSC for queue manager System.Integration.Manager.
DIS QUEUE(MQ01) CURDEPTH
1 : DIS QUEUE(MQ01) CURDEPTH
AMQ8409: Display Queue details.
QUEUE(MQ01) CURDEPTH(0)
*******************************************
what i want is to extract the number into CURDEPTH().
what shall i do? with awk i've extracted the last row ( QUEUE(MQ01) CURDEPTH(0)) but i don't know how to read every single character and find the number.
please, help me.
thanks in advice
roberto.sal
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 07:49 PM
тАО11-03-2004 07:49 PM
Solutionrunmqsc | awk '/^QUEUE\(MQ01\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }'
From your example input,
cat testfile
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
Starting MQSC for queue manager System.Integration.Manager.
DIS QUEUE(MQ01) CURDEPTH
1 : DIS QUEUE(MQ01) CURDEPTH
AMQ8409: Display Queue details.
QUEUE(MQ01) CURDEPTH(0)
# awk '/^QUEUE\(MQ01\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' testfile
0
HTH.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 08:11 PM
тАО11-03-2004 08:11 PM
Re: how to extract the number of queue on MQ
the script works fine with the example that i've posted into forum but i want to understand what you did.
can you do this?
tell if i'm in wrong:
you have found in all rows that begin with QUEUE(MQ01). but after?
and if i have this what can i do?
**************************************
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
Starting MQSC for queue manager System.Integration.Manager.
1 : DIS QUEUE(MQ01) CURDEPTH
AMQ8409: Display Queue details.
QUEUE(MQ01) CURDEPTH(0)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
*************************************
if you can see QUEUE(MQ01) begin with some spaces and it doesn't work with your script. why?
thanks and best regards
roberto.sal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 08:17 PM
тАО11-03-2004 08:17 PM
Re: how to extract the number of queue on MQ
i link the file that contains the output of runmqsc.
be patint with me, :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 08:26 PM
тАО11-03-2004 08:26 PM
Re: how to extract the number of queue on MQ
the string to search must contains the blank spaces. so the command will be:
awk '/^ QUEUE\(MQ01\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' test.log
simple, no?
thanks a lot.
roberto.sal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 09:11 PM
тАО11-03-2004 09:11 PM
Re: how to extract the number of queue on MQ
*************************
root@sysint04:/usr/sysint/SOM# ./check_mqqueue.sh
./check_mqqueue.sh: test: argument expected
*************************
the script is this:
*************************
#!/bin/sh
MQQUEUE="MQ01 MQ17 MQ18 MQ25 MQ44 MQ52 MQ54"
LOGDIR=/var/tmp/si
LOGFILE=$LOGDIR/check_mqqueue.log
MQNAME=$LOGDIR/mqqueuename.log
#*** MAIN ***
rm -rf $LOGFILE $MQNAME
flag=0
for i in $MQQUEUE
do
runmqsc << EOF >> $LOGFILE
DIS QUEUE($i) CURDEPTH
EOF
#NUMQUEUE=`awk '/^ QUEUE\($i\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' $LOGFILE`
#echo $NUMQUEUE
if [ `awk '/^ QUEUE\($i\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' $LOGFILE` -gt 50 ]; the
n
echo $i >> $MQNAME
flag=1
fi
done
...
*************************
i suppose that the error can be found on this part of the script but i'm not so sure:
awk '/^ QUEUE\($i\)/
i think that to reference the variable ($i) this is not the right method. if yes, what can i do?
waiting for you
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 11:09 PM
тАО11-03-2004 11:09 PM
Re: how to extract the number of queue on MQ
**********************************
flag=0
for i in $MQQUEUE
do
RUNMQ $i
PT=`awk '/^ QUEUE\('"$i"'\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' $LOGFILE`
if [ "$PT" -gt 10 ]; then
sleep 10
RUNMQ $i
ST=`awk '/^ QUEUE\('"$i"'\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' $LOGFILE`
if [ "$ST" -gt 10 ]; then
echo $i >> $MQNAME
flag=1
fi
fi
done
if [ $flag -eq 1 ]; then
...
*******************************
so, you can see that i've used this method ('"$i"') to say to awk to use the external variable. i hope that can be helpfull to someone else.
best regards to everyone.
roberto.sal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-04-2004 02:06 AM
тАО11-04-2004 02:06 AM
Re: how to extract the number of queue on MQ
QUEUE(MQ01) CURDEPTH(0) pattern is beginning with spaces as,
awk '/CURDEPTH\(/ { split($2,a,"("); split(a[2],b,")"); print b[1] }' testfile
awk '/^[ ]*QUEUE\(/ { split($2,a,"("); split(a[2],b,")"); print b[1] }' testfile
/^[ ]*QUEUE\(/ will search for 0 to n spaces at begin with QUEUE( there.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-04-2004 02:29 AM
тАО11-04-2004 02:29 AM
Re: how to extract the number of queue on MQ
PT=`awk '/^ QUEUE\('"$i"'\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' $LOGFILE`
ST=`awk '/^ QUEUE\('"$i"'\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }' $LOGFILE`
working there?? with awk?
awk pattern is not working there.
Change that operation as,
PT=`grep "^[ ]*QUEUE($i)[ ]*CURDEPTH(" $LOGFILE | awk '/^ QUEUE\('"$i"'\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }'`
and
ST=`grep "^[ ]*QUEUE($i)[ ]*CURDEPTH(" $LOGFILE | awk '/^ QUEUE\('"$i"'\)/ { split($2,a,"("); split( a[2],b,")"); print b[1] }'`
It will work now.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-04-2004 02:58 AM
тАО11-04-2004 02:58 AM
Re: how to extract the number of queue on MQ
thanks a lot