Skip to content

Commit 522e714

Browse files
committed
Enable retrieval of platform
1 parent 678d659 commit 522e714

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

mqmetric/channel.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
ATTR_CHL_MESSAGES = "messages"
4545
ATTR_CHL_STATUS = "status"
4646
ATTR_CHL_STATUS_SQUASH = ATTR_CHL_STATUS + "_squash"
47+
ATTR_CHL_SUBSTATE = "substate"
4748
ATTR_CHL_TYPE = "type"
4849
ATTR_CHL_INSTANCE_TYPE = "instance_type"
4950

@@ -86,8 +87,12 @@ func ChannelInitAttributes() {
8687
ChannelStatus.Attributes[attr] = newStatusAttribute(attr, "Messages (API Calls for SVRCONN)", ibmmq.MQIACH_MSGS)
8788
ChannelStatus.Attributes[attr].delta = true // We have to manage the differences as MQ reports cumulative values
8889

90+
// This is decoded by MQCHS_* values
8991
attr = ATTR_CHL_STATUS
9092
ChannelStatus.Attributes[attr] = newStatusAttribute(attr, "Channel Status", ibmmq.MQIACH_CHANNEL_STATUS)
93+
// The next value can be decoded from the MQCHSSTATE_* values
94+
attr = ATTR_CHL_SUBSTATE
95+
ChannelStatus.Attributes[attr] = newStatusAttribute(attr, "Channel Substate", ibmmq.MQIACH_CHANNEL_SUBSTATE)
9196
attr = ATTR_CHL_TYPE
9297
ChannelStatus.Attributes[attr] = newStatusAttribute(attr, "Channel Type", ibmmq.MQIACH_CHANNEL_TYPE)
9398
attr = ATTR_CHL_INSTANCE_TYPE
@@ -103,7 +108,7 @@ func ChannelInitAttributes() {
103108

104109
// If we need to list the channels that match a pattern. Not needed for
105110
// the status queries as they (unlike the pub/sub resource stats) accept
106-
// patterns in the
111+
// patterns in the PCF command
107112
func InquireChannels(patterns string) ([]string, error) {
108113
ChannelInitAttributes()
109114
return inquireObjects(patterns, ibmmq.MQOT_CHANNEL)

mqmetric/mqif.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
8181
qmgrConnected = true
8282
}
8383

84+
// Discover important information about the qmgr - its real name
85+
// and the platform type
8486
if err == nil {
8587
mqod := ibmmq.NewMQOD()
8688
openOptions := ibmmq.MQOO_INQUIRE + ibmmq.MQOO_FAIL_IF_QUIESCING
@@ -236,3 +238,11 @@ func subscribe(topic string) (ibmmq.MQObject, error) {
236238

237239
return subObj, err
238240
}
241+
242+
/*
243+
Return the current platform - the MQPL_* definition value. It
244+
can be turned into a string if necessary via ibmmq.MQItoString("PL"...)
245+
*/
246+
func GetPlatform() int32 {
247+
return platform
248+
}

mqmetric/queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func QueueInitAttributes() {
8989

9090
// If we need to list the queues that match a pattern. Not needed for
9191
// the status queries as they (unlike the pub/sub resource stats) accept
92-
// patterns in the
92+
// patterns in the PCF command
9393
func InquireQueues(patterns string) ([]string, error) {
9494
QueueInitAttributes()
9595
return inquireObjects(patterns, ibmmq.MQOT_Q)

0 commit comments

Comments
 (0)