• perl 监控websphere 队列和通道状态


    [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

  • 相关阅读:
    ubuntu配置jdk和tomcat+部署java项目[最佳实践]
    jQuery TreeGrid
    关于json的一些误解
    jQuery2.0.3源码分析-1(持续更新中......)
    webstrom一些常用快捷键
    js插件-Map插件
    webstorm-删除项目
    随笔-20131209
    软件开发模式对比(瀑布、迭代、螺旋、敏捷)
    javascript学习(10)——[知识储备]链式调用
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349845.html
Copyright © 2020-2023  润新知