ClusterQueueManagerController

The second part of the URI must be clusqmgr to call the ClusterQueueManagerController.

inquire

Get information from clusters. This action executes the MQCMD_INQUIRE_CLUSTER_Q_MGR pcf command. On success, the returned JSON object will have a data array, on failure an error object.

URL Parameters

/api/clusqmgr/inquire/<QueueManager>/<ClusterName>/<ClusterQMgrName>

QueueManager

The name of the queuemanager. This parameter is required!

ClusterName

The name of a cluster. Generic names are supported. When this parameter is used, the query parameter for ClusterName is ignored.

ClusterQMgrName

The name of a queuemanager that is part of the cluster. Generic names are supported. When this parameter is used, the query parameter for ClusterQMgr is ignored.

Query Parameters

Channel

Specifies that eligible cluster queue managers are limited to those having the specified channel name. Generic names are supported.

ClusterName

The name of a cluster. Generic names are supported. This parameter is ignored, when a URL parameter is used. name is a synonym for this parameter.

ClusterQMgrAttrs

With the ClusterQMgrAttrs parameter you can specify which attributes must be returned from the PCF command. Multiple occurences of this parameter are possible. The value must be a (case-sensitive) valid attribute name. attrs is a synonym for this parameter.

ClusterQMgrName

The name of a queuemanager that is part of the cluster. This parameter is ignored when a URL parameter is used. When omitted a * is used.

CommandScope

Specifies how the command is executed when the queue manager is a member of a queue-sharing group. This parameter applies to z/OS only.

Filter

Speficies which filter to use: I means Integerfilter, S means Stringfilter. FilterParam and FilterValue are required to create the filter. When a filter can’t be build because of too little information, it will be silently discarded.

FilterOp

The operator that is being used to evaluate whether the parameter satisfies the filter-value. The default is EQ.

The following values are allowed:

A Stringfilter can use some additional operators:

FilterParam

The name of the parameter to filter on. The names are based on the names used in the WebSphere MQ information center.

FilterValue

The value to use for filtering. When a string is passed for an Integerfilter, a WebSphere MQ constant is assumed.

QSGDisposition

Disposition of the object within the group. Possible values are Live, Copy, Group, QMgr, Private or All. This parameter applies to z/OS only.

Example

/api/clusqmgr/inquire/PIGEON/BIRDS
/api/clusqmgr/inquire/PIGEON/BIRDS/BLACKBIRD
/api/clusqmgr/inquire/PIGEON?ClusterName=BIRDS

<?php

	/*
	 * Inquire all cluster information from queuemanager PIGEON.
	 * MQWeb runs on localhost and is listening on port 8081. 
	 */
	$url = "http://localhost:8081/api/clusqmgr/inquire/PIGEON";

	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

	if ( ($response = curl_exec($curl)) === false )	{
		$err = curl_error($curl);
		echo "An HTTP error occurred while inquiring cluster queuemanagers: $err\n";
	}
	else {
		$json = json_decode($response);
		if ( isset($json->error) ) {
			echo "An MQ error occurred while inquiring cluster queuemanagers.\n";
			echo "Reason Code: {$json->error->reason->code} - {$json->error->reason->desc}\n";
		}
		else {
			if ( isset($json->data) && count($json->data) > 0 ) {
				foreach($json->data as $clusqmgr)
				{
					echo $clusqmgr->ClusterName->value;
					echo " : ";
					echo $clusqmgr->QMgrName->value;
					echo "\n";
				}
			}
			else
			{
				echo "No cluster queuemanagers found\n";
			}
		}
	}

JSON Object

When using an application/json POST request you can post a JSON object with names like the query parameters.

All URL parameters and query parameters are ignored except for the URL parameter for the name of the queuemanager.

    {
      'ClusterName' : 'BIRDS',
      'ClusterQMgrName' : '*'
    }

There are some differences between query parameters and a JSON object:

An IntegerFilterCommand can’t be used together with a StringFilterCommand

#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say);

use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;

# List all known clusters with their queuemanagers

my $qmgr = shift;
die("Please pass me the name of a queuemanager as argument") 
	unless defined($qmgr);

my $json = JSON->new;

my %input = ( 
  'ClusterQMgrName' => '*',
  'ClusterName' => '*'
);
my $content = $json->encode(\%input);    

my $ua = LWP::UserAgent->new;
my $req = POST 'http://localhost:8081/api/clusqmgr/inquire/' . $qmgr;    
$req->header(
	'Content-Type' => 'application/json',
	'Content-length' => length($content)
);
$req->content($content);

my $res = $ua->request($req);

my $mqweb = $json->decode($res->content());
if ( exists($mqweb->{error}) ) {
	say 'An MQ error occurred while inquiring queues.';
	say 'Reason Code: '
		, $mqweb->{error}->{reason}->{code}
		, ' - '
		, $mqweb->{error}->{reason}->{desc};
}
else {
	my %clusters;
	foreach my $clusqmgr(@{$mqweb->{data}}) {
		my $clusterName = $clusqmgr->{ClusterName}->{value};
		push(@{$clusters{$clusterName}}, $clusqmgr->{QMgrName}->{value});
	}

	foreach my $cluster(keys(%clusters))
	{
	  say $cluster;
	  say '-' x length($cluster);
	  foreach my $qmgr(@{$clusters{$cluster}})
	  {
	    say '  ', $qmgr;
	  }
	}
}

