Skip to content

Commit 73df743

Browse files
committed
Update to use mqmetric 4.0.7 for z/OS pageset/bufferpool
1 parent 9c2ecb3 commit 73df743

File tree

18 files changed

+892
-75
lines changed

18 files changed

+892
-75
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4+
### Jun 24 2019
5+
* Update to use v4.0.7 of the mq-golang repository
6+
* Enable time-based re-expansion of queue wildcards while monitors are running
7+
* `-rediscoverInterval=30m` Default is `1h`. Can be set to 0 to disable.
8+
* Supported in the Prometheus and JSON monitors
9+
* Show z/OS pageset/bufferpool data
10+
* Supported in the Prometheus and JSON monitors
11+
412
### Jun 06 2019
513
* Update to use v4.0.6 of the mq-golang repository
614
* Permit limited monitoring of pre-V9 Distributed platforms
7-
* Add queue_attribute_max_depth to permit %full calculation
15+
* Add `queue_attribute_max_depth` to permit %full calculation
816

917
## April 23 2019
1018
* Update to use v4.0.5 of the mq-golang repository

Gopkg.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[constraint]]
22
name = "github.com/ibm-messaging/mq-golang"
3-
version = "4.0.6"
3+
version = "4.0.7"
44

55
[prune]
66
go-tests = true

cmd/mq_json/exporter.go

Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ import (
3535
)
3636

3737
var (
38-
first = true
39-
errorCount = 0
40-
lastPoll = time.Now()
41-
platformString = ""
38+
first = true
39+
errorCount = 0
40+
lastPoll = time.Now()
41+
lastQueueDiscovery = time.Now()
42+
platformString = ""
4243
)
4344

4445
const (
@@ -125,9 +126,9 @@ func Collect() error {
125126
}
126127
err = mqmetric.CollectSubStatus(config.cf.MonitoredSubscriptions)
127128
if err != nil {
128-
log.Errorf("Error collecting topic status: %v", err)
129+
log.Errorf("Error collecting subscription status: %v", err)
129130
} else {
130-
log.Debugf("Collected all topic status")
131+
log.Debugf("Collected all subscription status")
131132
}
132133

133134
err = mqmetric.CollectQueueStatus(config.cf.MonitoredQueues)
@@ -136,6 +137,25 @@ func Collect() error {
136137
} else {
137138
log.Debugf("Collected all queue status")
138139
}
140+
141+
if mqmetric.GetPlatform() == ibmmq.MQPL_ZOS {
142+
err = mqmetric.CollectUsageStatus()
143+
if err != nil {
144+
log.Errorf("Error collecting bufferpool/pageset status: %v", err)
145+
} else {
146+
log.Debugf("Collected all buffer pool/pageset status")
147+
}
148+
}
149+
}
150+
}
151+
152+
thisDiscovery := time.Now()
153+
elapsed = thisDiscovery.Sub(lastQueueDiscovery)
154+
if config.cf.RediscoverDuration > 0 {
155+
if elapsed >= config.cf.RediscoverDuration {
156+
s := config.cf.MonitoredQueues
157+
err = mqmetric.RediscoverAndSubscribe(s, true, "")
158+
lastQueueDiscovery = thisDiscovery
139159
}
140160
}
141161

