A requirement I’ve seen a couple of times recently asked how to save an MQ queue manager’s configuration in a different format than MQSC. This short post shows one way to do that.
The dmpmqcfg program is the standard product-provided solution for backing up all the object definitions. It’s got a number of options including the ability to generate the output in a fashion suitable for replay – you can use its output as input to runmqsc and regenerate the original objects. But sometimes the purpose of the recording might be for analysis or comparisons. While the options in dmpmqcfg (for example one-line output) may help with that, some tools might find be easier to work with a different format than MQSC.
The obvious answer here (and the one that we have told people) is to use MQ’s REST Admin API. Putting calls to that in a script will give what you are looking for.
And as an exercise, I wrote such a script this morning.
dmpmqcfg.sh -m QM1 -s localhost -u metaylor -c <passw0rd>
which gives output as a set of JSON objects such as
{ "queueManager": "QM1", "objectType": "QMGR", "objects": [ { "acctcono": "DISABLED", "acctint": 1800, "acctmqi": "OFF", "acctq": "OFF", "activrec": "MSG", "actvcono": "DISABLED", "actvtrc": "OFF", ... } { "queueManager": "QM1", "objectType": "POLICY", "objects": [ { "encalg": "AES256", "enforce": "YES", "keyreuse": "DISABLED", "policy": "X", "recip": [ "CN=M..." ], "signalg": "MD5" } ] }
It is a bash script, and relies on curl and jq. Those two commands do exist on Windows so it should be adaptable to run there if you wanted. The use of jq is optional, but I felt a bit of transformation gave a slightly better output. For example it now includes the queue manager name in each set of objects.
The full (but short) script can be found as a gist on github.com. Feel free to adapt it for your own reports.
This post was last updated on December 11th, 2020 at 10:27 am