On z/OS, MQ produces a lot of information about its usage through SMF records. One tool I published on GitHub a couple of years ago was designed to take collected SMF data and process it into a more consumable format. The goal was to create something that did nothing more than format the data, rather than try to analyse it in the manner of SupportPac MP1B. The analysis would be done using independent tools.

The comma-separated-value format is ideal for importing into spreadsheets and databases. Many of our z/OS customers have been helped by reports created from their data, and analysed through SQL queries.

While I didn’t write about it in a blog post then, I did publish a short video showing it in action. And since the original release, I’ve made regular updates to the code. Mostly these have been to simplify the SQL processing.

I’ve now updated the program to give a further output format option. It is intended to make it easy to feed SMF information to other analytics tools, many of which work with JSON structures. Other aspects of MQ administration can now be done with JSON-format data – the error logs on Distributed platforms, an event formatter (which is also available in MQ V9.0.5), the REST APIs for administration and messaging – and this is one further piece of a consistent story.

Getting the SMF formatter

The formatting program is available on GitHub with both source code and executable versions in the tree. You can extract the single program for your preferred platform (Linux, AIX and Windows are provided) or you can clone the entire tree and build it yourself. Documentation is also provided.

Running the program

To get the JSON output, download the collected raw SMF data to your Linux or Windows machine. Then run

mqsmfcsv -i <input file> -f json 

This will write the data to a single file in the current directory. You might prefer to stream directly to another processing program, and using “-o-” as a further parameter sends the output to stdout for easy piping.

Example JSON output

This shows the start of formatting one of the sample SMF files provided with the tool. Each record is turned into a single structure.

"recordType" : 116,
"recordSubType" : 0,
"structure" : "QMAC",
"date" : "2015/11/23",
"time" : "11:00:00.020000",
"lpar" : "H019",
"qmgr" : "MQPC",
"mqVersion" : "800",
"authorisationId" : "IMS     ",
"correlId" : "F0F2F3F6C2C3F1E4C4D6C340",
"connectionName" : "PRDC    ",
"operatorId" : "PLN1231 ",
"applicationType" : "IMS MPP/BMP",
"accountingToken" : "00000000000000000000000000000000000000000000",
"networkId" : "D7D9C4C340404040044E0A0800000001",

Future thoughts

A recently-added feature in z/OS is the ability to collect SMF data dynamically, to enable more real-time processing. It would be nice to collect the MQ records immediately, to give live status information. I’ve designed the mqsmfcsv tool with that in mind, but it’s something that I want to think more about for the future.

Join The Discussion

Your email address will not be published.