|
1 | 1 | package main |
2 | 2 |
|
3 | 3 | /* |
4 | | - Copyright (c) IBM Corporation 2016, 2018 |
| 4 | + Copyright (c) IBM Corporation 2016, 2019 |
5 | 5 |
|
6 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | you may not use this file except in compliance with the License. |
@@ -122,6 +122,12 @@ func Collect() error { |
122 | 122 | } else { |
123 | 123 | log.Debugf("Collected all topic status") |
124 | 124 | } |
| 125 | + err = mqmetric.CollectSubStatus("*") |
| 126 | + if err != nil { |
| 127 | + log.Errorf("Error collecting topic status: %v", err) |
| 128 | + } else { |
| 129 | + log.Debugf("Collected all topic status") |
| 130 | + } |
125 | 131 |
|
126 | 132 | if config.qStatus { |
127 | 133 | err = mqmetric.CollectQueueStatus(config.monitoredQueues) |
@@ -295,6 +301,36 @@ func Collect() error { |
295 | 301 | } |
296 | 302 | } |
297 | 303 | } |
| 304 | + |
| 305 | + for _, attr := range mqmetric.SubStatus.Attributes { |
| 306 | + for key, value := range attr.Values { |
| 307 | + if value.IsInt64 { |
| 308 | + subId := mqmetric.SubStatus.Attributes[mqmetric.ATTR_SUB_ID].Values[key].ValueString |
| 309 | + subName := mqmetric.SubStatus.Attributes[mqmetric.ATTR_SUB_NAME].Values[key].ValueString |
| 310 | + subType := int(mqmetric.SubStatus.Attributes[mqmetric.ATTR_SUB_TYPE].Values[key].ValueInt64) |
| 311 | + subTypeString := strings.Replace(ibmmq.MQItoString("SUBTYPE", subType), "MQSUBTYPE_", "", -1) |
| 312 | + topicString := mqmetric.SubStatus.Attributes[mqmetric.ATTR_SUB_TOPIC_STRING].Values[key].ValueString |
| 313 | + |
| 314 | + key1 := subId |
| 315 | + |
| 316 | + if pt, ok = ptMap[key1]; !ok { |
| 317 | + pt = pointsStruct{} |
| 318 | + pt.ObjectType = "subscription" |
| 319 | + pt.Metric = make(map[string]float64) |
| 320 | + pt.Tags = make(map[string]string) |
| 321 | + pt.Tags["qmgr"] = strings.TrimSpace(config.qMgrName) |
| 322 | + pt.Tags["platform"] = platformString |
| 323 | + pt.Tags["subid"] = subId |
| 324 | + pt.Tags["subscription"] = subName |
| 325 | + pt.Tags["type"] = subTypeString |
| 326 | + pt.Tags["topic"] = topicString |
| 327 | + } |
| 328 | + |
| 329 | + pt.Metric[fixup(attr.MetricName)] = mqmetric.QueueManagerNormalise(attr, value.ValueInt64) |
| 330 | + ptMap[key1] = pt |
| 331 | + } |
| 332 | + } |
| 333 | + } |
298 | 334 | } |
299 | 335 |
|
300 | 336 | for _, pt := range ptMap { |
|
0 commit comments