2
2
# Functions
3
3
# 0: print usage
4
4
printUsage (){
5
- echo -e " \033[1;33mThis script will try to cover following things:\033[0m"
5
+ echo " Description: "
6
+ echo " This script will try to cover following things:"
6
7
echo " 1. Check user running this script has authority to execute MQSC commands"
7
8
echo " 2. Check the available listener ports and define a new one if there is no available"
8
- echo " 3. Define a channel and set authrec for it with the specified user"
9
+ echo " 3. Define a channel and set authrec for it with the specified user. "
9
10
echo " 4. Check the connectivity of the channel with specified user"
10
11
echo " 5. Define a topic or use existing topic object for topic string '$SYS /Broker' and set authrec for it"
11
- echo " 6. List the useful info you can use to set in configuration.yaml for plugin.ace"
12
- echo -e " \033[1;31mNote: this script will cover most cases, but sometimes if you fail to create the mq objects, please contact IBM Instana support or contact IBM MQ support team for help. \033[0m"
13
- echo -e " \033[1;33mUsage: $0 -q <QMGR_NAME> -d <MQ_BIN_PATH> -u <AUTH_USER>\033[0m"
14
- echo -e " \033[1;33mExample $0 -q QM1 -d /opt/mqm/bin -u root\033[0m"
12
+ echo " 6. List the useful info you can use to set in configuration.yaml for plugin.ace and plugin.ibmmq"
13
+ echo -e " \033[1;33mNote: this script will cover most cases, but sometimes if you fail to create the mq objects, please contact IBM Instana support or contact IBM MQ support team for help. \033[0m"
14
+ echo " "
15
+ echo " Usage: $0 -q <QMGR_NAME> -d <MQ_BIN_PATH> -u <AUTH_USER> [-c CHANNEL_NAME] [-m]"
16
+ echo " Example: "
17
+ echo " $0 -q QM1 -d /opt/mqm/bin -u root -c INSTANA.SVRCONN -m"
18
+ echo " $0 -q QM1 -d /opt/mqm/bin -u root -m"
19
+ echo " $0 -q QM1 -d /opt/mqm/bin -u root -c INSTANA.SVRCONN"
20
+ echo " $0 -q QM1 -d /opt/mqm/bin -u root"
21
+ echo " "
22
+ echo " Arguments:"
23
+ echo " -q <QMGR_NAME> Required. Specify the queuemanager name to execute the script with"
24
+ echo " -d <MQ_BIN_PATH> Required. Specify the mq bin path"
25
+ echo " -u <AUTH_USER> Required. Specify the user to give authority for mq/ace monitoring"
26
+ echo " -c <CHANNEL_NAME> Optional. Specify the channel to be created. If not specify, the default channel INSTANA.SVRCONN will be used."
27
+ echo " -m Optional. Set up MQ channel for MQ sensor only. If not set, both channel and topic will be created to support both mq sensor and ace sensor."
15
28
}
16
29
17
30
# 1. Check the current user has authority to execute MQSC commands
18
31
preCheck (){
19
32
# Check user authority
20
33
if groups | tr ' ' ' \n' | grep -q ' ^mqm$' ; then
21
- echo -e " \033[1;32mINFO : The user launched the script belongs to mqm group\033[0m "
34
+ echo " INFO : The user launched the script belongs to mqm group"
22
35
else
23
36
echo -e " \033[1;31mERROR: The user launched the script doesn't belong to mqm group, please use an authorized user to execute MQSC commands\033[0m"
24
37
exit 1
25
38
fi
26
39
27
40
# check mq bin path
28
- echo " Check the MQ_BIN_PATH exists and file setmqenv exists"
41
+ echo " INFO: Check the MQ_BIN_PATH exists and file setmqenv exists"
29
42
if [ ! -d " $MQ_BIN_PATH " ] || [ ! -f " $MQ_BIN_PATH /setmqenv" ]; then
30
43
echo -e " \033[1;31mERROR: The path $MQ_BIN_PATH or the file $MQ_BIN_PATH /setmqenv does not exist or both don't exist.\033[0m"
31
44
exit 1
32
45
else
33
- echo -e " \033[1;32mINFO : The $MQ_BIN_PATH and related file setmqenv exist.\033[0m "
46
+ echo " INFO : The $MQ_BIN_PATH and related file setmqenv exist."
34
47
fi
35
48
36
49
# Setup mq environment to accept mqsc command.
37
- echo -e " \033[1;33mINFO : Setup mq environment to accept mqsc command\033[0m "
50
+ echo " INFO : Setup mq command environment to accept mqsc command"
38
51
. $MQ_BIN_PATH /setmqenv -s
39
52
if [ $? -eq 0 ]; then
40
- echo -e " \033[1;32mINFO : The environment has been set successfully. \033[0m "
53
+ echo " INFO : The mq command environment has been set successfully."
41
54
else
42
55
echo -e " \033[1;31mERROR: Failed to set the environment\033[0m"
43
56
exit 1
44
57
fi
58
+
59
+ # check the nc command for linux and telnet for aix
60
+ os_type=$( uname -s)
61
+ if [[ " $os_type " == " Linux" ]]; then
62
+ if ! command -v nc > /dev/null 2>&1 ; then
63
+ echo -e " \033[1;31mERROR: nc command not found on Linux system, please relaunch the script after you install nc\033[0m"
64
+ exit 1
65
+ else
66
+ echo " INFO: nc command is found"
67
+ fi
68
+ else
69
+ if ! command -v telnet > /dev/null 2>&1 ; then
70
+ echo -e " \033[1;31mERROR: telnet command not found on non-Linux system, please relaunch the script after you install telnet\033[0m"
71
+ return 1
72
+ else
73
+ echo " INFO: telnet command is found"
74
+ fi
75
+ fi
45
76
}
77
+
78
+ # check permission
79
+ check_permission () {
80
+ local permission=$1
81
+ permissions=$( dspmqaut -m $QMGR_NAME -t qmgr -p $AUTH_USER )
82
+ if echo " $permissions " | grep -q " $permission " ; then
83
+ return 0 # the permission exists
84
+ else
85
+ return 1 # the permission doesn't exist
86
+ fi
87
+ }
88
+
46
89
# 2. Set correct authority for $AUTH_USER to access QMGR.
47
90
setQmgrAuth (){
48
- echo -e " \033[1;33mINFO: Set authority for user $AUTH_USER to access QMGR.\033[0m"
49
- echo " The user $AUTH_USER has following authority before setting:"
50
- echo " $( dmpmqaut -m $QMGR_NAME -t qmgr -p $AUTH_USER ) "
51
- setmqaut -m " $QMGR_NAME " -t qmgr -p " $AUTH_USER " +connect +inq
52
- if [ $? -eq 0 ]; then
53
- echo -e " \033[1;32mINFO: The authority has been set succesfully for user $AUTH_USER \033[0m"
54
- echo " The user $AUTH_USER has following authority after setting:"
55
- echo " $( dmpmqaut -m $QMGR_NAME -t qmgr -p $AUTH_USER 2>&1 ) "
91
+ echo " INFO: Check authority for user $AUTH_USER to access QMGR."
92
+ PERMS=(" connect" " inq" )
93
+ for PERM in " ${PERMS[@]} " ; do
94
+ if ! check_permission $PERM ; then
95
+ setmqaut -m $QMGR_NAME -t qmgr -p $AUTH_USER +$PERM > /dev/null 2>&1
96
+ PERMISSIONS_NEW+=(" $PERM " )
97
+ fi
98
+ done
99
+ if [ ${# PERMISSIONS_NEW[@]} -ne 0 ]; then
100
+ echo " INFO: Newly added permissions for user $AUTH_USER on QMGR $QMGR_NAME : ${PERMISSIONS_NEW[*]} "
56
101
else
57
- echo -e " \033[1;31mERROR: Failed to set the authority for user $AUTH_USER to $QMGR_NAME \033[0m"
58
- echo -e " \033[1;31m$RESULT \033[0m"
59
- exit 1
102
+ echo " INFO: No new permissions were added for user $AUTH_USER on QMGR $QMGR_NAME "
60
103
fi
61
104
}
62
105
@@ -67,21 +110,18 @@ getListenerPort(){
67
110
while read -r port; do
68
111
if checkPort $port ; then
69
112
AVAILABLE_PORTS+=" $port "
70
- echo -e " \033[1;32mINFO: Port $port is open and accepting connections.\033[0m"
71
- else
72
- echo -e " \033[1;33mWARNING: Port $port is not open or not accepting connections.\033[0m"
73
113
fi
74
114
done <<< " $listener_ports"
75
115
fi
76
116
if [ -n " $AVAILABLE_PORTS " ]; then
77
- echo -e " \033[1;32mINFO : Found available ports: $AVAILABLE_PORTS \033[0m "
117
+ echo " INFO : Found available ports: $AVAILABLE_PORTS "
78
118
else
79
119
echo " Create a listener as there is no listener port found"
80
- echo " DEFINE LISTENER($LISTENER_NAME ) TRPTYPE(TCP) PORT($LISTENER_PORT )" | runmqsc " $QMGR_NAME "
81
- echo " START LISTENER($LISTENER_NAME ) IGNSTATE(NO)" | runmqsc " $QMGR_NAME "
120
+ echo " DEFINE LISTENER($LISTENER_NAME ) TRPTYPE(TCP) PORT($LISTENER_PORT )" | runmqsc " $QMGR_NAME " > /dev/null 2>&1
121
+ echo " START LISTENER($LISTENER_NAME ) IGNSTATE(NO)" | runmqsc " $QMGR_NAME " > /dev/null 2>&1
122
+ LISTENER_NEW=$LISTENER_NAME
82
123
if checkPort $LISTENER_PORT ; then
83
124
AVAILABLE_PORTS+=" $LISTENER_PORT "
84
- echo -e " \033[1;32mINFO: Port $LISTENER_PORT is open and accepting connections.\033[0m"
85
125
else
86
126
echo -e " \033[1;31mERROR: Port $LISTENER_PORT is not open or not accepting connections. Please check and fix.\033[0m"
87
127
exit 1
@@ -93,20 +133,11 @@ checkPort() {
93
133
local port=" $1 "
94
134
os_type=$( uname -s)
95
135
if [ -z " $port " ] || [ " $port " -eq 0 ]; then
96
- echo -e " \033[1;31mERROR: Invalid port number: $port \033[0m"
97
136
return 1
98
137
fi
99
138
if [[ " $os_type " == " Linux" ]]; then
100
- if ! command -v nc > /dev/null 2>&1 ; then
101
- echo -e " \033[1;31mERROR: nc command not found: $port \033[0m"
102
- return 1
103
- fi
104
139
nc -zv localhost " $port " > /dev/null 2>&1
105
140
else
106
- if ! command -v telnet > /dev/null 2>&1 ; then
107
- echo -e " \033[1;31mERROR: telnet command not found: $port \033[0m"
108
- return 1
109
- fi
110
141
telnet localhost " $port " > /dev/null 2>&1
111
142
fi
112
143
}
@@ -115,10 +146,18 @@ checkPort() {
115
146
prepChannelAndTopic (){
116
147
CHECK_CHANNEL=$( echo " DISPLAY CHANNEL($CHANNEL_NAME )" | runmqsc " $QMGR_NAME " )
117
148
if [[ " $CHECK_CHANNEL " != * " not found" * ]]; then
118
- echo -e " \033[1;31mERROR: The channel exists, please try another CHANNEL_NAME or delete the existing channel and rerun the script. \033[0m"
119
- echo -e " \033[1;31mYou can use revert-mq.sh to delete this channel and revert all created objects:\033[0m"
120
- echo -e " ./revert-mq.sh -q $QMGR_NAME -d $MQ_BIN_PATH -u $AUTH_USER -l $LISTENER_NAME -c $CHANNEL_NAME "
121
149
echo " $CHECK_CHANNEL "
150
+ echo -e " \033[1;31mERROR: The channel $CHANNEL_NAME already exists, please use a different name or delete the existing channel and rerun the script. \033[0m"
151
+
152
+ if [[ ${# PERMISSIONS_NEW[@]} -ne 0 || -n " $LISTENER_NEW " ]]; then
153
+ echo -e " \033[1;31mNOTE: Following objects/permissions are changed or created, please revert them manually or use script revert-mq.sh to clean up before rerunning: \033[0m"
154
+ if [ ${# PERMISSIONS_NEW[@]} -ne 0 ]; then
155
+ echo " Permissions added on QMGR $QMGR_NAME for user $AUTH_USER : ${PERMISSIONS_NEW[*]} "
156
+ fi
157
+ if [ -n " $LISTENER_NEW " ]; then
158
+ echo " Listener new created: $LISTENER_NEW "
159
+ fi
160
+ fi
122
161
exit 1
123
162
fi
124
163
# Execute the MQSC commands
@@ -129,60 +168,126 @@ prepChannelAndTopic(){
129
168
EXPECTED_OUTPUT=" AMQ9783I: Channel will run using MCAUSER('$AUTH_USER ')."
130
169
131
170
if [[ " $OUTPUT " == * " $EXPECTED_OUTPUT " * ]]; then
132
- echo -e " \033[1;32mINFO: The channel authority is set successfully with output:\033[0m"
133
- echo -e " \033[1;32m$EXPECTED_OUTPUT \033[0m"
134
- EXISTING_TOPIC=$( echo " dis TOPIC(*) WHERE(TOPICSTR EQ '$TOPIC_STR ')" | runmqsc " $QMGR_NAME " )
135
- # Create a topic if it doesn't exist
136
- if [[ $EXISTING_TOPIC == * " not found" * ]]; then
137
- echo " Topic object with TOPICSTR '$TOPIC_STR ' not found. Creating a new one..."
138
- echo " DEFINE TOPIC($TOPIC_NAME ) TOPICSTR('$TOPIC_STR ')" | runmqsc " $QMGR_NAME "
139
- else
140
- echo -e " \033[1;32mINFO: Topic object with TOPICSTR '$TOPIC_STR ' already exists.\033[0m"
141
- TOPIC_NAME=$( echo " $EXISTING_TOPIC " | sed -n ' /TOPIC(\*/d; s/^.*TOPIC(\([^)]*\)).*$/\1/p' )
142
- fi
143
- # Set authrec for the topic
144
- echo " $MQSC_SET_AUTH_4_TOPIC " | runmqsc " $QMGR_NAME "
145
- echo " Set authrec for the topic $TOPIC_NAME "
146
- # Verify the authrec exists
147
- EXISTING_AUTHREC=$( echo " DIS AUTHREC PROFILE($TOPIC_NAME ) OBJTYPE(TOPIC)" | runmqsc " $QMGR_NAME " )
148
- # Print the result
149
- if [[ $EXISTING_AUTHREC == * " not found" * ]]; then
150
- echo -e " \033[1;31mERROR: AUTHREC for topic '$TOPIC_NAME ' does not exist.Please check the commands execution result\033[0m"
151
- echo " $EXISTING_AUTHREC "
152
- exit 1
153
- else
154
- echo -e " \033[1;32mINFO: AUTHREC for topic '$TOPIC_NAME ' exists.\033[0m"
171
+ echo " INFO: The channel authority is set successfully with output: $EXPECTED_OUTPUT "
172
+ if [ " ${TYPE} " != " mq" ]; then
173
+ EXISTING_TOPIC=$( echo " dis TOPIC(*) WHERE(TOPICSTR EQ '$TOPIC_STR ')" | runmqsc " $QMGR_NAME " )
174
+ # Create a topic if it doesn't exist
175
+ if [[ $EXISTING_TOPIC == * " not found" * ]]; then
176
+ echo " INFO: Topic object with TOPICSTR '$TOPIC_STR ' not found. Creating a new one..."
177
+ echo " DEFINE TOPIC($TOPIC_NAME ) TOPICSTR('$TOPIC_STR ')" | runmqsc " $QMGR_NAME "
178
+ TOPIC_NEW=$TOPIC_NAME
179
+ else
180
+ echo " INFO: Topic object with TOPICSTR '$TOPIC_STR ' already exists."
181
+ TOPIC_NAME=$( echo " $EXISTING_TOPIC " | sed -n ' /TOPIC(\*/d; s/^.*TOPIC(\([^)]*\)).*$/\1/p' )
182
+ fi
183
+ # Set authrec for the topic
184
+ echo " $MQSC_SET_AUTH_4_TOPIC " | runmqsc " $QMGR_NAME "
185
+ echo " INFO: Set authrec for the topic $TOPIC_NAME "
186
+ # Verify the authrec exists
187
+ EXISTING_AUTHREC=$( echo " DIS AUTHREC PROFILE($TOPIC_NAME ) OBJTYPE(TOPIC) PRINCIPAL('$AUTH_USER ')" | runmqsc " $QMGR_NAME " )
188
+ # Print the result
189
+ if [[ $EXISTING_AUTHREC == * " not found" * ]]; then
190
+ echo -e " \033[1;31mERROR: AUTHREC for topic '$TOPIC_NAME ' does not exist. Please fix the issue according to the commands execution result. \033[0m"
191
+ echo " $EXISTING_AUTHREC "
192
+ exit 1
193
+ else
194
+ echo " INFO: AUTHREC for topic '$TOPIC_NAME ' exists."
195
+ fi
155
196
fi
156
197
else
157
- echo -e " \033[1;31mERROR: The channel authority is failed to set. Check the blocking AUTHREC and fix it .\033[0m"
198
+ echo -e " \033[1;31mERROR: The channel authority is failed to set. Fix it by removing the blocking AUTHREC and then rerun the script .\033[0m"
158
199
echo -e " $OUTPUT "
159
- exit 1
200
+ echo -e " \033[1;31mNOTE: Following objects/permissions are changed or created, please revert them manually or use script revert-mq.sh to clean up before rerunning: \033[0m"
201
+ if [ ${# PERMISSIONS_NEW[@]} -ne 0 ]; then
202
+ echo " Permissions added on QMGR: $QMGR_NAME for user: $AUTH_USER : ${PERMISSIONS_NEW[*]} "
203
+ fi
204
+ if [ -n " $LISTENER_NEW " ]; then
205
+ echo " Listener new created: $LISTENER_NEW "
206
+ fi
207
+ CHANNEL_AUTHREC_NEW=$( echo " DIS AUTHREC PROFILE($CHANNEL_NAME ) OBJTYPE(CHANNEL) PRINCIPAL('$AUTH_USER ')" )
208
+ CHLAUTH_NEW=$( echo " DIS CHLAUTH($CHANNEL_NAME ) TYPE(BLOCKUSER)" )
209
+ echo " Channel new created: $CHANNEL_NAME "
210
+ echo " AUTHREC new added for channel $CHANNEL_NAME :"
211
+ echo " $CHANNEL_AUTHREC_NEW "
212
+ echo " CHLAUTH new added for channel $CHANNEL_NAME :"
213
+ echo " $CHLAUTH_NEW "
214
+ exit 1
160
215
fi
161
216
}
162
217
163
218
# 5. Print out useful info you need in setting configuration.yaml
164
219
printConnInfo (){
165
- echo -e " \033[1;32mHint: Please set the configuration.yaml for ACE sensor with following info:\033[0m"
166
- echo -e " \033[1;32m queuemanagerName: $QMGR_NAME \033[0m"
167
- echo -e " \033[1;32m mqport: $AVAILABLE_PORTS (choose one)\033[0m"
168
- echo -e " \033[1;32m channel: $CHANNEL_NAME \033[0m"
169
- echo -e " \033[1;32m mqUsername: $AUTH_USER \033[0m"
220
+
221
+ echo -e " \033[1;32mINFO: You have prepared the MQ objects for Instana monitoring well. Following Objects and Permissions are new added:\033[0m"
222
+ if [ ${# PERMISSIONS_NEW[@]} -ne 0 ]; then
223
+ echo -e " \033[1;32mPermissions added on QMGR $QMGR_NAME for user $AUTH_USER : \033[0m"
224
+ echo " ${PERMISSIONS_NEW[*]} "
225
+ fi
226
+ if [ -n " $LISTENER_NEW " ]; then
227
+ echo -e " \033[1;32mListener new created: \033[0m"
228
+ echo " $LISTENER_NEW "
229
+ fi
230
+ echo -e " \033[1;32mChannel new created: \033[0m"
231
+ echo " $CHANNEL_NAME "
232
+ echo -e " \033[1;32mAUTHREC and CHLAUTH new added for channel $CHANNEL_NAME :\033[0m"
233
+ echo " CHLAUTH($CHANNEL_NAME ) TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Block all users except authorized users')"
234
+ echo " AUTHREC profile($CHANNEL_NAME ) objtype(channel) PRINCIPAL('$AUTH_USER ') AUTHADD(ALL)"
235
+ if [ " ${TYPE} " != " mq" ]; then
236
+ if [ -n " $TOPIC_NEW " ]; then
237
+ echo -e " \033[1;32mTopic new created: $TOPIC_NEW \033[0m"
238
+ fi
239
+ echo -e " \033[1;32mAUTHREC new added for topic $TOPIC_NAME :\033[0m"
240
+ echo " AUTHREC profile($TOPIC_NAME ) objtype(topic) PRINCIPAL('$AUTH_USER ') AUTHADD(ALL)"
241
+ echo " "
242
+
243
+ echo -e " \033[1;32mYou can set the configuration.yaml for ACE sensor with following info:\033[0m"
244
+ echo " queuemanagerName: $QMGR_NAME "
245
+ echo " mqport: $AVAILABLE_PORTS (choose one)"
246
+ echo " channel: $CHANNEL_NAME "
247
+ echo " mqUsername: $AUTH_USER "
248
+ echo " "
249
+ fi
250
+
251
+ echo -e " \033[1;32mYou can set the configuration.yaml for MQ sensor with following info:\033[0m"
252
+ echo " QUEUE_MANAGER_NAME_1: $QMGR_NAME "
253
+ echo " port: $AVAILABLE_PORTS (choose one)"
254
+ echo " channel: $CHANNEL_NAME "
255
+ echo " username: $AUTH_USER "
256
+ echo " "
257
+
170
258
echo -e " \033[1;32mThis tool only covers basic info, for other info, like user password and SSL related info, please check manually and set properly.\033[0m"
171
- echo -e " \033[1;33mINFO: If you want to revert the authority and clean up the objects created, please make sure you have downloaded the revert-mq.sh script and run like following: \033[0m"
172
- echo " ./revert-mq.sh -q $QMGR_NAME -d $MQ_BIN_PATH -u $AUTH_USER -l $LISTENER_NAME -c $CHANNEL_NAME -t $TOPIC_NAME "
259
+ echo -e " \033[1;33mINFO: To revert the permissions added and objects created, download the revert-mq.sh script and run like following: \033[0m"
260
+ local opt_p=' '
261
+ local opt_l=' '
262
+ local opt_t=' '
263
+ if [ ${# PERMISSIONS_NEW[@]} -ne 0 ]; then
264
+ opt_p=" -p '${PERMISSIONS_NEW[*]} '"
265
+ fi
266
+ if [ -n " $LISTENER_NEW " ]; then
267
+ opt_l=" -l $LISTENER_NEW "
268
+ fi
269
+ if [ -n " $TOPIC_NEW " ]; then
270
+ opt_t=" -t $TOPIC_NEW "
271
+ fi
272
+ echo " ./revert-mq.sh -q $QMGR_NAME -d $MQ_BIN_PATH -u $AUTH_USER $opt_p $opt_l -c $CHANNEL_NAME $opt_t "
173
273
}
174
274
175
275
176
276
# 0: Init
177
277
# Define the variables
178
- CHANNEL_NAME=' INSTANA.ACE. SVRCONN'
278
+ CHANNEL_NAME=' INSTANA.SVRCONN'
179
279
TOPIC_NAME=' INSTANA.ACE.BROKER.TOPIC'
180
280
TOPIC_STR=' $SYS/Broker'
181
- LISTENER_NAME=' INSTANA.ACE. LST'
281
+ LISTENER_NAME=' INSTANA.LST'
182
282
LISTENER_PORT=' 2121'
183
283
AVAILABLE_PORTS=' '
284
+ PERMISSIONS_NEW=()
285
+ LISTENER_NEW=' '
286
+ TOPIC_NEW=' '
287
+ TYPE=" ace"
288
+
184
289
# Check the parameters
185
- while getopts " :q:d:u:" opt; do
290
+ while getopts " :q:d:u:c:m " opt; do
186
291
case ${opt} in
187
292
q)
188
293
QMGR_NAME=${OPTARG}
@@ -193,6 +298,12 @@ while getopts ":q:d:u:" opt; do
193
298
u)
194
299
AUTH_USER=${OPTARG}
195
300
;;
301
+ c)
302
+ CHANNEL_NAME=${OPTARG}
303
+ ;;
304
+ m)
305
+ TYPE=" mq"
306
+ ;;
196
307
? )
197
308
printUsage
198
309
exit 1
@@ -202,15 +313,17 @@ done
202
313
shift $(( $OPTIND - 1 ))
203
314
204
315
if [[ -z " $QMGR_NAME " || -z " $MQ_BIN_PATH " || -z " $AUTH_USER " ]]; then
205
- echo -e " \033[1;31mERROR: These arguments are required, but seems they are not set correctly."
206
- echo " QMGR_NAME: $QMGR_NAME "
207
- echo " MQ_BIN_PATH: $MQ_BIN_PATH "
208
- echo " AUTH_USER:$AUTH_USER "
316
+ echo -e " \033[1;31mERROR: These arguments are required, but seems they are not set correctly.\033[0m"
317
+ echo " -q <QMGR_NAME> -d <MQ_BIN_PATH> -u <AUTH_USER>"
318
+ echo " "
209
319
printUsage
210
320
exit 1
211
321
fi
322
+ if [ -z " $CHANNEL_NAME " ]; then
323
+ CHANNEL_NAME=' INSTANA.SVRCONN'
324
+ fi
212
325
213
- # Define the MQSC commands fro channel creating
326
+ # Define the MQSC commands for channel creating
214
327
read -r -d ' ' MQSC_CHECK_CHANNEL << EOF
215
328
DEFINE CHANNEL($CHANNEL_NAME ) CHLTYPE(SVRCONN) TRPTYPE(TCP) MCAUSER('$AUTH_USER ')
216
329
SET CHLAUTH($CHANNEL_NAME ) TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Block all users except authorized users')
0 commit comments