I'm trying to setup a script to check statistics in IBM MQ using python with the pymqi module. The problem is that it looks like the connection does not use the username I have provided in the script. It looks like the user is trying to use the username of the user executing the script. While testing the connection I have used a small script like this:
import pymqi
queue_manager = "MYQMGR"
channel = "CHNL.SRV01"
host = "host.to.connect.to.example.net"
port = "1444"
conn_info = "%s(%s)" % (host, port)
user = 'mq-user'
password = 'mq-user-pass'
qmgr = pymqi.connect(queue_manager, channel, conn_info, user, password)
qmgr.disconnect()
Let's say that the script is executed by a linux user called "shell-user". Then in the logs on the queue manager it says that "shell-user" is trying to connect, not "mq-user" as I have written in the script.
The error message looks like this:
Traceback (most recent call last): File "./test_conn.py", line 25, in <module>
qmgr = pymqi.connect(queue_manager, channel, conn_info, user, password) File "/usr/lib64/python2.7/site-packages/pymqi/__init__.py", line 2604, in connect
qmgr.connect_tcp_client(queue_manager or '', CD(), channel, conn_info, user, password) File "/usr/lib64/python2.7/site-packages/pymqi/__init__.py", line 1447, in connect_tcp_client
self.connect_with_options(name, cd, user=user, password=password) File "/usr/lib64/python2.7/site-packages/pymqi/__init__.py", line 1429, in connect_with_options
raise MQMIError(rv[1], rv[2]) pymqi.MQMIError: MQI Error. Comp: 2, Reason 2035: FAILED: MQRC_NOT_AUTHORIZED
I'm using pymqi 1.8.0 and the MQSeriesClient 8.0.0-8. I have searched for days for a solution to this. Anyone out there who knows how to handle this?
Edit:
The version of the queue manager we're connecting to is 8.0.0.8.
This the error message we get from the queue manager:
2/1/2019 09:32:45 - Process(8176.400417) User(abcdefg-1234) Program(amqrmppa.exe)
Host(mq-host-01) Installation(Installation1)
VRMF(8.0.0.8) QMgr(MYQMGR)
AMQ9557: Queue Manager User ID initialization failed for 'shell-user'.
EXPLANATION:
The call to initialize the User ID 'shell-user' failed with CompCode 2 and Reason
2035. If an MQCSP block was used, the User ID in the MQCSP block was
'mq-user'.
ACTION:
Correct the error and try again.