@@ -212,7 +232,7 @@ func Collect() error {
212232
chlName := mqmetric.ChannelStatus.Attributes[mqmetric.ATTR_CHL_NAME].Values[key].ValueString
213233
connName := mqmetric.ChannelStatus.Attributes[mqmetric.ATTR_CHL_CONNNAME].Values[key].ValueString
214234
jobName := mqmetric.ChannelStatus.Attributes[mqmetric.ATTR_CHL_JOBNAME].Values[key].ValueString
215-
key1 := chlName + "/" + connName + "/" + jobName + "/" + rqmName
235+
key1 := "channel/" + chlName + "/" + connName + "/" + jobName + "/" + rqmName
216236

217237
if pt, ok = ptMap[key1]; !ok {
218238
pt = pointsStruct{}
@@ -238,7 +258,7 @@ func Collect() error {
238258
for key, value := range attr.Values {
239259
if value.IsInt64 {
240260
qName := mqmetric.QueueStatus.Attributes[mqmetric.ATTR_Q_NAME].Values[key].ValueString
241-
key1 := qName
261+
key1 := "queue/" + qName
242262

243263
if pt, ok = ptMap[key1]; !ok {
244264
pt = pointsStruct{}
@@ -261,7 +281,7 @@ func Collect() error {
261281
if value.IsInt64 {
262282
topicName := mqmetric.TopicStatus.Attributes[mqmetric.ATTR_TOPIC_STRING].Values[key].ValueString
263283
topicStatusType := mqmetric.TopicStatus.Attributes[mqmetric.ATTR_TOPIC_STATUS_TYPE].Values[key].ValueString
264-
key1 := mqmetric.TopicKey(topicName, topicStatusType)
284+
key1 := "topic/" + mqmetric.TopicKey(topicName, topicStatusType)
265285

266286
if pt, ok = ptMap[key1]; !ok {
267287
pt = pointsStruct{}
@@ -285,7 +305,7 @@ func Collect() error {
285305
if value.IsInt64 {
286306
qMgrName := mqmetric.QueueManagerStatus.Attributes[mqmetric.ATTR_QMGR_NAME].Values[key].ValueString
287307

288-
key1 := qMgrName
308+
key1 := "qmgr/" + qMgrName
289309

290310
if pt, ok = ptMap[key1]; !ok {
291311
pt = pointsStruct{}
@@ -311,7 +331,7 @@ func Collect() error {
311331
subTypeString := strings.Replace(ibmmq.MQItoString("SUBTYPE", subType), "MQSUBTYPE_", "", -1)
312332
topicString := mqmetric.SubStatus.Attributes[mqmetric.ATTR_SUB_TOPIC_STRING].Values[key].ValueString
313333

314-
key1 := subId
334+
key1 := "subscription/" + subId
315335

316336
if pt, ok = ptMap[key1]; !ok {
317337
pt = pointsStruct{}
@@ -326,11 +346,61 @@ func Collect() error {
326346
pt.Tags["topic"] = topicString
327347
}
328348

329-
pt.Metric[fixup(attr.MetricName)] = mqmetric.QueueManagerNormalise(attr, value.ValueInt64)
349+
pt.Metric[fixup(attr.MetricName)] = mqmetric.SubNormalise(attr, value.ValueInt64)
330350
ptMap[key1] = pt
331351
}
332352
}
333353
}
354+
355+
if mqmetric.GetPlatform() == ibmmq.MQPL_ZOS {
356+
for _, attr := range mqmetric.UsageBpStatus.Attributes {
357+
for key, value := range attr.Values {
358+
bpId := mqmetric.UsageBpStatus.Attributes[mqmetric.ATTR_BP_ID].Values[key].ValueString
359+
bpLocation := mqmetric.UsageBpStatus.Attributes[mqmetric.ATTR_BP_LOCATION].Values[key].ValueString
360+
bpClass := mqmetric.UsageBpStatus.Attributes[mqmetric.ATTR_BP_CLASS].Values[key].ValueString
361+
if value.IsInt64 && !attr.Pseudo {
362+
key1 := "bufferpool/" + bpId
363+
if pt, ok = ptMap[key1]; !ok {
364+
pt = pointsStruct{}
365+
pt.ObjectType = "bufferpool"
366+
pt.Metric = make(map[string]float64)
367+
pt.Tags = make(map[string]string)
368+
pt.Tags["bufferpool"] = bpId
369+
pt.Tags["location"] = bpLocation
370+
pt.Tags["pageclass"] = bpClass
371+
pt.Tags["qmgr"] = strings.TrimSpace(config.cf.QMgrName)
372+
pt.Tags["platform"] = platformString
373+
}
374+
pt.Metric[fixup(attr.MetricName)] = mqmetric.UsageNormalise(attr, value.ValueInt64)
375+
ptMap[key1] = pt
376+
}
377+
}
378+
}
379+
380+
for _, attr := range mqmetric.UsagePsStatus.Attributes {
381+
for key, value := range attr.Values {
382+
psId := mqmetric.UsagePsStatus.Attributes[mqmetric.ATTR_PS_ID].Values[key].ValueString
383+
bpId := mqmetric.UsagePsStatus.Attributes[mqmetric.ATTR_PS_BPID].Values[key].ValueString
384+
if value.IsInt64 && !attr.Pseudo {
385+
key1 := "pageset/" + psId
386+
if pt, ok = ptMap[key1]; !ok {
387+
pt = pointsStruct{}
388+
pt.ObjectType = "pageset"
389+
pt.Metric = make(map[string]float64)
390+
pt.Tags = make(map[string]string)
391+
pt.Tags["pageset"] = psId
392+
pt.Tags["bufferpool"] = bpId
393+
pt.Tags["qmgr"] = strings.TrimSpace(config.cf.QMgrName)
394+
pt.Tags["platform"] = platformString
395+
}
396+
pt.Metric[fixup(attr.MetricName)] = mqmetric.UsageNormalise(attr, value.ValueInt64)
397+
ptMap[key1] = pt
398+
}
399+
400+
}
401+
}
402+
}
403+
334404
}
335405

336406
for _, pt := range ptMap {

0 commit comments

Comments
 (0)