Skip to content

Commit f3b9fbe

Browse files
authored
Add K8 support to IBM MQ Mixin (#1119)
* finished * change default value of enable k8 * remove instance variable from selector * lint fix * remove brace from config into query itself
1 parent 5678b1f commit f3b9fbe

File tree

5 files changed

+180
-121
lines changed

5 files changed

+180
-121
lines changed

ibm-mq-mixin/config.libsonnet

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
22
_config+:: {
3+
enableMultiCluster: false,
4+
ibmmqSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"',
35
dashboardTags: ['ibm-mq-mixin'],
46
dashboardPeriod: 'now-1h',
57
dashboardTimezone: 'default',
68
dashboardRefresh: '1m',
9+
logExpression: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"'
10+
else 'job=~"$job"',
711

812
//alerts thresholds
913
alertsExpiredMessages: 2, //count

ibm-mq-mixin/dashboards/cluster-overview.libsonnet

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local grafana = (import 'grafonnet/grafana.libsonnet');
33
local dashboard = grafana.dashboard;
44
local template = grafana.template;
55
local prometheus = grafana.prometheus;
6+
local getMatcher(cfg) = '%(ibmmqSelector)s' % cfg;
67

78
local dashboardUid = 'ibm-mq-cluster-overview';
89

@@ -12,11 +13,11 @@ local promDatasource = {
1213
uid: '${%s}' % promDatasourceName,
1314
};
1415

15-
local clustersPanel = {
16+
local clustersPanel(matcher) = {
1617
datasource: promDatasource,
1718
targets: [
1819
prometheus.target(
19-
'count(count(ibmmq_qmgr_commit_count{job=~"$job"}) by (mq_cluster))',
20+
'count(count(ibmmq_qmgr_commit_count{' + matcher + '}) by (mq_cluster))',
2021
datasource=promDatasource,
2122
legendFormat='{{job}} - {{mq_cluster}}',
2223
format='time_series',
@@ -63,11 +64,11 @@ local clustersPanel = {
6364
},
6465
};
6566

66-
local queueManagersPanel = {
67+
local queueManagersPanel(matcher) = {
6768
datasource: promDatasource,
6869
targets: [
6970
prometheus.target(
70-
'count(count(ibmmq_qmgr_commit_count{job=~"$job"}) by (qmgr, mq_cluster))',
71+
'count(count(ibmmq_qmgr_commit_count{' + matcher + '}) by (qmgr, mq_cluster))',
7172
datasource=promDatasource,
7273
legendFormat='',
7374
format='time_series',
@@ -114,11 +115,11 @@ local queueManagersPanel = {
114115
},
115116
};
116117

117-
local topicsPanel = {
118+
local topicsPanel(matcher) = {
118119
datasource: promDatasource,
119120
targets: [
120121
prometheus.target(
121-
'count(count(ibmmq_topic_messages_received{job=~"$job"}) by (topic, mq_cluster))',
122+
'count(count(ibmmq_topic_messages_received{' + matcher + '}) by (topic, mq_cluster))',
122123
datasource=promDatasource,
123124
legendFormat='{{job}} - {{mq_cluster}}',
124125
format='time_series',
@@ -165,11 +166,11 @@ local topicsPanel = {
165166
},
166167
};
167168

168-
local queuesPanel = {
169+
local queuesPanel(matcher) = {
169170
datasource: promDatasource,
170171
targets: [
171172
prometheus.target(
172-
'count(count(ibmmq_queue_depth{job=~"$job"}) by (queue, mq_cluster))',
173+
'count(count(ibmmq_queue_depth{' + matcher + '}) by (queue, mq_cluster))',
173174
datasource=promDatasource,
174175
legendFormat='',
175176
format='time_series',
@@ -216,41 +217,41 @@ local queuesPanel = {
216217
},
217218
};
218219

219-
local queueOperationsPanel = {
220+
local queueOperationsPanel(matcher) = {
220221
datasource: promDatasource,
221222
targets: [
222223
prometheus.target(
223-
'sum by (mq_cluster) (ibmmq_queue_mqset_count{mq_cluster=~"$mq_cluster", job=~"$job"})',
224+
'sum by (mq_cluster) (ibmmq_queue_mqset_count{' + matcher + ', mq_cluster=~"$mq_cluster"})',
224225
datasource=promDatasource,
225226
legendFormat='MQSET',
226227
format='time_series',
227228
),
228229
prometheus.target(
229-
'sum by (mq_cluster) (ibmmq_queue_mqinq_count{mq_cluster=~"$mq_cluster", job=~"$job"})',
230+
'sum by (mq_cluster) (ibmmq_queue_mqinq_count{' + matcher + ', mq_cluster=~"$mq_cluster"})',
230231
datasource=promDatasource,
231232
legendFormat='MQINQ',
232233
format='time_series',
233234
),
234235
prometheus.target(
235-
'sum by (mq_cluster) (ibmmq_queue_mqget_count{mq_cluster=~"$mq_cluster", job=~"$job"})',
236+
'sum by (mq_cluster) (ibmmq_queue_mqget_count{' + matcher + ', mq_cluster=~"$mq_cluster"})',
236237
datasource=promDatasource,
237238
legendFormat='MQGET',
238239
format='time_series',
239240
),
240241
prometheus.target(
241-
'sum by (mq_cluster) (ibmmq_queue_mqopen_count{mq_cluster=~"$mq_cluster", job=~"$job"})',
242+
'sum by (mq_cluster) (ibmmq_queue_mqopen_count{' + matcher + ', mq_cluster=~"$mq_cluster"})',
242243
datasource=promDatasource,
243244
legendFormat='MQOPEN',
244245
format='time_series',
245246
),
246247
prometheus.target(
247-
'sum by (mq_cluster) (ibmmq_queue_mqclose_count{mq_cluster=~"$mq_cluster", job=~"$job"})',
248+
'sum by (mq_cluster) (ibmmq_queue_mqclose_count{' + matcher + ', mq_cluster=~"$mq_cluster"})',
248249
datasource=promDatasource,
249250
legendFormat='MQCLOSE',
250251
format='time_series',
251252
),
252253
prometheus.target(
253-
'sum by (mq_cluster) (ibmmq_queue_mqput_mqput1_count{mq_cluster=~"$mq_cluster", job=~"$job"})',
254+
'sum by (mq_cluster) (ibmmq_queue_mqput_mqput1_count{' + matcher + ', mq_cluster=~"$mq_cluster"})',
254255
datasource=promDatasource,
255256
legendFormat='MQPUT/MQPUT1',
256257
format='time_series',
@@ -325,11 +326,11 @@ local queueOperationsPanel = {
325326
},
326327
};
327328

328-
local clusterStatusPanel = {
329+
local clusterStatusPanel(matcher) = {
329330
datasource: promDatasource,
330331
targets: [
331332
prometheus.target(
332-
'ibmmq_cluster_suspend{mq_cluster=~"$mq_cluster", job=~"$job"}',
333+
'ibmmq_cluster_suspend{' + matcher + ', mq_cluster=~"$mq_cluster"}',
333334
datasource=promDatasource,
334335
legendFormat='{{job}} - {{mq_cluster}}',
335336
format='time_series',
@@ -434,11 +435,11 @@ local clusterStatusPanel = {
434435
],
435436
};
436437

437-
local queueManagerStatusPanel = {
438+
local queueManagerStatusPanel(matcher) = {
438439
datasource: promDatasource,
439440
targets: [
440441
prometheus.target(
441-
'ibmmq_qmgr_status{mq_cluster=~"$mq_cluster", job=~"$job"}',
442+
'ibmmq_qmgr_status{' + matcher + ', mq_cluster=~"$mq_cluster"}',
442443
datasource=promDatasource,
443444
legendFormat='',
444445
format='time_series',
@@ -571,17 +572,17 @@ local queueManagerStatusPanel = {
571572
],
572573
};
573574

574-
local transmissionQueueTimePanel = {
575+
local transmissionQueueTimePanel(matcher) = {
575576
datasource: promDatasource,
576577
targets: [
577578
prometheus.target(
578-
'ibmmq_channel_xmitq_time_short{type="SENDER",job=~"$job", mq_cluster=~"$mq_cluster"}',
579+
'ibmmq_channel_xmitq_time_short{type="SENDER", ' + matcher + ', mq_cluster=~"$mq_cluster"}',
579580
datasource=promDatasource,
580581
legendFormat='{{channel}} - short',
581582
format='time_series',
582583
),
583584
prometheus.target(
584-
'ibmmq_channel_xmitq_time_long{type=~"SENDER", job=~"$job", mq_cluster=~"$mq_cluster"}',
585+
'ibmmq_channel_xmitq_time_long{type=~"SENDER", ' + matcher + ', mq_cluster=~"$mq_cluster"}',
585586
datasource=promDatasource,
586587
legendFormat='{{channel}} - long',
587588
format='time_series',
@@ -701,6 +702,18 @@ local transmissionQueueTimePanel = {
701702
allValues='',
702703
sort=0
703704
),
705+
template.new(
706+
'cluster',
707+
promDatasource,
708+
'label_values(ibmmq_qmgr_commit_count{job=~"$job"}, cluster)',
709+
label='Cluster',
710+
refresh=2,
711+
includeAll=true,
712+
multi=true,
713+
allValues='',
714+
hide=if $._config.enableMultiCluster then '' else 'variable',
715+
sort=0
716+
),
704717
]
705718
)
706719
.addLink(grafana.link.dashboards(
@@ -712,14 +725,14 @@ local transmissionQueueTimePanel = {
712725
))
713726
.addPanels(
714727
[
715-
clustersPanel { gridPos: { h: 7, w: 4, x: 0, y: 0 } },
716-
queueManagersPanel { gridPos: { h: 7, w: 4, x: 4, y: 0 } },
717-
topicsPanel { gridPos: { h: 7, w: 4, x: 8, y: 0 } },
718-
queuesPanel { gridPos: { h: 7, w: 4, x: 12, y: 0 } },
719-
queueOperationsPanel { gridPos: { h: 15, w: 8, x: 16, y: 0 } },
720-
clusterStatusPanel { gridPos: { h: 4, w: 16, x: 0, y: 7 } },
721-
queueManagerStatusPanel { gridPos: { h: 4, w: 16, x: 0, y: 11 } },
722-
transmissionQueueTimePanel { gridPos: { h: 8, w: 24, x: 0, y: 15 } },
728+
clustersPanel(getMatcher($._config)) { gridPos: { h: 7, w: 4, x: 0, y: 0 } },
729+
queueManagersPanel(getMatcher($._config)) { gridPos: { h: 7, w: 4, x: 4, y: 0 } },
730+
topicsPanel(getMatcher($._config)) { gridPos: { h: 7, w: 4, x: 8, y: 0 } },
731+
queuesPanel(getMatcher($._config)) { gridPos: { h: 7, w: 4, x: 12, y: 0 } },
732+
queueOperationsPanel(getMatcher($._config)) { gridPos: { h: 15, w: 8, x: 16, y: 0 } },
733+
clusterStatusPanel(getMatcher($._config)) { gridPos: { h: 4, w: 16, x: 0, y: 7 } },
734+
queueManagerStatusPanel(getMatcher($._config)) { gridPos: { h: 4, w: 16, x: 0, y: 11 } },
735+
transmissionQueueTimePanel(getMatcher($._config)) { gridPos: { h: 8, w: 24, x: 0, y: 15 } },
723736
]
724737
),
725738

0 commit comments

Comments
 (0)