How to connect to a remote queue manager from a source machine to do Administration activities or monitoring kind of stuff .
Linux Machine –> Windows Machine
Connect from Linux Machine to –> QMGR Running on Windows machine
Majority of the IT who supports MQ are very well aware of Shell scripting but when it comes to windows server it you want to do some kind of monitoring then you should go for Powershell or another kind of python etc scripting .
There is a simple way to schedule a script or to do some activities on a remote queue manager like in a local Linux queue manager by connecting from the source queue manager .
All we have to do is use create a server connection channel on a windows queue manager
Under your windows QMGR define a server connection channel
- DEFINE CHL(Name) CHLTYPE(SVRCONN) MCAUSER(‘Name‘)
On your UNIX or Linux system set the environment variable:
- export MQSERVER=’ChannelName/TransportType/ConnectionName’
- ex export MQSERVER=’CLNT.SVRCONN/TCP/WINHOST(1414)’
Now you can make use of the below command to administrate your remote QMGR
- runmqsc -c -u UserID QMGRNAME
with the -u option we need to provide the password . Since we will be using channel authentication at Windows QMGR we don’t require to pass userid .
. runmqsc -c QMGRNAME
-c acts for client mode to connect to the QMGR. Without -c runmqsc command tries to connect to local queue manager with in the same server
Don’t forget to update the channel authentication record
if we don’t give channel authentication we will get AMQ8135E: Not authorized error .
AMQ8135: Not authorized. No MQSC commands read. No commands have a syntax error. All valid MQSC commands were processed.
Now once we are able to connect to remote queue manager we can do what ever the activities we want like . Have a script to monitor and trigger some alerts from Linux machine to a queue manger running on Windows machine .