Skip to content

Commit 83109d2

Browse files
authored
Merge pull request #38 from parrobe/makefile
Remove logging and move Samples
2 parents 691ea52 + c874d56 commit 83109d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+158
-8059
lines changed

CHANGES.md renamed to CHANGELOG.md

Lines changed: 79 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,95 @@
1+
# Changelog
12

2-
08 Jul 2016
3-
* Initial release
3+
## May 2018
44

5-
18 Jul 2016
6-
* Changed structures so that most applications will not need to use cgo to imbed the MQ C headers
7-
* Go programs will now use int32 where C programs use MQLONG
8-
* Use of message handles, distribution lists require cgo for now
9-
* Package ibmmq now includes the numeric #defines as a Go file, cmqc.go, for easier use
10-
* Removed "src/" prefix from tree in github repo
11-
* Removed need for buffer length parm on Put/Put1
12-
* Updated comments
13-
* Added MQINQ
14-
* Added MQItoString function for some maps of values to constant names
5+
* Corrected package imports
6+
* Formatted go code with `go fmt`
7+
* Rearranged this file
8+
* Removed logging from golang package `mqmetric`
9+
* Moved samples to a separate repository
1510

16-
25 Jul 2016
17-
* Added functions to handle basic PCF creation and parsing
18-
* Added a monitor command for exporting MQ V9 queue manager data to Prometheus. See
19-
the [README](cmd/mq_prometheus/README.md) for more details
20-
21-
04 Aug 2016
22-
* Added a monitor command for exporting MQ data to InfluxDB. See the [README]
23-
(cmd/mq_influx/README.md) for more details
24-
* Restructured the monitoring code to put common material in the mqmetric
25-
package, called from the Influx and Prometheus monitors.
26-
27-
12 Aug 2016
28-
* Added a OpenTSDB monitor. See the [README](cmd/mq_opentsdb/README.md) for
29-
more details.
30-
* Added a Collectd monitor. See the [README](cmd/mq_coll/README.md) for
31-
more details.
32-
* Added MQI MQCNO/MQCSP structures to support client connections and password authentication
33-
with MQCONNX.
34-
* Allow client-mode connections from the monitor programs
35-
* Added Grafana dashboards for the different monitors to show how to query them
36-
* Changed database password mechanism so that "exec" maintains the PID for MQ services
11+
## March 2018 - v1.0.0
3712

38-
23 Aug 2016
39-
* Added a collector for Amazon AWS CloudWatch monitoring. See the [README](cmd/mq_aws/README.md)
40-
for more details.
13+
* Added V9.0.5 constant definitions
14+
* Changed #cgo directives for Windows now the compiler supports standard path names
15+
* Added mechanism to set MQ userid and password for Prometheus monitor
16+
* Released v1.0.0 of this repository for use with golang dependency management tools
4117

42-
17 Oct 2016
43-
* Added some Windows support. An example batch file is included in the mq_influx directory;
44-
changes would be needed to the MQSC script to call it. The other monitor programs can be
45-
supported with similar modifications.
46-
* Added a "getting started" section to this README.
18+
## October 2017
4719

48-
07 Nov 2016
49-
* Added a collector that prints metrics in a simple JSON format.
50-
See the [README](cmd/mq_json/README.md) for more details.
51-
* Fixed bug where freespace metrics were showing as non-integer bytes, not percentages
20+
* Added V9.0.4 constant definitions - now generated from original MQ source code
21+
* Added MQSC script to show how to redefine event queues for pub/sub
22+
* Prometheus collector has new parameter to override the first component of the metric name
23+
* Prometheus collector can now process channel-level statistics
24+
25+
## 18 May 2017
26+
27+
* Added the V9.0.3 constant definitions.
28+
* Reinstated 64-bit structure "length" fields in cmqc.go after fixing a bug in the base product C source code generator.
29+
30+
## 25 Mar 2017
31+
32+
* Added the metaPrefix option to the Prometheus monitor. This allows selection of non-default resources such as the MQ Bridge for Salesforce included in MQ 9.0.2.
33+
34+
## 15 Feb 2017
35+
36+
* API BREAKING CHANGE: The MQI verbs have been changed to return a single error indicator instead of two separate values. See mqitest.go for examples of how MQRC/MQCC codes can now be tested and extracted. This change makes the MQI implementation a bit more natural for Go environments.
37+
38+
## 10 Jan 2017
39+
40+
* Added support for the MQCD and MQSCO structures to allow programmable client connectivity, without requiring a CCDT. See the clientconn sample program for an example of using the MQCD.
41+
* Moved sample programs into subdirectory
42+
43+
## 14 Dec 2016
5244

53-
14 Dec 2016
5445
* Minor updates to this README for formatting
5546
* Removed xxx_CURRENT_LENGTH definitions from cmqc
5647

