Verifying a deployed IBM MQ software component from an SSH terminal emulator

Verify an IBM® MQ software component locally, without authorizing remote users to the virtuser user ID. Test the deployment from an SSH terminal emulator.

Before you begin

  • Deploy the pattern successfully; see Deploying IBM MQ Virtual System Pattern Type patterns.
  • Open an SSH terminal emulator window on the client workstation you are using to connect to a virtual machine in the virtual system instance.
    • On UNIX and Linux®, run the ssh command.
    • On Windows, obtain an SSH terminal emulator such as PuTTY. The PuTTY website is PuTTY: A Free Telnet/SSH Client. When a connection is established with the deployed virtual machine, the steps in the task are the same.

About this task

Verify the deployment of an IBM MQ software component by running the put and get sample programs on the virtual machine where the IBM MQ software component is deployed.

The user ID virtuser is not a member of the mqm group. The example demonstrates the use of the sudo command to make virtuser a temporary member of the mqm group for the duration of the command. The example also sets up the minimum set of permissions for virtuser to run the put and get sample programs, and then removes them. As an alternative, the example also shows running the sudo command to run the put and get sample programs.

Procedure

  1. Obtain the host name or IP address of the virtual machine that contains a deployed IBM MQ software component.
    1. In the appliance user interface, click Instances > Virtual Systems. Click the virtual system instance in the navigator.

      The property window for the virtual system instance opens.

    2. In the property window, click the plus sign next to Virtual machines to expand the list of virtual machines.

      A list of the virtual machines in the system instance opens. Each virtual machine has a plus sign and an icon to show that it is running: Click to expand.

    3. Click the plus sign next to the virtual machine you want to connect to.

      The properties of the virtual machine are listed.

    The public IP address is displayed in the list of virtual machines.

  2. Connect the SSH terminal emulator you are running to the virtual machine.
    • On UNIX and Linux:
      1. In a command shell window type
        
        ssh virtuser@ hostname-IPaddress
        
        . where hostname-IPaddress is either a host name or IP address.

        The system responds with a password prompt.

        Note: The first time you connect an SSH session, you must respond to the host authentication prompt. To continue, respond yes.
      2. Type the password of the virtuser user ID.
    • On Windows:
      1. Open the PuTTY configuration window by running the PuTTY command.
      2. In the Session tab, type the Host Name (or IP address) and click Open. Leave the Port as 22, and the Connection type as SSH.

        The system responds by opening a window and the prompt, login as:

      3. Type virtuser.

        The system responds with a password prompt.

        Note: The first time you connect an SSH session, you must respond to the host authentication prompt. To continue, respond yes.
      4. Type the password of the virtuser user ID.
  3. Verify the version of IBM MQ.
    Check the version of IBM MQ that is returned by the following command:
    
    su mqm -c 'dspmqver'
    
  4. Authorize the user ID virtuser to run the verification application.
    1. Give virtuser permission to connect to the queue manager.
      
      sudo -u mqm setmqaut -m QmgrName -t qmgr -p virtuser +connect
      

      The system responds with:


      [sudo] password for virtuser:
      Type the password for the user ID virtuser.

      The system responds with:


      The setmqaut command completed successfully.

    2. Give virtuser permission to use put, get, and inquire MQI calls against the queue used for verification.
      
      sudo -u mqm setmqaut -m QmgrName -n SYSTEM.DEFAULT.LOCAL.QUEUE -t queue -p virtuser +put +get +inq
      

      The system responds with:


      The setmqaut command completed successfully.

  5. Put a message on SYSTEM.DEFAULT.LOCAL.QUEUE.
    
    /opt/mqm/samp/bin/amqsput SYSTEM.DEFAULT.LOCAL.QUEUE QmgrName 
    
    The system response:

    Sample AMQSPUT0 start


    target queue is qName
  6. Type in a message followed by two new lines
    Hello world
     
    The system response:

    Sample AMQSPUT0 end
  7. Get the message from SYSTEM.DEFAULT.LOCAL.QUEUE.
    
    /opt/mqm/samp/bin/amqsget SYSTEM.DEFAULT.LOCAL.QUEUE QmgrName 
    
    The system response:

    Sample AMQSGET0 start


    message <Hello world>

    15 seconds delay

    no more messages


    Sample AMQSGET0 end

Results

You demonstrated the queue manager is working correctly.

What to do next

You have completed the verification task. You might choose to remove the changes you made, and try the sudo command to run the put and get sample programs.

  1. Remove the authorizations you set by running the following commands:
    
    sudo -u mqm setmqaut -m QmgrName -t qmgr -p virtuser -connect
    sudo -u mqm dspmqaut -m QmgrName -t qmgr -p virtuser
    sudo -u mqm setmqaut -m QmgrName -n SYSTEM.DEFAULT.LOCAL.QUEUE -t queue -p virtuser -put -get -inq
    sudo -u mqm dspmqaut -m QmgrName -n SYSTEM.DEFAULT.LOCAL.QUEUE -t queue -p virtuser
    
  2. Run the verification again with the sudo command:
    1. Put a message onto SYSTEM.DEFAULT.LOCAL.QUEUE
      
      sudo -u mqm /opt/mqm/samp/bin/amqsput SYSTEM.DEFAULT.LOCAL.QUEUE QmgrName 
      
      Type a message followed by two new lines.
    2. Get the message from SYSTEM.DEFAULT.LOCAL.QUEUE
      
      sudo -u mqm /opt/mqm/samp/bin/amqsget SYSTEM.DEFAULT.LOCAL.QUEUE QmgrName 
      
      Wait for 15 seconds for the program to finish.