zoukankan      html  css  js  c++  java
  • python 获取队列深度

    [mqm@node01 mqm]$ cat disdepth.py 
    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 mqm]$ python disdepth.py  YWJZZF_CZCB_SEND CHANNEL1 192.168.137.2 5015
    -----------------------------------------
    {2016: '*', 20: 1}
    -----------------------------------------
    ('CZ_RSP:Queue  depth:', 1)
    ('DEADQ:Queue  depth:', 3)
    ('ERRMSG:Queue  depth:', 0)
    ('SEND000:Queue  depth:', 8)

  • 相关阅读:
    关于JS中涉及的常用类型转换及运算符表达式
    关于JS脚本语言的基础语法
    钱、车、房、能力
    三数中找最大值
    C#语句
    进制转换
    自动拆装箱、可变参数
    使用dom4j解析xml
    jaxp的dom方式操作(查找、添加、修改、删除、遍历节点)
    xml-dtd
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349595.html
Copyright © 2011-2022 走看看