suspend

Suspend the queuemanager in a cluster. This action executes the MQCMD_SUSPEND_Q_MGR_CLUSTER pcf command.

The returned JSON object will have an error object when a WebSphere MQ error occurred.

URL Parameters

/api/clusqmgr/suspend/<QueueManager>/<ClusterName>

QueueManager

The name of the queuemanager. This parameter is required!

ClusterName

The name of a cluster. When this parameter is used, the query parameter for ClusterName is ignored.

Query Parameters

ClusterName

The name of a cluster. This parameter is ignored, when a URL parameter is used.

ClusterNamelist

The name of a cluster namelist. This parameter can not be used together with ClusterName.

CommandScope

Specifies how the command is executed when the queue manager is a member of a queue-sharing group. This parameter applies to z/OS only.

Mode

The mode on how the local queue manager is suspended from the cluster. The case-sensitive value can be Quiesce or Force.

Example

/api/clusqmgr/suspend/PIGEON/BIRDS
/api/clusqmgr/suspend/PIGEON?ClusterName=BIRDS&Mode=Quiesce

<?php

	/*
	 * Suspend queuemanager PIGEON in cluster BIRDS.
	 * MQWeb runs on localhost and is listening on port 8081. 
	 */
	$url = 'http://localhost:8081/api/clusqmgr/suspend/PIGEON/BIRDS';

	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

	if ( ($response = curl_exec($curl)) === false )	{
		$err = curl_error($curl);
		echo 'An HTTP error occurred while suspending: ', $err, PHP_EOL;
	}
	else {
		$json = json_decode($response);
		if ( isset($json->error) ) {
			echo 'An MQ error occurred while suspending.', PHP_EOL;
			echo 'Reason Code: ',
				$json->error->reason->code,
				' - ',
				$json->error->reason->desc, 
				PHP_EOL;
		}
		else {
			echo 'Queuemanager PIGEON suspended in clusterd BIRDS', PHP_EOL;
		}
	}

JSON Object

When using an application/json POST request you can post a JSON object with names like the query parameters.

All URL parameters and query parameters are ignored except for the URL parameter for the name of the queuemanager.

    {
      'ClusterName' : 'BIRDS',
      'Mode' : 'Quiesce'
    }
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say);

use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;

# Suspend a queuemanager in a cluster

my $qmgr = shift;
die("Please pass me the name of a queuemanager as argument") 
	unless defined($qmgr);

my $cluster = shift;
die("Please pass me the name of a cluster as second argument")
	unless defined($cluster);

my $json = JSON->new;

my %input = ( 
  'ClusterName' => $cluster
);
my $content = $json->encode(\%input);    

my $ua = LWP::UserAgent->new;
my $req = POST 'http://localhost:8081/api/clusqmgr/suspend/' . $qmgr;    
$req->header(
	'Content-Type' => 'application/json',
	'Content-length' => length($content)
);
$req->content($content);

my $res = $ua->request($req);

my $mqweb = $json->decode($res->content());

if ( exists($mqweb->{error}) ) {
	say 'An MQ error occurred while suspending queuemanager.';
	say 'Reason Code: '
		, $mqweb->{error}->{reason}->{code}
		, ' - '
		, $mqweb->{error}->{reason}->{desc};
}
else {
	say $qmgr, " is suspended in cluster ", $cluster;
}

resume

Resume the queuemanager in a cluster. This action executes the MQCMD_RESUME_Q_MGR_CLUSTER pcf command.

The returned JSON object will have an error object when a WebSphere MQ error occurred.

ClusterName

The name of a cluster. This parameter is ignored, when a URL parameter is used.

ClusterNamelist

The name of a cluster namelist. This parameter can not be used together with ClusterName.

CommandScope

Specifies how the command is executed when the queue manager is a member of a queue-sharing group. This parameter applies to z/OS only.

Example

/api/clusqmgr/resume/PIGEON/BIRDS
/api/clusqmgr/resume/PIGEON?ClusterName=BIRDS

#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say);

use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;

# Resume a queuemanager in a cluster

my $qmgr = shift;
die("Please pass me the name of a queuemanager as argument") 
	unless defined($qmgr);

my $cluster = shift;
die("Please pass me the name of a cluster as second argument")
	unless defined($cluster);

my $json = JSON->new;

my %input = ( 
  'ClusterName' => $cluster
);
my $content = $json->encode(\%input);    

my $ua = LWP::UserAgent->new;
my $req = POST 'http://localhost:8081/api/clusqmgr/resume/' . $qmgr;    
$req->header(
	'Content-Type' => 'application/json',
	'Content-length' => length($content)
);
$req->content($content);

my $res = $ua->request($req);

my $mqweb = $json->decode($res->content());

if ( exists($mqweb->{error}) ) {
	say 'An MQ error occurred while resuming queuemanager.';
	say 'Reason Code: '
		, $mqweb->{error}->{reason}->{code}
		, ' - '
		, $mqweb->{error}->{reason}->{desc};
}
else {
	say $qmgr, " is resumed in cluster ", $cluster;
}

JSON Object

When using an application/json POST request you can post a JSON object with names like the query parameters.

All URL parameters and query parameters are ignored except for the URL parameter for the name of the queuemanager.

    {
      'ClusterName' : 'BIRDS'
    }