• python 2.7 获取MQ队列深度


    import sys
    import os
    import pymqi
    import time
    import re
    if len(sys.argv) != 5:
        print sys.argv[0] + ' ' + 'queue_manager' + ' ' + 'channel' + ' ' + 'host' + ' ' + 'port'
    else:
        queue_manager = sys.argv[1]
        channel = sys.argv[2]
        host = sys.argv[3]
        port = sys.argv[4]
        conn_info = "%s(%s)" % (host, port)
        prefix = "*"
        queue_type = pymqi.CMQC.MQQT_LOCAL
        args = {pymqi.CMQC.MQCA_Q_NAME: prefix,
               pymqi.CMQC.MQIA_Q_TYPE: queue_type}
        print '-----------------------------------------'
        print args
        print '-----------------------------------------'
        qmgr = pymqi.connect(queue_manager, channel, conn_info)
        pcf = pymqi.PCFExecute(qmgr)
        response = pcf.MQCMD_INQUIRE_Q(args)
        for queue_info in response:
            queue_name = queue_info[pymqi.CMQC.MQCA_Q_NAME]
            if (re.match('^SYSTEM',queue_name) or re.match('^AMQ',queue_name) or re.match('^MQ',queue_name)):
                pass
            else:
                q = pymqi.Queue(qmgr, queue_name)
                print(queue_name.strip() +':'+'Queue  depth:', q.inquire(pymqi.CMQC.MQIA_CURRENT_Q_DEPTH))
                q.close()
        qmgr.disconnect()
    	
    	[mqm@node01 sbin]$ python disdepth.py  YWJZZF_CZCB_SEND CHANNEL1 127.0.0.1 5015
    -----------------------------------------
    {2016: '*', 20: 1}
    -----------------------------------------
    ('CZ_RSP:Queue  depth:', 1)
    ('DEADQ:Queue  depth:', 3)
    ('ERRMSG:Queue  depth:', 0)
    ('SEND000:Queue  depth:', 8)

  • 相关阅读:
    js静态成员和实例成员
    js构造函数
    js创建对象
    js演示面向对象
    JavaScript特点
    像素鸟游戏
    图片瀑布流
    微信聊天模拟
    飞机游戏动画特效
    SpringBoot 核心理论
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349180.html
Copyright © 2020-2023  润新知