@@ -338,6 +338,7 @@ func parseQMgrData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string {
338338 // And then re-parse the message so we can store the metrics now knowing the map key
339339 parmAvail = true
340340 offset = 0
341+ hostname := DUMMY_STRING
341342 for parmAvail && cfh .CompCode != ibmmq .MQCC_FAILED {
342343 elem , bytesRead = ibmmq .ReadPCFParameter (buf [offset :])
343344 offset += bytesRead
@@ -352,12 +353,15 @@ func parseQMgrData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string {
352353 startTime = strings .TrimSpace (elem .String [0 ])
353354 case ibmmq .MQCACF_Q_MGR_START_DATE :
354355 startDate = strings .TrimSpace (elem .String [0 ])
356+ case ibmmq .MQCACF_HOST_NAME : // This started to be available from 9.3.2
357+ hostname = strings .TrimSpace (elem .String [0 ])
355358 }
356359 }
357360 }
358361
359362 now := time .Now ()
360363 st .Attributes [ATTR_QMGR_UPTIME ].Values [key ] = newStatusValueInt64 (statusTimeDiff (now , startDate , startTime ))
364+ qMgrInfo .HostName = hostname
361365
362366 traceExitF ("parseQMgrData" , 0 , "Key: %s" , key )
363367 return key
@@ -400,3 +404,24 @@ func parseQMgrListeners(cfh *ibmmq.MQCFH, buf []byte) bool {
400404func QueueManagerNormalise (attr * StatusAttribute , v int64 ) float64 {
401405 return statusNormalise (attr , v )
402406}
407+
408+ // Return the nominated MQCA* attribute from the object's attributes
409+ // stored in the map. The "key" is unused for now, but might be useful
410+ // if we do a version that supports connections to multiple qmgrs. And it keeps
411+ // the function looking like the equivalent for the Queue query.
412+ func GetQueueManagerAttribute (key string , attribute int32 ) string {
413+ v := DUMMY_STRING
414+
415+ switch attribute {
416+ case ibmmq .MQCACF_HOST_NAME :
417+ v = qMgrInfo .HostName
418+ default :
419+ v = DUMMY_STRING
420+ }
421+ v = strings .TrimSpace (v )
422+
423+ if v == "" {
424+ v = DUMMY_STRING
425+ }
426+ return v
427+ }
0 commit comments