How do I ping an IBM WebSphere MQ queue manager? Is there a way through cmd.exe
? Is there a way to use WebSphere to do it?
I have tried
runmqsc QMGR "qManager"
Thanks!
Depends on what exactly you mean by 'ping'. Do you want to check for running WMQ processes? For local connectivity to the QMgr? Remote connectivity? Whether a specific channel or queue is available?
Locally you can use dspmq
and it will show you all the locally defined QMgrs and their status. Remotely, you can ping the listener but if you do not complete the connection, it causes WMQ to log an error and cut a trace. Remotely, it is better to use the WMQ client to make a connection. If the connection succeeds then the QMgr is up. If you get an error, then the error code (or linked exception in JMS) will tell you how far into the WMQ stack the connection request got - i.e. whether the listener was down, or if it was up and there was a problem at the QMgr, or if you don't have authority, etc.
There are sample programs that come with MQ such as amqsget
and amsqput
, and their client-based equivalents amqsgetc
or amqsputc
, which connect and get or put a message. These can be used in scripts to check MQ status. Also, there is a tutorial here that provides a stand-alone JMS program that can connect which you could customize as a ping application.
The format for the command you tried is:
echo dis qmgr qmname | runmqsc QMGRNAME
This echoes a command to display the QMgr's attributes into runmqsc
and executes it. The manual containing all the runmqsc
commands for v7.0 is here. The v7.1 manual is here.
Finally, although I don't think this is what you are looking for, WMQ has a ping command. It is used on one queue manager to test the channel connectivity to another queue manager. The WMQ ping exercises the channel path and validates things such as the remote listener is up, the remote queue manager has a compatible channel instance defined, etc. However, this is more useful to an MQ administrator than to a developer wanting to know if the queue manager is up. For that you'd want some version of one of the suggestions above.