ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Performance Monitoring » MQ Performance Event - Please Help!

Post new topic  Reply to topic
 MQ Performance Event - Please Help! « View previous topic :: View next topic » 
Author Message
abiondo
PostPosted: Thu Dec 03, 2009 2:49 pm    Post subject: MQ Performance Event - Please Help! Reply with quote

Novice

Joined: 30 Aug 2007
Posts: 21
Location: Philadelphia, PA

I ma trying to figure out how to capture MQ Performance Events an so far with the information on this site I have done pretty well, but I hit a wall last night.

So far I can pull off the following information

MQCA_Q_MGR_NAME: MY.QM.NAME
MQCA_BASE_Q_NAME: TEST
MQIA_TIME_SINCE_RESET: 5748806
MQIA_HIGH_Q_DEPTH: 8
MQIA_MSG_ENQ_COUNT: 8
MQIA_MSG_DEQ_COUNT: 0

I am trying to figure out how I can determine the type of performance event this is? Example, is it a High Queue, Low Queue or Max Queue?

I am not sure where this information is stored and how to go about getting it. Below is my program stubbed out on VB.NET. I also want to setup this same thing for Channels.

Code:


Imports IBM.WMQ
Imports IBM.WMQ.PCF
Imports System.Configuration
Imports System.IO
Imports System.Xml
Imports System.Convert
Imports System.Threading
Imports System.Diagnostics
Imports System.Net.Mail

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim mApplicationName As String = "WebSphere MQ Event Monitor"

        ' Setup Connection Variables
        Dim mChannel As String = ""
        Dim mHost As String = ""
        Dim mQueue As String = ""
        Dim mQueueManager As String = ""
        Dim mPort As String = ""

        Dim mMQMessage As String = ""
        Dim mMQPersistance As Integer = 0
        Dim mMQMessageID As String = ""
        Dim mqErrorMessage As String = ""
        Dim mqQMgr As MQQueueManager
        Dim mqQueue As MQQueue
        Dim mqMsg As MQMessage


        Dim isContinue As Boolean = True
        Dim mMessage As String = ""
        Dim mFlNoMessagesAvailable As Boolean = False
        Dim mEventType As String = ""
        Dim mParameters As PCF.PCFParameter()
        Dim mStringParameter As MQCFST
        Dim mIntParameter As MQCFIN
        Dim pname As String = vbNull
        Dim mParameterCount As Integer = 0
        Dim mNotificationTxt As String = ""
        Dim HTMLEmailMessage As String = ""


        ' ###################################
        ' PLACE TO HARDSET VARIABLES
        ' ###################################

        mChannel = "CHAN.WEBSERVER"
        mHost = "KDEVMQPA01"
        mQueue = "SYSTEM.ADMIN.PERFM.EVENT"
        mQueueManager = "KMHP.EBIZ.DEV.QMGR"
        mPort = 1414

        ' ######################################
        ' CONNECT TO WEBSPHERE MQ QUEUE MANAGER
        ' ######################################
        Try
            mqQMgr = New MQQueueManager(mQueueManager, mChannel, mHost & "(" & mPort & ")")
        Catch mqe As MulticastNotSupportedException
            mqErrorMessage = "MQQueueManager::connect failed with " + mqe.Message
            WriteToEventLog(mqErrorMessage, mApplicationName)
            Exit Sub

        Catch mqe As MQException
            mqErrorMessage = "MQQueueManager::Connect failed to " & mQueueManager & ".  " & mqMsg.ToString & " " & mqe.Reason.ToString
            WriteToEventLog(mqErrorMessage, mApplicationName)
            Exit Sub
        End Try

        ' ##########################
        ' OPEN QUEUE FOR GET MODE
        ' ##########################
        Dim OpenOptions As Integer
        Dim gmo As New MQGetMessageOptions
        OpenOptions = MQC.MQOO_BROWSE + MQC.MQOO_FAIL_IF_QUIESCING

        mqQueue = mqQMgr.AccessQueue(mQueue, OpenOptions, Nothing, Nothing, Nothing)

        WriteToEventLog("Status: Queue Open in GET Mode w/ WAIT & Syncpoint", mApplicationName)

        While (isContinue)

            WriteToEventLog("Status: Waiting Top Loop", mApplicationName)

            mqMsg = New MQMessage
            mMessage = vbNull
            mqMsg.ClearMessage()

            ' ############################################
            ' SET IDENTIFIERS MESSAGE ID / CORRELATION ID
            ' ############################################
            mqMsg.CorrelationId = MQC.MQCI_NONE
            mqMsg.MessageId = MQC.MQMI_NONE

            ' #############################################
            ' SET MESSAGE OPTIONS TO WAIT UNLIMITED TIME
            ' WAIT OPTIONS MUST BE DEFINED AT THE GMO LEVEL
            ' #############################################
            gmo.Options = MQC.MQGMO_BROWSE_NEXT + MQC.MQGMO_CONVERT
            'gmo.WaitInterval = MQC.MQWI_UNLIMITED
            gmo.WaitInterval = 30000

            ' ############
            ' GET MESSAGE
            ' ############

            Try
                mqQueue.Get(mqMsg, gmo)

            Catch mqe As MQException

                If mqe.ReasonCode = 2033 Then
                    WriteToEventLog("No Messages available on Queue", mApplicationName)
                    mFlNoMessagesAvailable = True
                    Exit Sub
                Else
                    WriteToEventLog("Error: MQ Error Completion Code" & mqe.ReasonCode, mApplicationName)
                    isContinue = False
                    Exit Sub
                End If
            End Try


            Try

                Dim pcf As New PCFMessage(mqMsg)


                Debug.Print(pcf.GetCompCode)
                Debug.Print(pcf.GetControl)
                Debug.Print(pcf.Type)

                ' ############################################
                ' DETERMINE THE EVENT TYPE
                ' ############################################
                Select Case pcf.GetCommand

                    Case CMQCFC.MQCMD_Q_MGR_EVENT
                        mEventType = "QMGR EVENT"
                    Case CMQCFC.MQCMD_PERFM_EVENT
                        mEventType = "PERFORMANCE EVENT"
                    Case CMQCFC.MQCMD_CHANNEL_EVENT
                        mEventType = "CHANNEL EVENT"
                End Select

                Debug.Print(pcf.GetCompCode())


                ' ############################################
                ' GET PCF PARAMETERS AND ITERATE THROUGH LIST
                '
                ' PARAMETERS RETURNED
                '   Queue manager name
                '   Queue(Name)
                '   Time since last reset
                '   Maximum number of messages on queue
                '   Number of messages put to queue
                '   Number of messages retrieved from queue
                ' ############################################

                mParameters = pcf.GetParameters()
                Select Case pcf.GetCommand
                    Case CMQCFC.MQCMD_PERFM_EVENT                                       ' HANDLE PERFORMANCE EVENTS

                        Do While mParameterCount < pcf.GetParameterCount

                            Select Case mParameters(mParameterCount).Type

                                Case MQC.MQCFT_STRING
                                    ' ############################################
                                    ' IF STRING SET EQUAL TO STRING STRUCTURE
                                    ' ############################################
                                    mStringParameter = mParameters(mParameterCount)
                                    mNotificationTxt = mNotificationTxt & ParametersToEnglishText(mStringParameter.Parameter) & ": "
                                    mNotificationTxt = mNotificationTxt & mStringParameter.GetValue & vbCrLf

                                Case MQC.MQCFT_INTEGER

                                    ' ############################################
                                    ' IF INTEGER SET EQUAL TO STRING STRUCTURE
                                    ' ############################################
                                    mIntParameter = mParameters(mParameterCount)
                                    mNotificationTxt = mNotificationTxt & ParametersToEnglishText(mIntParameter.Parameter) & ": "
                                    mNotificationTxt = mNotificationTxt & mIntParameter.GetValue & vbCrLf

                            End Select

                            mParameterCount = mParameterCount + 1
                        Loop


                End Select

                TextBox1.Text = mNotificationTxt
               
            Catch ex As Exception
                Debug.Print("Exception when converting message to PCF")
            End Try


        End While


    End Sub

    Public Function WriteToEventLog(ByVal Entry As String, ByVal AppName As String, Optional ByVal EventType As EventLogEntryType = EventLogEntryType.Information, Optional ByVal LogName As String = "Application") As Boolean

        Dim objEventLog As New EventLog()

        Try
            'Register the App as an Event Source
            If Not Diagnostics.EventLog.SourceExists(AppName) Then
                Diagnostics.EventLog.CreateEventSource(AppName, LogName)
            End If

            objEventLog.Source = AppName

            'WriteEntry is overloaded; this is one of several ways to make this invocation
            objEventLog.WriteEntry(Entry, EventType)
            Return True
        Catch Ex As Exception
            Return False

        End Try

    End Function



    Public Function ParametersToEnglishText(ByVal iParameter As Integer) As String
       
        Select Case iParameter

            ' ##############################################
            ' GET PARAMETERS FROM MQCFST MWCFIN STRUCTURES
            ' ##############################################
            Case MQC.MQCA_Q_MGR_NAME
                Return "MQCA_Q_MGR_NAME"
            Case MQC.MQCA_Q_NAME
                Return "MQCA_Q_NAME"
            Case MQC.MQCACF_APPL_NAME
                Return "MQCACF_APPL_NAME"
            Case MQC.MQCACF_OBJECT_Q_MGR_NAME
                Return "MQCACF_OBJECT_Q_MGR_NAME"
            Case MQC.MQCACF_BRIDGE_NAME
                Return "MQCACF_BRIDGE_NAME"
            Case MQC.MQCACH_CHANNEL_NAME
                Return "MQCACH_CHANNEL_NAME"
            Case MQC.MQCACH_XMIT_Q_NAME
                Return "MQCACH_XMIT_Q_NAME"
            Case MQC.MQCACH_CONNECTION_NAME
                Return "MQCACH_CONNECTION_NAME"
            Case MQC.MQCACH_FORMAT_NAME
                Return "MQCACH_FORMAT_NAME"
            Case MQC.MQCACF_AUX_ERROR_DATA_STR_1
                Return "MQCACF_AUX_ERROR_DATA_STR_1"
            Case MQC.MQCACF_AUX_ERROR_DATA_STR_2
                Return "MQCACF_AUX_ERROR_DATA_STR_2"
            Case MQC.MQCACF_AUX_ERROR_DATA_STR_3
                Return "MQCACF_AUX_ERROR_DATA_STR_3"
            Case MQC.MQCACF_USER_IDENTIFIER
                Return "MQCACF_USER_IDENTIFIER"
            Case MQC.MQCA_PROCESS_NAME
                Return "MQCA_PROCESS_NAME"
            Case MQC.MQCA_BASE_Q_NAME
                Return "MQCA_BASE_Q_NAME"
            Case MQC.MQIA_Q_TYPE
                Return "MQIA_Q_TYPE"
            Case MQC.MQIA_APPL_TYPE
                Return "MQIA_APPL_TYPE"
            Case MQC.MQIACF_REASON_QUALIFIER
                Return "MQIACF_REASON_QUALIFIER"
            Case MQC.MQIACF_ERROR_IDENTIFIER
                Return "MQIACF_ERROR_IDENTIFIER"
            Case MQC.MQIACH_CHANNEL_TYPE
                Return "MQIACH_CHANNEL_TYPE"
            Case MQC.MQIACF_AUX_ERROR_DATA_INT_1
                Return "MQIACF_AUX_ERROR_DATA_INT_1"
            Case MQC.MQIACF_CONV_REASON_CODE
                Return "MQIACF_CONV_REASON_CODE"
            Case MQC.MQIACF_AUX_ERROR_DATA_INT_2
                Return "MQIACF_AUX_ERROR_DATA_INT_2"
            Case MQC.MQIACF_OPEN_OPTIONS
                Return "MQIACF_OPEN_OPTIONS"
            Case MQC.MQIACF_COMMAND
                Return "MQIACF_COMMAND"
            Case MQC.MQIA_TIME_SINCE_RESET
                Return "MQIA_TIME_SINCE_RESET"
            Case MQC.MQIA_HIGH_Q_DEPTH
                Return "MQIA_HIGH_Q_DEPTH"
            Case MQC.MQIA_MSG_ENQ_COUNT
                Return "MQIA_MSG_ENQ_COUNT"
            Case MQC.MQIA_MSG_DEQ_COUNT
                Return "MQIA_MSG_DEQ_COUNT"
            Case Else
                Return "Unknown Parameter"
        End Select


    End Function





    Public Function ParameterValueToEnglishText(ByVal iParameter As Integer) As String

        Select Case iParameter

            ' ##############################################
            ' GET INT PARAMETERS VALUES
            ' ##############################################
            Case MQC.MQRQ_BRIDGE_STOPPED_OK
                Return "MQRQ_BRIDGE_STOPPED"
            Case MQC.MQBT_OTMA
                Return "MQBT_OTMA"
            Case MQC.MQRQ_BRIDGE_STOPPED_ERROR
                Return "MQRQ_BRIDGE_STOPPED_ERROR"
            Case MQC.MQQT_ALIAS
                Return "MQQT_ALIAS"
            Case MQC.MQQT_MODEL
                Return "MQQT_MODEL"
            Case MQC.MQRCCF_SUPPRESSED_BY_EXIT
                Return "MQCCF_SUPPRESSED_BY_EDIT"
            Case MQC.MQRC_CONVERTED_MSG_TOO_BIG
                Return "MQRC_CONVERTED_MSG_TOO_BIG"
            Case MQC.MQRC_FORMAT_ERROR
                Return "MQRC_FORMAT_ERROR"
            Case MQC.MQRC_NOT_CONVERTED
                Return "MQRC_NOT_VONVERTED"
            Case MQC.MQRC_SOURCE_CCSID_ERROR
                Return "MQRC_SOURCE_CCSID_ERROR"
            Case MQC.MQQT_REMOTE
                Return "MQQT_REMOTE"
            Case MQC.MQRQ_Q_MGR_STOPPING
                Return "MQRQ_Q_MGR_STOPPING"
            Case MQC.MQRC_SOURCE_DECIMAL_ENC_ERROR
                Return "MQRC_SOURCE_DECIMAL_ENC_ERR"
            Case MQC.MQRC_SOURCE_FLOAT_ENC_ERROR
                Return "MQRC_SOURCE_FLOAT_ENC_ERROR"
            Case MQC.MQRC_SOURCE_INTEGER_ENC_ERROR
                Return "MQRC_SOURCE_INTEGER_ENC_ERR"
            Case MQC.MQRC_TARGET_CCSID_ERROR
                Return "MQRC_TARGET_CCSID_ERROR"
            Case MQC.MQRC_TARGET_DECIMAL_ENC_ERROR
                Return "MQRC_TARGET_DECIMAL_ENC_ERR"
            Case MQC.MQRC_TARGET_FLOAT_ENC_ERROR
                Return "MQRC_TARGET_FLOAT_ENC_ERROR"
            Case MQC.MQRC_TARGET_INTEGER_ENC_ERROR
                Return "MQRC_TARGET_INTEGER_ENC_ERR"
            Case MQC.MQRC_TRUNCATED_MSG_ACCEPTED
                Return "MQRC_TRUNCATED_MSG_ACCEPTED"
            Case MQC.MQRC_TRUNCATED_MSG_FAILED
                Return "MQRC_TRUNCATED_MSG_FAILED"
            Case MQC.MQRQ_CHANNEL_STOPPED_OK
                Return "MQRQ_CHANNEL_STOPPED"
            Case MQC.MQRQ_CHANNEL_STOPPED_RETRY
                Return "MQRQ_CHANNEL_STOPPED_RETRY"
            Case MQC.MQRQ_CHANNEL_STOPPED_ERROR
                Return "MQRQ_CHANNEL_STOPPED_ERROR"
            Case MQC.MQRQ_CHANNEL_STOPPED_DISABLED
                Return "MQRQ_CHL_STOPPED_DISABLED"
            Case Else
                Return "Unknown Parameter"
        End Select


    End Function
