Author Topic: mlcmd not working corretly  (Read 2445 times)

Offline willy92wins

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
mlcmd not working corretly
« on: February 12, 2019, 06:22:09 PM »
Hi,

Im trying to program a script to automatize the restart of certain applications by calling SCI with the command line using  mlcmd tool.
My platform has 2 config servers, i have server genesys02b config server as primary right now and genesys02a as backup.
The config file for the config server sets the following options:

[confserv]
port =2020
management-port =2021
...

I get Conn Write error when i try to connect to the management port on both configs, and if I try to connect to the normal port an unknown error is returned in primary role and not found error is found in backup.

Screenshot:


Anybody knows why this is not working/how to fix it?


Offline vmc

  • Full Member
  • ***
  • Posts: 112
  • Karma: 0
Re: mlcmd not working corretly
« Reply #1 on: February 12, 2019, 06:39:18 PM »
Never used it but why is the csappname SCI?

Sent from my Redmi Note 3 using Tapatalk


Offline willy92wins

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Re: mlcmd not working corretly
« Reply #2 on: February 12, 2019, 07:12:00 PM »
Thanks for pointing that out! I changed it to my app name and now i get another different error:



I have tried looking up for it but cant find any references neither on Genesys site nor Google itself

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
  • Karma: 56330
Re: mlcmd not working corretly
« Reply #3 on: February 12, 2019, 08:52:03 PM »
What does CfgServer logs says?

Offline vmeno000

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
Re: mlcmd not working corretly
« Reply #4 on: February 16, 2019, 10:36:01 AM »
Try IP address of config server for the -cshost parameter and see if it works. Then if the provided -csport <port> -csappname <app_name> -csuser <username> -cspassword <password> is all correct, then check SCS logs for a new mlcmd connection (Validate those credentials using CME or GA or any tool that requires authentication into Genesys Config Layer first). You should see something like this in your SCS logs which is basically the output you will also see in your command line result

17:20:47.588 Client: new client 444 connected.
17:20:47.588 Client: host name wasn't obtained. IP-address: ***.***.**.**:47240
17:20:47.589 Create CIRequester (socket: 444, name: 'mlcmd')
17:20:47.589   Trace   192.168.10.98   Solution_Control_Server   GCTI-43-10400   SC Interface 'mlcmd' connected, username='default', socket=444, client's host='(***.***.**.**:47240)', client's tenant='Environment'
17:20:47.589 ### LOCAL MESSAGE#=10400, 'SC Interface 'mlcmd' connected, username='*****', socket=444, client's host='(***.***.**.**:47240)', client's tenant='************''
17:20:47.590 SCI(444,mlcmd) <== {confserv      } [APP_STATUS_RUNNING, PRIMARY]
17:20:47.590 SCI(444,mlcmd) <== {102, DBServer_Logs } [APP_STATUS_RUNNING, PRIMARY]
17:20:47.590 SCI(444,mlcmd) <== {103, Solution_Control_Server} [APP_STATUS_RUNNING, PRIMARY]
17:20:47.590 SCI(444,mlcmd) <== {104, DAP_Logs      } [APP_STATUS_UNKNOWN, EXITED]
17:20:47.590 SCI(444,mlcmd) <== {105, Message_Server} [APP_STATUS_RUNNING, PRIMARY]

Masked IPs above.
GCP - CIV, GCP - DIV, GCP - COV, GCP - CSIP

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 539
  • Karma: 29
