Managing the inside of your IBM MQ with Puppet

In this playground, we will show you how you can use Puppet to manage your IBM MQ setup.

The playground system

The playground system contains a pre-installed puppet agent. There is no server available, so to run Puppet, you have to use the puppet apply command. The playground text will guide you with this.

On the playground system, you will find an IBM MQ with the MQ manager MQ01. We have created it using the mq_config module. The playground will guide you in your customisations.

Working in the playground

Under this text, you see the working area. You can inspect the system and issue any command you like in the terminal. In the editor window, you can see the Puppet production environment. You can edit anything you wish. The documentation tab shows the documentation for the mq_config module.


This system will self destruct in about one hour. So please don’t use it to build or create anything you wish to keep!

Subjects in this playground

The playground contains the following sub paragraphs:
  • Using Puppet for introspection
  • Puppet knows about your MQ managers too
  • Creating a manager with Puppet from the command line
  • Modifying a manager with Puppet from the command line
Happy exploring!!

Using Puppet for introspection

In this section, we’ll show you how you can use Puppet to introspect your IBM MQ server. In general in Puppet to introspect any resource, you use the command:

$ puppet resource <puppet_type> [<resource_name>]

Looking at your mq_server with puppet

Standard, however, Puppet doesn’t know about IBM MQ. There is a set of mq_ types extending puppet, so it now knows about Ibm queues and what is inside. First off, we will take a look at the list of types created for IBM MQ management.

So to see what types are provided to manage your queues, enter the next command.

puppet resource --types | grep ^mq_

The command will list all the types existing in puppet resource and filters the output for those starting with mq prefix.

Puppet knows about your MQ managers too

In the last section, we showed you what types are provided in our Puppet modules to introspect your queues. In this section, we will get a close look at the mq_manager type.

TEASER: introspection is the prequel to creating and managing MQ managers with the Puppet.

Introspect available MQ managers

Remember the general command for introspecting?

puppet resource <puppet_type> [<resource_name>]

For MQ managers, the Puppet type is mq_manager. So the command becomes.

puppet resource ma_manager

The output of this command can be used as a starting point for defining new MQ managers.

Creating a manager with Puppet from the command line

We have been using Puppet from the command line for introspecting. But you can also use puppet on the command line for creating and changing MQ resources. To do this we again use the puppet resource command.

The general command for making sure a resource exists is:

puppet resource <puppet_type> [<resource_name>] ensure=present

“Making sure a resource exists” means that when it doesn’t exist, Puppet will create it for us.

Let’s use this to create a new manager with the name MY_TEST_MANAGER.

Create the MQ manage

The command to make this happen is:

puppet resource mq_manager MY_TEST_MANAGER ensure=present

Modifying a manager with Puppet from the command line

The manager MY_TEST_MANAGER exist now, but it has the default properties. With the same command as the command to create it, you can also set other properties of the MQ manager.

Setting the statq

The statq of the manager specifies whether statistics data is to be collected for queues. It is OFF at its default value. That is not good. We want statistics to be collected and set it ON.

We can use the same puppet resource command and append the change.

puppet resource mq_manager MY_TEST_MANAGER statq=ON

More information about properties managed by Puppet can be found on Enterprise Modules documentation website.## You like it?

Do you like what you see here and want to test this on your own infrastructure? No problem. You can sign up for a free trial.

If you have any questions, don’t hesitate to contact us.