End Class



_________________
Anthony J Biondo Jr
Manager, Web Services
AmeriHealth Mercy
Back to top
View user's profile Send private message Visit poster's website AIM Address
bruce2359
PostPosted: Thu Dec 03, 2009 3:02 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9469
Location: US: west coast, almost. Otherwise, enroute.

MQIA_ and MQCA_ return values of attributes of objects - these are not events.

If you have enabled depth events, for example, the qmgr will create an event message that is put to the SYSTEM.ADMIN QMGR.EVENT queue when the event takes place. The format and content of event messages is documented the WMQ Performance manual... IMS.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Thu Dec 03, 2009 3:29 pm    Post subject: Re: MQ Performance Event - Please Help! Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

abiondo wrote:
I am trying to figure out how I can determine the type of performance event this is? Example, is it a High Queue, Low Queue or Max Queue?


Its in MQCFH.Reason and the values will be MQRC_Q_FULL, MQRC_Q_DEPTH_HIGH, MQRC_Q_DEPTH_LOW.
_________________
Glenn
Back to top
View user's profile Send private message
abiondo
PostPosted: Fri Dec 04, 2009 10:42 am    Post subject: Reply with quote

Novice

Joined: 30 Aug 2007
Posts: 21
Location: Philadelphia, PA

Thanks for your reply. This madkes a lot of sense. I guess my issue is that i am unsure how to get at the header. I tried the following..

Dim pcf As New PCFMessage(mqMsg)
Dim pcfH As New MQCFH(mqMsg)

It soes not like the second line. Do you have any good examples at how to access the header that you can pass along.

thanks much,
Anthony
_________________
Anthony J Biondo Jr
Manager, Web Services
AmeriHealth Mercy
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Performance Monitoring » MQ Performance Event - Please Help!
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.