Re: mlcmd not working corretly
« Reply #5 on: February 16, 2019, 11:42:43 AM »
You are adding the -scshost switch but not specifying the host as a parameter. Also, you should use it along with -scsport switch

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
Re: mlcmd not working corretly
« Reply #6 on: February 16, 2019, 09:38:31 PM »
Yeah you need to pass config server details and scs details. Your not providing SCS details (you can see the error when you use port 2020 that it can't connect to scs.)

Code: [Select]
mlcmd -cshost $CSHOST -csport $CSPORT -csuser $CSUSER -cspassword $CSPASS -csappname $CSAPP -scshost $SCSHOST -scsport $SCSPORT -getallappstatus
I've built a wrapper around mlcmd which tries primary and backup config server (incase the backup is primary) and also primary and backup SCS (again incase backup is running primary)

This is a bash script though, so you would need to adjust for windows obviously..

Code: [Select]
#!/bin/bash

# redirect output - stdout should go to stderr
# for the duration of the script except right at the end
exec 3>&1 4>&2
exec 1>&2

# return codes
SCS_CONNECTION_ERROR=254
CS_CONNECTION_ERROR=250

# uncomment for debug
# set -x

# config server user/app
CSUSER="username@domain.com.au"
CSPASS="pass"
CSAPP="default"

# config server host and port (primary and backup)
CSHOST_PRIMARY="cs-primary.domain.com.au"
CSPORT_PRIMARY="2000"
CSHOST_BACKUP="cs-backup.domain.com.au"
CSPORT_BACKUP="2000"

# scs host and port (primary and backup)
SCSHOST_PRIMARY="scs-primary.domain.com.au"
SCSPORT_PRIMARY="2052"
SCSHOST_BACKUP="scs-backup.domain.com.au"
SCSPORT_BACKUP="2052"

CSHOST=$CSHOST_PRIMARY
CSPORT=$CSPORT_PRIMARY
SCSHOST=$SCSHOST_PRIMARY
SCSPORT=$SCSPORT_PRIMARY

MLCMD=/home/user/mlcmd_64

# execute command first time - may run into CS_CONNECTION_ERROR or SCS_CONNECTION_ERROR
output1=$($MLCMD -cshost $CSHOST -csport $CSPORT -csuser $CSUSER -cspassword $CSPASS -csappname $CSAPP -scshost $SCSHOST -scsport $SCSPORT "$@" 2>&1)
result1=$?; result=$result1; output=$output1

# execute command second time if CS_CONNECTION_ERROR or SCS_CONNECTION_ERROR errros occured
if [[ $result1 == $CS_CONNECTION_ERROR || $result1 == $SCS_CONNECTION_ERROR ]] ; then {
  [[ $result1 == $CS_CONNECTION_ERROR ]] && { CSHOST=$CSHOST_BACKUP; CSPORT=$CSPORT_BACKUP; }
  [[ $result1 == $SCS_CONNECTION_ERROR ]] && { SCSHOST=$SCSHOST_BACKUP; SCSPORT=$SCSPORT_BACKUP; }
  output2=$($MLCMD -cshost $CSHOST -csport $CSPORT -csuser $CSUSER -cspassword $CSPASS -csappname $CSAPP -scshost $SCSHOST -scsport $SCSPORT "$@" 2>&1)
  result2=$?; result=$result2; output=$output2
} fi

# execute command third time if CS_CONNECTION_ERROR or SCS_CONNECTION_ERROR errros still occured
if [[ $result2 == $CS_CONNECTION_ERROR || $result2 == $SCS_CONNECTION_ERROR ]] ; then {
  [[ $result2 == $CS_CONNECTION_ERROR ]] && { CSHOST=$CSHOST_BACKUP; CSPORT=$CSPORT_BACKUP; }
  [[ $result2 == $SCS_CONNECTION_ERROR ]] && { SCSHOST=$SCSHOST_BACKUP; SCSPORT=$SCSPORT_BACKUP; }
  output3=$($MLCMD -cshost $CSHOST -csport $CSPORT -csuser $CSUSER -cspassword $CSPASS -csappname $CSAPP -scshost $SCSHOST -scsport $SCSPORT "$@" 2>&1)
  result3=$?; result=$result3; output=$output3
} fi


exec >&3 2>&4
echo "$output"
exit $result

Offline vmeno000

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
Re: mlcmd not working corretly
« Reply #7 on: February 17, 2019, 03:57:30 AM »
@james is right. use -scshost and -scsport specially if you have multiple SCSs even though they are optional as mentioned in the link below:

https://docs.genesys.com/Documentation/FR/Current/MLUG/mlcmdCLI

I believe if those options are not specified, mlcmd tries to use the SCS with the lowest DBID. Either way all great info. I hope all these help you resolve your issue and thanks to all for all the good content.




GCP - CIV, GCP - DIV, GCP - COV, GCP - CSIP