ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Performance Monitoring » runmqsc show queue name and depth in one line

Post new topic  Reply to topic
 runmqsc show queue name and depth in one line « View previous topic :: View next topic » 
Author Message
af6140
PostPosted: Thu Oct 09, 2008 12:00 pm    Post subject: runmqsc show queue name and depth in one line Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Thu Oct 09, 2008 4:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
Michael Dag
PostPosted: Thu Oct 09, 2008 11:21 pm    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

you could look at MO72: MQSC Client for WebSphere MQ it allows you to set the number of columns on one line you want displayed.
_________________
Michael



MQSystems Facebook page
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
manicminer
PostPosted: Thu Oct 09, 2008 11:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
dgolding
PostPosted: Fri Oct 10, 2008 5:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
hacnet
PostPosted: Mon Jan 04, 2010 5:02 am    Post subject: curdepths script and use of uninitialized value in formline Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Mon Jan 04, 2010 5:04 am    Post subject: Reply with quote

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
View user's profile Send private message
dgolding
PostPosted: Thu Jan 07, 2010 7:42 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
bruce2359
PostPosted: Thu Jan 07, 2010 8:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Performance Monitoring » runmqsc show queue name and depth in one line
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.