Skip to content

Commit bf0a10e

Browse files
committed
Update for MQ V9.1.3, mq-golang 4.0.8
1 parent 03505f5 commit bf0a10e

File tree

31 files changed

+448
-155
lines changed

31 files changed

+448
-155
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
Newest updates are at the top of this file.
33

4+
### Jul 11 2019
5+
* Update to use v4.0.8 of the mq-golang repository
6+
* Enable use of USAGE queue attribute
7+
* Supported in the Prometheus and JSON monitors
8+
* Don't give a visible error from setmqenv if queue manager remote
9+
410
### Jun 24 2019
511
* Update to use v4.0.7 of the mq-golang repository
612
* Enable time-based re-expansion of queue wildcards while monitors are running

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ ENV GOVERSION=1.10 \
2222
ORG="github.com/ibm-messaging" \
2323
REPO="mq-metric-samples"
2424

25-
# Location of the downloadable MQ client package \
26-
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
27-
RDTAR="IBM-MQC-Redist-LinuxX64.tar.gz" \
28-
VRMF=9.1.2.0
29-
3025
# Install the Go compiler and Git
3126
RUN export DEBIAN_FRONTEND=noninteractive \
3227
&& bash -c 'source /etc/os-release; \
@@ -54,6 +49,11 @@ RUN mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg \
5449
&& mkdir -p /opt/mqm \
5550
&& chmod a+rx /opt/mqm
5651

52+
# Location of the downloadable MQ client package \
53+
ENV RDURL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqdev/redist" \
54+
RDTAR="IBM-MQC-Redist-LinuxX64.tar.gz" \
55+
VRMF=9.1.3.0
56+
5757
# Install the MQ client from the Redistributable package. This also contains the
5858
# header files we need to compile against.
5959
RUN cd /opt/mqm \

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.7"
3+
version = "4.0.8"
44

55
[prune]
66
go-tests = true

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ and are also included in the `vendor` tree of this repository.
1717

1818
## Getting started
1919

20-
### Sample requirements
20+
### Requirements
2121

2222
You will require the following programs:
2323