57-
10 Jan 2017
58-
* Added support for the MQCD and MQSCO structures to allow programmable client
59-
connectivity, without requiring a CCDT. See the clientconn sample program
60-
for an example of using the MQCD.
61-
* Moved sample programs into subdirectory
48+
## 07 Nov 2016
6249

63-
15 Feb 2017
64-
* API BREAKING CHANGE: The MQI verbs have been changed to return a single
65-
error indicator instead of two separate values. See mqitest.go for
66-
examples of how MQRC/MQCC codes can now be tested and extracted. This change
67-
makes the MQI implementation a bit more natural for Go environments.
50+
* Added a collector that prints metrics in a simple JSON format. See the [README](cmd/mq_json/README.md) for more details.
51+
* Fixed bug where freespace metrics were showing as non-integer bytes, not percentages
6852

69-
25 Mar 2017
70-
* Added the metaPrefix option to the Prometheus monitor. This allows selection of non-default resources such as the MQ Bridge for Salesforce included in MQ 9.0.2.
53+
## 17 Oct 2016
7154

72-
18 May 2017
73-
* Added the V9.0.3 constant definitions.
74-
* Reinstated 64-bit structure "length" fields in
75-
cmqc.go after fixing a bug in the base product C source code generator.
55+
* Added some Windows support. An example batch file is included in the mq_influx directory; changes would be needed to the MQSC script to call it. The other monitor programs can be supported with similar modifications.
56+
* Added a "getting started" section to this README.
7657

77-
October 2017
78-
* Added V9.0.4 constant definitions - now generated from original MQ source code
79-
* Added MQSC script to show how to redefine event queues for pub/sub
80-
* Prometheus collector has new parameter to override the first component of the metric name
81-
* Prometheus collector can now process channel-level statistics
58+
## 23 Aug 2016
8259

83-
March 2018
84-
* Added V9.0.5 constant definitions
85-
* Changed #cgo directives for Windows now the compiler supports standard path names
86-
* Added mechanism to set MQ userid and password for Prometheus monitor
60+
* Added a collector for Amazon AWS CloudWatch monitoring. See the [README](cmd/mq_aws/README.md) for more details.
61+
62+
## 12 Aug 2016
63+
64+
* Added a OpenTSDB monitor. See the [README](cmd/mq_opentsdb/README.md) for more details.
65+
* Added a Collectd monitor. See the [README](cmd/mq_coll/README.md) for more details.
66+
* Added MQI MQCNO/MQCSP structures to support client connections and password authentication with MQCONNX.
67+
* Allow client-mode connections from the monitor programs
68+
* Added Grafana dashboards for the different monitors to show how to query them
69+
* Changed database password mechanism so that "exec" maintains the PID for MQ services
70+
71+
## 04 Aug 2016
72+
73+
* Added a monitor command for exporting MQ data to InfluxDB. See the [README](cmd/mq_influx/README.md) for more details
74+
* Restructured the monitoring code to put common material in the mqmetric package, called from the Influx and Prometheus monitors.
75+
76+
## 25 Jul 2016
77+
78+
* Added functions to handle basic PCF creation and parsing
79+
* Added a monitor command for exporting MQ V9 queue manager data to Prometheus. See the [README](cmd/mq_prometheus/README.md) for more details
80+
81+
## 18 Jul 2016
82+
83+
* Changed structures so that most applications will not need to use cgo to imbed the MQ C headers
84+
* Go programs will now use int32 where C programs use MQLONG
85+
* Use of message handles, distribution lists require cgo for now
86+
* Package ibmmq now includes the numeric #defines as a Go file, cmqc.go, for easier use
87+
* Removed "src/" prefix from tree in github repo
88+
* Removed need for buffer length parm on Put/Put1
89+
* Updated comments
90+
* Added MQINQ
91+
* Added MQItoString function for some maps of values to constant names
92+
93+
## 08 Jul 2016
8794

95+
* Initial release

README.md

Lines changed: 58 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,115 @@
11
# mq-golang
2+
23
This repository demonstrates how you can call IBM MQ from applications written in the Go language.
34

