|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
runmqsc show queue name and depth in one line |
« View previous topic :: View next topic » |
Author |
Message
|
af6140 |
Posted: Thu Oct 09, 2008 12:00 pm Post subject: runmqsc show queue name and depth in one line |
|
|
Newbie
Joined: 09 Oct 2008 Posts: 1
|
using mqsc check qdepth will generate following input:
1 : dis ql(SYSTEM.DEAD.LETTER.QUEUE) CURDEPTH
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEAD.LETTER.QUEUE) TYPE(QLOCAL)
CURDEPTH(1)
One MQSC command read.
it display queue name and qdepth in two lines.
How can i make it appear on one line? |
|
Back to top |
|
 |
gbaddeley |
Posted: Thu Oct 09, 2008 4:51 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
mqsc will arbitrarily put one or two attributes on each line. There is no way to control this. You just need to parse it out... _________________ Glenn |
|
Back to top |
|
 |
Michael Dag |
Posted: Thu Oct 09, 2008 11:21 pm Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
|
Back to top |
|
 |
manicminer |
Posted: Thu Oct 09, 2008 11:54 pm Post subject: |
|
|
 Disciple
Joined: 11 Jul 2007 Posts: 177
|
Alternatively look at writing PCF messages yourself to get the data back as data, as opposed to trying to parse the output of MQSC, which might change in future versions, and would definitely be different on a non-english machine
Using Java and the PCF classes is fairly straight forward, and would allow you to collect this information remotely too.
In fact there is a post on these very forums with some code in it that would serve as a good starting point for attempting this:
http://www.mqseries.net/phpBB2/viewtopic.php?p=66734 |
|
Back to top |
|
 |
dgolding |
Posted: Fri Oct 10, 2008 5:32 am Post subject: |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
A basic Perl script to do it (no it's not written in Basic, it IS basic):
#! /usr/bin/perl -w
#
# Show the current depth of all queues for a given queue manager
#
#
# Who When What
# dgolding 09.06.04 Initial coding.
#
$qm = $ARGV[0];
# print $qm,"\n";
open (CHS_OUT, "echo 'dis ql(*) all'|runmqsc $qm|");
while (<CHS_OUT>)
{
if ( /QUEUE\(/ )
{
$QueueName = ValueParser("QUEUE", 6);
}
if ( /IPPROCS\(/ )
{
$InpProcs = ValueParser("IPPROCS", 8);
}
if ( /OPPROCS\(/ )
{
$OutProcs = ValueParser("OPPROCS", 8);
}
if ( /CURDEPTH\(/ )
{
$CurDepth = ValueParser("CURDEPTH", 9);
write;
}
}
format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>> @>>>> @>>>>>>
$QueueName, $InpProcs, $OutProcs, $CurDepth
.
#
# Value parser subroutine
#
sub ValueParser
{
my($ValueName,$ValueLength) = @_;
$ValueStart = index($_, "$ValueName\(") + $ValueLength;
$ValueStop = index($_, "\)");
if ( $ValueStop < $ValueStart )
{
$ValueStop = rindex($_, "\)");
}
$ValueLength = $ValueStop - $ValueStart;
return substr($_, $ValueStart, $ValueLength);
} |
|
Back to top |
|
 |
hacnet |
Posted: Mon Jan 04, 2010 5:02 am Post subject: curdepths script and use of uninitialized value in formline |
|
|
Newbie
Joined: 04 Jan 2010 Posts: 1
|
Hi dgolding,
Can you say what I need to correct in above script? See errors below..
Code: |
[mqm@server]$ ./curdepths QMGR1
Use of uninitialized value in formline at ./curdepths line 34, <CHS_OUT> line 14.
Use of uninitialized value in formline at ./curdepths line 34, <CHS_OUT> line 14.
QUEUE1 0
QUEUE2 0 0 0
QUEUE3 0 0 0 |
thanks! |
|
Back to top |
|
 |
zpat |
Posted: Mon Jan 04, 2010 5:04 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Please use the code tag to keep the script formatting intact when posting! |
|
Back to top |
|
 |
dgolding |
Posted: Thu Jan 07, 2010 7:42 am Post subject: |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
Woops, silly little bug there, which my perl-guru friend rene spotted:
Code: |
#! /usr/bin/perl -w
#
# Show the current depth of all queues for a given queue manager
#
#
# Who When What
# dgolding 09.06.04 Initial coding.
# dgolding 07.01.10 Fixed uninitialized variable bug.
#
$qm = $ARGV[0];
# print $qm,"\n";
open (CHS_OUT, "echo 'dis ql(*) all'|runmqsc $qm|");
while (<CHS_OUT>)
{
# $ctr++;
# print ("DEBUG: $ctr IV=\"$_\"\n");
if ( /QUEUE\(/ )
{
$QueueName = ValueParser("QUEUE", 6);
}
if ( /IPPROCS\(/ )
{
$InpProcs = ValueParser("IPPROCS", 8);
}
if ( /CURDEPTH\(/ )
{
$CurDepth = ValueParser("CURDEPTH", 9);
}
if ( /OPPROCS\(/ )
{
$OutProcs = ValueParser("OPPROCS", 8);
write;
}
}
format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>> @>>>> @>>>>>>
$QueueName, $InpProcs, $OutProcs, $CurDepth
.
#
# Value parser subroutine
#
sub ValueParser
{
my($ValueName,$ValueLength) = @_;
$ValueStart = index($_, "$ValueName\(") + $ValueLength;
$ValueStop = index($_, "\)");
if ( $ValueStop < $ValueStart )
{
$ValueStop = rindex($_, "\)");
}
$ValueLength = $ValueStop - $ValueStart;
return substr($_, $ValueStart, $ValueLength);
}
|
|
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 07, 2010 8:05 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
I seem to recall a REXX script that does this... looking. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|