24+
* Go compiler. This should be at least version 10. If you see an error similar to "ld: NULL not defined"
25+
then it is likely you need to upgrade your compiler.
2426
* [dep](https://golang.github.io/dep/) - Golang dependency management tool
2527

2628
To build the programs on Linux and MacOS, you must set an environment variable to permit some compile/link flags.
@@ -54,7 +56,8 @@ with getting the agent running in your specific environment.
5456

5557
## Using a Docker container to build the programs
5658
You can use the `buildMonitors.sh` script in this directory to build a Docker container that
57-
in turn will build the binary programs and copy them to a local directory.
59+
in turn will build the binary programs and copy them to a local directory. That script also
60+
sets some extra version-related flags that will be shown when the program starts.
5861

5962
## More information
6063
Each of the sample monitor programs has its own README file describing the

buildMonitors.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ then
6161
# Get some variables to pass the build information into the compile steps
6262
buildStamp=`date +%Y%m%d-%H%M%S`
6363
gitCommit=`git rev-list -1 HEAD --abbrev-commit`
64+
hw=`uname -i`
65+
os=`uname -s`
66+
bp="$os/$hw"
6467

6568
# Set this for any special status
6669
extraInfo=""
@@ -71,7 +74,7 @@ then
7174
docker run --rm \
7275
--user $uid:$gid \
7376
-v $OUTDIR:$GOPATH/bin \
74-
-e BUILD_EXTRA_INJECT="-X \"main.BuildStamp=$buildStamp $extraInfo\" -X \"main.GitCommit=$gitCommit\"" \
77+
-e BUILD_EXTRA_INJECT="-X \"main.BuildStamp=$buildStamp $extraInfo\" -X \"main.BuildPlatform=$bp\" -X \"main.GitCommit=$gitCommit\"" \
7578
$TAG:$VER
7679
echo "Compiled programs should now be in $OUTDIR"
7780
fi

cmd/mq_aws/main.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ package main
1919
*/
2020

2121
import (
22-
"fmt"
2322
"os"
2423
"time"
2524

2625
"github.com/ibm-messaging/mq-golang/mqmetric"
26+
cf "github.com/ibm-messaging/mq-metric-samples/pkg/config"
2727
log "github.com/sirupsen/logrus"
2828
)
2929

3030
var BuildStamp string
3131
var GitCommit string
32+
var BuildPlatform string
3233

3334
func initLog() {
3435
level, err := log.ParseLevel(config.logLevel)
@@ -38,21 +39,10 @@ func initLog() {
3839
log.SetLevel(level)
3940
}
4041

41-
func printInfo(title string, stamp string, commit string) {
42-
fmt.Println(title)
43-
if stamp != "" {
44-
fmt.Println("Build : " + stamp)
45-
}
46-
if commit != "" {
47-
fmt.Println("Commit Level : " + commit)
48-
}
49-
fmt.Println("")
50-
}
51-
5242
func main() {
5343
var err error
5444

55-
printInfo("IBM MQ metrics exporter for AWS CloudWatch monitoring", BuildStamp, GitCommit)
45+
cf.PrintInfo("IBM MQ metrics exporter for AWS CloudWatch monitoring", BuildStamp, GitCommit, BuildPlatform)
5646

5747
initConfig()
5848
initLog()

cmd/mq_aws/mq_aws.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
qMgr=$1
88

99
# Set the environment to ensure we pick up libmqm.so etc
10-
. /opt/mqm/bin/setmqenv -m $qMgr -k
10+
# If this is a client connection, then deal with no known qmgr of the given name.
11+
. /opt/mqm/bin/setmqenv -m $qMgr -k >/dev/null 2>&1
12+
if [ $? -ne 0 ]
13+
then
14+
. /opt/mqm/bin/setmqenv -s -k
15+
fi
1116

1217
# A list of queues to be monitored is given here.
1318
# It is a set of names or patterns ('*' only at the end, to match how MQ works),

cmd/mq_coll/main.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ package main
1919
*/
2020

2121
import (
22-
"fmt"
2322
"os"
2423
"time"
2524

2625
"github.com/ibm-messaging/mq-golang/mqmetric"
26+
cf "github.com/ibm-messaging/mq-metric-samples/pkg/config"
2727
log "github.com/sirupsen/logrus"
2828
)
2929

3030
var BuildStamp string
3131
var GitCommit string
32+
var BuildPlatform string
3233

3334
func initLog() {
3435
level, err := log.ParseLevel(config.logLevel)
@@ -41,21 +42,10 @@ func initLog() {
4142
log.SetOutput(os.Stderr)
4243
}
4344

44-
func printInfo(title string, stamp string, commit string) {
45-
fmt.Println(title)
46-
if stamp != "" {
47-
fmt.Println("Build : " + stamp)
48-
}
49-
if commit != "" {
50-
fmt.Println("Commit Level : " + commit)
51-
}
52-
fmt.Println("")
53-
}
54-
5545
func main() {
5646
var err error
5747

58-
printInfo("IBM MQ metrics exporter for collectd", BuildStamp, GitCommit)
48+
cf.PrintInfo("IBM MQ metrics exporter for collectd", BuildStamp, GitCommit, BuildPlatform)
5949

6050
initConfig()
6151
initLog()

cmd/mq_coll/mq_coll.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ qMgr=$1
1010
# Set the environment to ensure we pick up libmqm.so etc
1111
# This assumes there is an MQ installation in the default location, even
1212
# if it is not the one associated with the queue manager
13-
. /opt/mqm/bin/setmqenv -m $qMgr -k
13+
# If this is a client connection, then deal with no known qmgr of the given name.
14+
. /opt/mqm/bin/setmqenv -m $qMgr -k >/dev/null 2>&1
15+
if [ $? -ne 0 ]
16+
then
17+
. /opt/mqm/bin/setmqenv -s -k
18+
fi
1419

1520
# A list of queues to be monitored is given here.
1621
# It is a set of names or patterns ('*' only at the end, to match how MQ works),

0 commit comments

Comments
 (0)