45
> **NOTICE**: Please ensure that you use a dependency management tool such as [dep](https://github.com/golang/dep) or [Glide](http://glide.sh/), and add a specific version dependency. The current content has been marked as version 1.0.0, and a new version with breaking changes will be released soon. By using a dependency manager, you can continue to use the old version if you want to.
56
6-
The repository also includes programs to export MQ statistics to some monitoring
7-
packages including Prometheus, InfluxDB and OpenTSDB.
7+
This repository previously contained sample programs that exported MQ statistics to some monitoring packages. These have now been moved to a new [GitHub repository called mq-metric-samples](https://github.com/ibm-messaging/mq-metric-samples).
88

9-
A minimum level of MQ V9 is required to build this package.
10-
The monitoring data published by the queue manager is not available before
11-
that version; the interface also assumes availability of
12-
MQI structures from that level of MQ.
9+
A minimum level of MQ V9 is required to build these packages.
10+
The monitoring data published by the queue manager is not available before that version; the interface also assumes availability of MQI structures from that level of MQ.
1311

1412
## Health Warning
1513

16-
This package is provided as-is with no guarantees of support or updates. There are also no guarantees of compatibility
17-
with any future versions of the package; the API is subject to change based on any feedback.
14+
This package is provided as-is with no guarantees of support or updates. There are also no guarantees of compatibility with any future versions of the package; the API is subject to change based on any feedback.
1815

1916
## MQI Description
2017

2118
The ibmmq directory contains a Go package, exposing an MQI-like interface.
2219

23-
The intention is to give an API that is more natural for Go programmers than the common
24-
procedural MQI. For example, fixed length string arrays from the C API such as MQCHAR48 are
25-
represented by the native Go string type. Conversion between these types is handled within the ibmmq
26-
package itself, removing the need for Go programmers to know about it.
20+
The intention is to give an API that is more natural for Go programmers than the common procedural MQI. For example, fixed length string arrays from the C API such as MQCHAR48 are represented by the native Go string type. Conversion between these types is handled within the ibmmq package itself, removing the need for Go programmers to know about it.
2721

28-
A short program in the mqitest directory gives an example of using this interface, to put and get messages
29-
and to subscribe to a topic.
22+
A short program in the mqitest directory gives an example of using this interface, to put and get messages and to subscribe to a topic.
3023

31-
Feedback on the utility of this package, thoughts about whether it should be changed or extended are
32-
welcomed.
24+
Feedback on the utility of this package, thoughts about whether it should be changed or extended are welcomed.
3325

3426
## Using the package
3527

36-
To use code in this repository, you will need to be able to build Go applications, and
37-
have a copy of MQ installed to build against. It uses cgo to access the MQI C structures and definitions. It assumes that MQ has been
38-
installed in the default location on a Linux platform (/opt/mqm) but you can easily change the
39-
cgo directives in the source files if necessary.
28+
To use code in this repository, you will need to be able to build Go applications, and have a copy of MQ installed to build against. It uses cgo to access the MQI C structures and definitions. It assumes that MQ has been installed in the default location on a Linux platform (`/opt/mqm`) but you can easily change the cgo directives in the source files if necessary.
4029

41-
Some Windows capability is also included. This has been tested with Go 1.10
42-
compiler, which now permits standard Windows paths (eg including spaces)
43-
so the CGO directives can point at the normal MQ install path.
30+
Some Windows capability is also included. This has been tested with Go 1.10 compiler, which now permits standard Windows paths (eg including spaces) so the CGO directives can point at the normal MQ install path.
4431

4532
## Getting started
4633

47-
If you are unfamiliar with Go, the following steps can help create a
48-
working environment with source code in a suitable tree. Initial setup
49-
tends to be platform-specific, but subsequent steps are independent of the
50-
platform.
34+
If you are unfamiliar with Go, the following steps can help create a working environment with source code in a suitable tree. Initial setup tends to be platform-specific, but subsequent steps are independent of the platform.
5135

5236
### Linux
5337

54-
* Install the Go runtime and compiler. On Linux, the packaging may vary
55-
but a typical directory for the code is /usr/lib/golang.
56-
* Create a working directory. For example, mkdir $HOME/gowork
38+
* Install the Go runtime and compiler. On Linux, the packaging may vary but a typical directory for the code is `/usr/lib/golang`.
39+
40+
* Create a working directory. For example, ```mkdir $HOME/gowork```
41+
5742
* Set environment variables. Based on the previous lines,
5843

59-
export GOROOT=/usr/lib/golang
44+
```export GOROOT=/usr/lib/golang```
45+
46+
```export GOPATH=$HOME/gowork```
6047

61-
export GOPATH=$HOME/gowork
48+
* If using a version of Go from after 2017, you must set environment variables to permit some compile/link flags. This is due to a security fix in the compiler.
6249

63-
* If using a version of Go from after 2017, you must set environment variables
64-
to permit some compile/link flags. This is due to a security fix in the compiler.
65-
export CGO_LDFLAGS_ALLOW="-Wl,-rpath.*"
50+
```export CGO_LDFLAGS_ALLOW="-Wl,-rpath.*"```
6651

6752
* Install the git client
6853

6954
### Windows
7055

71-
* Install the Go runtime and compiler. On Windows, the
72-
common directory is c:\Go
73-
* Ensure you have a gcc-based compiler, for example from the Cygwin
74-
distribution. I use the mingw variation, to ensure compiled code can
75-
be used on systems without Cygwin installed
76-
* Create a working directory. For example, mkdir c:\Gowork
56+
* Install the Go runtime and compiler. On Windows, the common directory is `c:\Go`
57+
* Ensure you have a gcc-based compiler, for example from the Cygwin distribution. I use the mingw variation, to ensure compiled code can be used on systems without Cygwin installed
58+
* Create a working directory. For example, ```mkdir c:\Gowork```
7759
* Set environment variables. Based on the previous lines,
7860

79-
set GOROOT=c:\Go
61+
```set GOROOT=c:\Go```
8062

81-
set GOPATH=c:\Gowork
63+
```set GOPATH=c:\Gowork```
8264

83-
set CC=x86_64-w64-mingw32-gcc.exe
65+
```set CC=x86_64-w64-mingw32-gcc.exe```
8466

85-
* The CGO_LDFLAGS_ALLOW variable is not needed on Windows
67+
* The `CGO_LDFLAGS_ALLOW` variable is not needed on Windows
8668
* Install the git client
87-
* Make sure the MQ include files and libraries are in a path that does
88-
not include spaces or other special characters, as discussed above.
69+
* Make sure the MQ include files and libraries are in a path that does not include spaces or other special characters, as discussed above.
8970

9071
### Common
9172

92-
* Make sure your PATH includes routes to the Go compiler ($GOROOT/bin),
93-
the Git client, and the C compiler.
94-
* Change directory to the workspace you created earlier. (cd $GOPATH)
95-
* Use git to get a copy of the MQ components into a new directory in the
96-
workspace. Use "src" as the destination, to get the directory created
97-
automatically; this path will then be searched by the Go compiler.
73+
* Make sure your PATH includes routes to the Go compiler (`$GOROOT/bin`), the Git client, and the C compiler.
74+
* Change directory to the workspace you created earlier. (`cd $GOPATH`)
75+
* Use git to get a copy of the MQ components into a new directory in the workspace.
76+
77+
```git clone https://github.com/ibm-messaging/mq-golang.git src/github.com/ibm-messaging/mq-golang```
78+
79+
* Use Go to download prerequisite components for any monitors you are interested in running. The logrus package is required for all of the monitors; but not all of the monitors require further downloads.
80+
81+
```go get -u github.com/Sirupsen/logrus```
9882

99-
git clone https://github.com/ibm-messaging/mq-golang.git src/github.com/ibm-messaging/mq-golang
83+
```go get -u github.com/prometheus/client_golang/prometheus```
10084

101-
* Use Go to download prerequisite components for any monitors you are interested
102-
in running. The logrus package is required for all of the monitors; but not
103-
all of the monitors require further downloads.
85+
```go get -u github.com/influxdata/influxdb/client/v2```
10486

105-
go get -u github.com/Sirupsen/logrus
87+
```go get -u github.com/aws/aws-sdk-go/service```
10688

107-
go get -u github.com/prometheus/client_golang/prometheus
89+
* Compile the `ibmmq` component:
10890

109-
go get -u github.com/influxdata/influxdb/client/v2
91+
```go install ./src/github.com/ibm-messaging/mq-golang/ibmmq```
11092

111-
go get -u github.com/aws/aws-sdk-go/service
93+
* Compile the `mqmetric` component:
11294

113-
* Compile the components you are interested in. For example
95+
```go install ./src/github.com/ibm-messaging/mq-golang/mqmetric```
11496

115-
go install ./src/github.com/ibm-messaging/mq-golang/cmd/mq_prometheus
97+
* Use git to get a get a copy of the MQ samples metric clients in a new directory in the workspace.
11698

117-
At this point, you should have a compiled copy of the code in $GOPATH/bin.
99+
```git clone https://github.com/ibm-messaging/mq-metric-samples.git src/github.com/ibm-messaging/mq-metric-samples```
100+
101+
* Compile the sample programs you are interested in. For example:
102+
103+
```go install ./src/github.com/ibm-messaging/mq-metric-samples/cmd/mq_prometheus```
104+
105+
At this point, you should have a compiled copy of the code in `$GOPATH/bin`.
118106

119107
## Limitations
120108

121-
Not all of the MQI verbs are available through the ibmmq package. This
109+
Not all of the MQI verbs are available through the `ibmmq` package. This
122110
implementation concentrates on the core API calls needed to put and get messages.
123111
Currently unavailable verbs include:
112+
124113
* MQSET
125114
* All of the message property manipulators
126115
* MQCB
@@ -138,3 +127,7 @@ For feedback and issues relating specifically to this package, please use the [G
138127
Contributions to this package can be accepted under the terms of the IBM Contributor License Agreement,
139128
found in the [CLA file](CLA.md) of this repository. When submitting a pull request, you must include a statement stating
140129
you accept the terms in the CLA.
130+
131+
## Copyright
132+
133+
© Copyright IBM Corporation 2016, 2018

0 commit comments

Comments
 (0)