@@ -338,6 +338,7 @@ func parseQMgrData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string {
338
338
// And then re-parse the message so we can store the metrics now knowing the map key
339
339
parmAvail = true
340
340
offset = 0
341
+ hostname := DUMMY_STRING
341
342
for parmAvail && cfh .CompCode != ibmmq .MQCC_FAILED {
342
343
elem , bytesRead = ibmmq .ReadPCFParameter (buf [offset :])
343
344
offset += bytesRead
@@ -352,12 +353,15 @@ func parseQMgrData(instanceType int32, cfh *ibmmq.MQCFH, buf []byte) string {
352
353
startTime = strings .TrimSpace (elem .String [0 ])
353
354
case ibmmq .MQCACF_Q_MGR_START_DATE :
354
355
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 ])
355
358
}
356
359
}
357
360
}
358
361
359
362
now := time .Now ()
360
363
st .Attributes [ATTR_QMGR_UPTIME ].Values [key ] = newStatusValueInt64 (statusTimeDiff (now , startDate , startTime ))
364
+ qMgrInfo .HostName = hostname
361
365
362
366
traceExitF ("parseQMgrData" , 0 , "Key: %s" , key )
363
367
return key
@@ -400,3 +404,24 @@ func parseQMgrListeners(cfh *ibmmq.MQCFH, buf []byte) bool {
400
404
func QueueManagerNormalise (attr * StatusAttribute , v int64 ) float64 {
401
405
return statusNormalise (attr , v )
402
406
}
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