Exemple #1
0
                queue_match = "*"

            if "type" in g.args:
                qtype = g.args["type"]
                if qtype == "local":
                    queue_type = CMQC.MQQT_LOCAL
                elif qtype == "remote":
                    queue_type = CMQC.MQQT_REMOTE
                elif qtype == "alias":
                    queue_type = CMQC.MQQT_ALIAS
                elif qtype == "model":
                    queue_type = CMQC.MQQT_MODEL
                else:
                    queue_type = CMQC.MQQT_ALL
            else:
                queue_type = CMQC.MQQT_ALL

            args = {CMQC.MQCA_Q_NAME: queue_match, CMQC.MQIA_Q_TYPE: queue_type}

            conn = mq_cache.get(g.args["qmgr_name"])
            pcf = pymqi.PCFExecute(conn)
            queues = pcf.MQCMD_INQUIRE_Q_STATUS(args)
        except pymqi.MQMIError, e:
            return {"reason": e.reason, "code": e.comp, "message": e.errorAsString()}, 500
        except Exception, ex:
            return {"message": ex.message}, 500
        queues = map(lambda x: mq_defs.mqcons_to_string(x), queues)
        # print queues
        # mq_defs.make_swagger_defs("queue_status", queues[0])
        return queues, 200, None
Exemple #2
0
                    chl_type = CMQC.MQCHT_REQUESTER
                elif ctype == "clntconn":
                    chl_type = CMQC.MQCHT_CLNTCONN
                elif ctype == "clusrcvr":
                    chl_type = CMQC.MQCHT_CLUSRCVR
                elif ctype == "clussndr":
                    chl_type = CMQC.MQCHT_CLUSSDR
                else:
                    chl_type = CMQC.MQCHT_ALL
            else:
                chl_type = CMQC.MQCHT_ALL

            args = {CMQCFC.MQCACH_CHANNEL_NAME: name_match}

            print args

            conn = mq_cache.get(g.args["qmgr_name"])
            pcf = pymqi.PCFExecute(conn)
            channels = pcf.MQCMD_INQUIRE_CHANNEL_STATUS(args)

        except pymqi.MQMIError, e:
            return {"reason": e.reason, "code": e.comp, "message": e.errorAsString()}, 500

        except Exception, ex:
            return {"message": ex.message}, 500

        channels = map(lambda x: mq_defs.mqcons_to_string(x), channels)
        # print queues
        mq_defs.make_swagger_defs("channel_status", channels[0])
        return channels, 200, None
Exemple #3
0
# -*- coding: utf-8 -*-
from flask import request, g

from . import Resource
from .. import schemas
from . import mq_cache
import pymqi
from exceptions import Exception
import CMQC
import mq_defs

PLATFORM = ["UNKOWN","UNKNOWN","NA","UNIX"]
class Qmanager(Resource):

    def get(self):
        try:
            conn = mq_cache.get(g.args['qmgr_name'])
            pcf = pymqi.PCFExecute(conn)
            qmgr = pcf.MQCMD_INQUIRE_Q_MGR()
        except pymqi.MQMIError, e:
            return {"reason": e.reason, "code": e.comp, "message": e.errorAsString()}, 500
        except Exception, ex:
            return {"message": ex.message }, 500
        qmgr = map(lambda x: mq_defs.mqcons_to_string(x), qmgr)[0]
        #mq_defs.make_swagger_defs("qmanager", qmgr)
        return qmgr, 200, None