[mqm@node01 queue]$ cat t4.pl
use MQSeries;
use MQSeries::Command;
use Data::Dumper;
#
if ( $#ARGV < 4 ){
print "Usage ./get_mq_sessage SYSTAG YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015 :!
";
exit(-1);
};
my $systag=$ARGV[0];
my $QueueManager=$ARGV[1];
my $ChannelName=$ARGV[2];
my $ip=$ARGV[3];
my $port=$ARGV[4];
my $qmgr_obj = MQSeries::QueueManager->new
(
QueueManager => "$QueueManager",
ClientConn => { 'ChannelName' => "$ChannelName",
'TransportType' => 'TCP', # Default
'ConnectionName' => "$ip($port)",
'MaxMsgLength' => 16 * 1024 * 1024,
},
) || die("Unable to connect to queue manager
");
my $command = MQSeries::Command->new(QueueManager => $qmgr_obj,
CommandVersion => MQSeries::MQCFH_VERSION_3) or die("Unable to instantiate command object
");
@qnames = $command->InquireQueueNames() or die "Unable to list queue names
";
@channels = $command->InquireChannelStatus();
#print @channels;
#print Dumper(@channels);
foreach (@channels){
if ( $_->{ChannelStatus} =~/BINDING|RETRYING|INITIALIZING/i){
print $_->{ChannelName}." Channel Status ->";
print $_->{ChannelStatus};
print "
";
}};
foreach my $qname(@qnames){
$attr = $command->InquireQueue
(
QName => $qname,
QAttrs => [qw(QType
OpenInputCount
OpenOutputCount
CurrentQDepth
)],
) or die "InquireQueue: " . MQReasonToText($command->Reason()) . "
";
my $type=$attr->{QType};
my $depth=$attr->{CurrentQDepth};
if (( $type eq 'Local') and ($qname !~/^SYSTEM/) and ($qname !~/^PERL/) and ($depth >1) ) {
print "$systag->$QueueManager->$qname->curdepth->$depth
";
};
};
$qmgr_obj->Close();
[mqm@node01 queue]$ perl t4.pl test YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015
YH_CZ Channel Status ->Binding
YH_CZ33 Channel Status ->Retrying
test->YWJZZF_CZCB_SEND->CZ_RSP->curdepth->2
test->YWJZZF_CZCB_SEND->SEND000->curdepth->2