Skip to content

Commit

Permalink
Update for MQ 9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ibmmqmet committed Jul 24, 2020
1 parent 61aed18 commit 0c3b486
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
Newest updates are at the top of this file.

## Jul 23 2020 - v5.1.0
* Update for MQ 9.2.0
* mqmetric - Add explicit client configuration options
* mqmetric - Add counter of how many resource publicatins read per scrape

## June 1 2020 - v5.0.0
* Migration for Go modules (requires new major number) (#138)
* ibmmq - Add all string mapping functions from cmqstrc (#142)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ RUN mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg \
# Location of the downloadable MQ client package \
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
RDTAR="IBM-MQC-Redist-LinuxX64.tar.gz" \
VRMF=9.1.5.0
VRMF=9.2.0.0

# Install the MQ client from the Redistributable package. This also contains the
# header files we need to compile against.
Expand Down
7 changes: 4 additions & 3 deletions ibmmq/cmqc_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ package ibmmq
****************************************************************
*
* <BEGIN_BUILDINFO>
* Generated on: 3/16/20 3:14 PM
* Build Level: p915-L200316
* Generated on: 7/9/20 2:30 PM
* Build Level: p920-L200709
* Build Type: Production
* <END_BUILDINFO>
*/
Expand Down Expand Up @@ -1004,7 +1004,7 @@ const (
MQCMDI_SEC_SIGNOFF_ERROR int32 = 17
MQCMDI_SEC_TIMER_ZERO int32 = 14
MQCMDI_SEC_UPPERCASE int32 = 21
MQCMDL_CURRENT_LEVEL int32 = 915
MQCMDL_CURRENT_LEVEL int32 = 920
MQCMDL_LEVEL_1 int32 = 100
MQCMDL_LEVEL_101 int32 = 101
MQCMDL_LEVEL_110 int32 = 110
Expand Down Expand Up @@ -1045,6 +1045,7 @@ const (
MQCMDL_LEVEL_913 int32 = 913
MQCMDL_LEVEL_914 int32 = 914
MQCMDL_LEVEL_915 int32 = 915
MQCMDL_LEVEL_920 int32 = 920
MQCMD_ACCOUNTING_MQI int32 = 167
MQCMD_ACCOUNTING_Q int32 = 168
MQCMD_ACTIVITY_MSG int32 = 69
Expand Down
7 changes: 4 additions & 3 deletions ibmmq/cmqc_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ package ibmmq
****************************************************************
*
* <BEGIN_BUILDINFO>
* Generated on: 3/16/20 3:14 PM
* Build Level: p915-L200316
* Generated on: 7/9/20 2:30 PM
* Build Level: p920-L200709
* Build Type: Production
* <END_BUILDINFO>
*/
Expand Down Expand Up @@ -1002,7 +1002,7 @@ const (
MQCMDI_SEC_SIGNOFF_ERROR int32 = 17
MQCMDI_SEC_TIMER_ZERO int32 = 14
MQCMDI_SEC_UPPERCASE int32 = 21
MQCMDL_CURRENT_LEVEL int32 = 915
MQCMDL_CURRENT_LEVEL int32 = 920
MQCMDL_LEVEL_1 int32 = 100
MQCMDL_LEVEL_101 int32 = 101
MQCMDL_LEVEL_110 int32 = 110
Expand Down Expand Up @@ -1043,6 +1043,7 @@ const (
MQCMDL_LEVEL_913 int32 = 913
MQCMDL_LEVEL_914 int32 = 914
MQCMDL_LEVEL_915 int32 = 915
MQCMDL_LEVEL_920 int32 = 920
MQCMD_ACCOUNTING_MQI int32 = 167
MQCMD_ACCOUNTING_Q int32 = 168
MQCMD_ACTIVITY_MSG int32 = 69
Expand Down
7 changes: 4 additions & 3 deletions ibmmq/cmqc_linux_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ package ibmmq
****************************************************************
*
* <BEGIN_BUILDINFO>
* Generated on: 3/16/20 3:14 PM
* Build Level: p915-L200316
* Generated on: 7/9/20 2:30 PM
* Build Level: p920-L200709
* Build Type: Production
* <END_BUILDINFO>
*/
Expand Down Expand Up @@ -1002,7 +1002,7 @@ const (
MQCMDI_SEC_SIGNOFF_ERROR int32 = 17
MQCMDI_SEC_TIMER_ZERO int32 = 14
MQCMDI_SEC_UPPERCASE int32 = 21
MQCMDL_CURRENT_LEVEL int32 = 915
MQCMDL_CURRENT_LEVEL int32 = 920
MQCMDL_LEVEL_1 int32 = 100
MQCMDL_LEVEL_101 int32 = 101
MQCMDL_LEVEL_110 int32 = 110
Expand Down Expand Up @@ -1043,6 +1043,7 @@ const (
MQCMDL_LEVEL_913 int32 = 913
MQCMDL_LEVEL_914 int32 = 914
MQCMDL_LEVEL_915 int32 = 915
MQCMDL_LEVEL_920 int32 = 920
MQCMD_ACCOUNTING_MQI int32 = 167
MQCMD_ACCOUNTING_Q int32 = 168
MQCMD_ACTIVITY_MSG int32 = 69
Expand Down
7 changes: 4 additions & 3 deletions ibmmq/cmqc_linux_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ package ibmmq
****************************************************************
*
* <BEGIN_BUILDINFO>
* Generated on: 3/16/20 3:14 PM
* Build Level: p915-L200316
* Generated on: 7/9/20 2:30 PM
* Build Level: p920-L200709
* Build Type: Production
* <END_BUILDINFO>
*/
Expand Down Expand Up @@ -1002,7 +1002,7 @@ const (
MQCMDI_SEC_SIGNOFF_ERROR int32 = 17
MQCMDI_SEC_TIMER_ZERO int32 = 14
MQCMDI_SEC_UPPERCASE int32 = 21
MQCMDL_CURRENT_LEVEL int32 = 915
MQCMDL_CURRENT_LEVEL int32 = 920
MQCMDL_LEVEL_1 int32 = 100
MQCMDL_LEVEL_101 int32 = 101
MQCMDL_LEVEL_110 int32 = 110
Expand Down Expand Up @@ -1043,6 +1043,7 @@ const (
MQCMDL_LEVEL_913 int32 = 913
MQCMDL_LEVEL_914 int32 = 914
MQCMDL_LEVEL_915 int32 = 915
MQCMDL_LEVEL_920 int32 = 920
MQCMD_ACCOUNTING_MQI int32 = 167
MQCMD_ACCOUNTING_Q int32 = 168
MQCMD_ACTIVITY_MSG int32 = 69
Expand Down
7 changes: 4 additions & 3 deletions ibmmq/cmqc_linux_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ package ibmmq
****************************************************************
*
* <BEGIN_BUILDINFO>
* Generated on: 3/16/20 3:14 PM
* Build Level: p915-L200316
* Generated on: 7/9/20 2:30 PM
* Build Level: p920-L200709
* Build Type: Production
* <END_BUILDINFO>
*/
Expand Down Expand Up @@ -1002,7 +1002,7 @@ const (
MQCMDI_SEC_SIGNOFF_ERROR int32 = 17
MQCMDI_SEC_TIMER_ZERO int32 = 14
MQCMDI_SEC_UPPERCASE int32 = 21
MQCMDL_CURRENT_LEVEL int32 = 915
MQCMDL_CURRENT_LEVEL int32 = 920
MQCMDL_LEVEL_1 int32 = 100
MQCMDL_LEVEL_101 int32 = 101
MQCMDL_LEVEL_110 int32 = 110
Expand Down Expand Up @@ -1043,6 +1043,7 @@ const (
MQCMDL_LEVEL_913 int32 = 913
MQCMDL_LEVEL_914 int32 = 914
MQCMDL_LEVEL_915 int32 = 915
MQCMDL_LEVEL_920 int32 = 920
MQCMD_ACCOUNTING_MQI int32 = 167
MQCMD_ACCOUNTING_Q int32 = 168
MQCMD_ACTIVITY_MSG int32 = 69
Expand Down
7 changes: 4 additions & 3 deletions ibmmq/cmqc_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ package ibmmq
****************************************************************
*
* <BEGIN_BUILDINFO>
* Generated on: 3/16/20 3:14 PM
* Build Level: p915-L200316
* Generated on: 7/9/20 2:30 PM
* Build Level: p920-L200709
* Build Type: Production
* <END_BUILDINFO>
*/
Expand Down Expand Up @@ -1002,7 +1002,7 @@ const (
MQCMDI_SEC_SIGNOFF_ERROR int32 = 17
MQCMDI_SEC_TIMER_ZERO int32 = 14
MQCMDI_SEC_UPPERCASE int32 = 21
MQCMDL_CURRENT_LEVEL int32 = 915
MQCMDL_CURRENT_LEVEL int32 = 920
MQCMDL_LEVEL_1 int32 = 100
MQCMDL_LEVEL_101 int32 = 101
MQCMDL_LEVEL_110 int32 = 110
Expand Down Expand Up @@ -1043,6 +1043,7 @@ const (
MQCMDL_LEVEL_913 int32 = 913
MQCMDL_LEVEL_914 int32 = 914
MQCMDL_LEVEL_915 int32 = 915
MQCMDL_LEVEL_920 int32 = 920
MQCMD_ACCOUNTING_MQI int32 = 167
MQCMD_ACCOUNTING_Q int32 = 168
MQCMD_ACTIVITY_MSG int32 = 69
Expand Down
2 changes: 1 addition & 1 deletion ibmmq/mqi.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ package ibmmq
#cgo windows CFLAGS: -I"C:/Program Files/IBM/MQ/Tools/c/include"
#cgo !windows,!aix,!darwin LDFLAGS: -L/opt/mqm/lib64 -lmqm_r -Wl,-rpath,/opt/mqm/lib64 -Wl,-rpath,/usr/lib64
#cgo darwin LDFLAGS: -L/opt/mqm/lib64 -lmqm_r -Wl,-rpath,/opt/mqm/lib64 -Wl,-rpath,/usr/lib64
#cgo aix LDFLAGS: -L/usr/mqm/lib64 -lmqm_r
#cgo aix LDFLAGS: -L/usr/mqm/lib64 -lmqm_r
#cgo windows LDFLAGS: -L "C:/Program Files/IBM/MQ/bin64" -lmqm
#include <stdlib.h>
Expand Down
2 changes: 2 additions & 0 deletions ibmmq/mqistr.go
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,8 @@ func MQItoString(class string, value int) string {
s = "MQCMDL_LEVEL_914"
case 915:
s = "MQCMDL_LEVEL_915"
case 920:
s = "MQCMDL_LEVEL_920"
default:
s = ""
}
Expand Down
45 changes: 44 additions & 1 deletion mqmetric/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,37 @@ func CollectChannelStatus(patterns string) error {
}
}
}

// If someone has asked to see all the channel definitions, not just those that have a valid
// CHSTATUS response, then we can look through the list of all known channels that match
// our patterns (chlInfoMap) and add some dummy values to the status maps if the channel
// is not already there. Some of the fields do need to be faked up as we don't know anything about
// the "partner"
if err == nil && showInactiveChannels {
for chlName, v := range chlInfoMap {
found := false
chlPrefix := chlName + "/"
for k, _ := range ChannelStatus.Attributes[ATTR_CHL_STATUS].Values {
if strings.HasPrefix(k, chlPrefix) {
found = true
break
}
}
if !found {
// A channel key is normally made up of 4 elements but we only know 1
key := chlName + "/" + DUMMY_STRING + "/" + DUMMY_STRING + "/" + DUMMY_STRING

ChannelStatus.Attributes[ATTR_CHL_NAME].Values[key] = newStatusValueString(chlName)
ChannelStatus.Attributes[ATTR_CHL_CONNNAME].Values[key] = newStatusValueString(DUMMY_STRING)
ChannelStatus.Attributes[ATTR_CHL_JOBNAME].Values[key] = newStatusValueString(DUMMY_STRING)
ChannelStatus.Attributes[ATTR_CHL_RQMNAME].Values[key] = newStatusValueString(DUMMY_STRING)

ChannelStatus.Attributes[ATTR_CHL_STATUS].Values[key] = newStatusValueInt64(int64(ibmmq.MQCHS_INACTIVE))
ChannelStatus.Attributes[ATTR_CHL_STATUS_SQUASH].Values[key] = newStatusValueInt64(SQUASH_CHL_STATUS_STOPPED)
ChannelStatus.Attributes[ATTR_CHL_TYPE].Values[key] = newStatusValueInt64(v.AttrChlType)
}
}
}
return err

}
Expand Down Expand Up @@ -486,7 +517,7 @@ func inquireChannelAttributes(objectPatternsList string, infoMap map[string]*Obj
pcfparm = new(ibmmq.PCFParameter)
pcfparm.Type = ibmmq.MQCFT_INTEGER_LIST
pcfparm.Parameter = ibmmq.MQIACF_CHANNEL_ATTRS
pcfparm.Int64Value = []int64{int64(ibmmq.MQIACH_MAX_INSTANCES), int64(ibmmq.MQIACH_MAX_INSTS_PER_CLIENT), int64(ibmmq.MQCACH_DESC)}
pcfparm.Int64Value = []int64{int64(ibmmq.MQIACH_MAX_INSTANCES), int64(ibmmq.MQIACH_MAX_INSTS_PER_CLIENT), int64(ibmmq.MQCACH_DESC), int64(ibmmq.MQIACH_CHANNEL_TYPE)}
cfh.ParameterCount++
buf = append(buf, pcfparm.Bytes()...)

Expand Down Expand Up @@ -575,6 +606,18 @@ func parseChannelAttrData(cfh *ibmmq.MQCFH, buf []byte, infoMap map[string]*ObjI

}

case ibmmq.MQIACH_CHANNEL_TYPE:
v := elem.Int64Value[0]
if v > 0 {
if ci, ok = infoMap[chlName]; !ok {
ci = new(ObjInfo)
infoMap[chlName] = ci
}
ci.AttrChlType = v
ci.exists = true

}

case ibmmq.MQCACH_DESC:
v := elem.String[0]
if v != "" {
Expand Down
11 changes: 9 additions & 2 deletions mqmetric/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ type ObjInfo struct {
// Some channel information
AttrMaxInst int64
AttrMaxInstC int64
AttrChlType int64
}

// QMgrMapKey can never be a real object name and is therefore useful in
Expand All @@ -116,6 +117,7 @@ var chlInfoMap map[string]*ObjInfo

var locale string
var discoveryDone = false
var publicationCount = 0

func GetDiscoveredQueues() []string {
keys := make([]string, 0)
Expand All @@ -125,6 +127,10 @@ func GetDiscoveredQueues() []string {
return keys
}

func GetProcessPublicationCount() int {
return publicationCount
}

/*
* A collector can set the locale (eg "Fr_FR") before doing the discovery
* process to get access to the MQ-translated strings
Expand Down Expand Up @@ -928,20 +934,21 @@ func ProcessPublications() error {
var elementidx int
var value int64

publicationCount = 0

if !usePublications {
return nil
}

// Keep reading all available messages until queue is empty. Don't
// do a GET-WAIT; just immediate removals.
cnt := 0
for err == nil {
data, err = getMessage(false)

// Most common error will be MQRC_NO_MESSAGE_AVAILABLE
// which will end the loop.
if err == nil {
cnt++
publicationCount++
elemList, _ := parsePCFResponse(data)

// A typical publication contains some fixed
Expand Down
Loading

0 comments on commit 0c3b486

Please sign in to comment.